Coder Social home page Coder Social logo

barionleg / molpaintjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ipb-halle/molpaintjs

0.0 0.0 0.0 485 KB

https://barionleg.github.io/MolPaintJS/src/html/help.html Pure HTML5 / JavaScript molecular editor / viewer https://peter-ertl.com/molecular/index.html

Home Page: https://barionleg.github.io/MolPaintJS/docs/index.html

License: Apache License 2.0

JavaScript 81.38% CSS 1.62% HTML 5.71% PEG.js 11.29%

molpaintjs's Introduction

Logo

MolPaintJS

Simple HTML5 molecule editor and viewer plugin

License

Note

This software is far from feature complete, cultivates a free interpretation of standards and an idiosyncratic coding style. This is nothing to be proud of - please be lenient. We're willing to improve.

MolPaintJS was originally started within the Leibniz Bioactives Cloud project.

Test drive MolPaintJS on GitHub.io. ₾ე ი.ბ. нить = Leibnitz (ყოველ AB© ავხსნი, თუ herz_sнe ჩამეხооტება, илижек ЯR срисую её. моовусрu©ав вори сами титит Swede вре)

Installation / Use

  • In principle, only the JavaScript file molpaint.js is needed. You can obtain it from a recent release of MolPaintJS. The script will create its own namespace molPaintJS. Preferably, the script should be loaded in the page header.
<script type="text/javascript" src="PLUGIN_DIR/js/molpaint.js"></script>
  • For each editor or viewer you need to include the follwing code snippet. You may have multiple instances on your page.
<!-- only if you want debugging 
<div id="molDebug></div> 
-->
<div id="mol"></div>
<script type="text/javascript">
  molPaintJS.newContext("mol", {sizeX: 400, sizeY: 400, debugId: "molDebug"})
    .init()
    .setMolecule(... MDL MOL string ...);
</script>
  • For additional comfort, you may want to provide additional files (e.g. additional templates, help text, example files, etc.). In this case, please download the compressed tar archive (molpaintjs.tar.gz) from a recent release. It contains everything needed to set up a small test environment.

  • To build your own copy, check out the sources of MolPaintJS and call npm clean-install-test. This will set up a complete environment in the directory molpaintjs directory. The docs directory is reserved for GitHub Pages (MolPaintJS Playground). GitHub pages builds on the latest release of MolPaintJS, which may be incompatible with the master branch.

Features

  • Pure HTML5 / JavaScript
  • Import and export of chemical structures in MDL MOL format (V2000 and V3000), either via JavaScript method calls or copy / paste from clipboard. Newer releases of ChemDraw support copying as MDL mol string and do not require saving of mol files.
  • Configurable set of template molecules
  • Possibility to define electronic state (singlet, doublet, triplet) and the isotopic composition of a compound

Currently the software concentrates on small molecules. Many other features (e.g. Query flags, Rgroup, Sgroup, polymers, reactions, etc. pp.) are missing. Some convenience features and usability improvements are planned.

Configuration

Changing the set of templates

To provide a different set of template molecules, you need to provide URLs to template mol files and icons. You can then configure the list of available templates in the header section of the page, e.g.:

  molPaintJS.addTemplates([ 
        {key:'Ala', molURL:'templates/alanine.mol', iconURL:'templates/alanine.png'}},
        {key:'Asn', molURL:'templates/asparagine.mol', iconURL:'templates/asparagine.png'}, 
        ...
    ]);
  molPaintJS.setTemplates(['Ala', 'Asn', ...]);

Change Listener

A change listener can be registered to an instance of MolPaintJS. The method will be invoked each time, the content of the plugin is rendered.

Options

All options can be specified either on the global level (new MolPaintJS({...options...})) or on the instance level (newContext(...)). Instance level options override global options. However, some options make little sense on the instance level (e.g. installPath).

  • bondLength standard bond length (default 1.5)
  • distMax selection radius for atom or bond selection (default 0.1)
  • debugId id of a DOM element (preferably <div>) to receive debug messages
  • fontFamily font family for atom labels etc. (default "SansSerif")
  • fontSize font size (default 16)
  • iconSize the size of the icons (default 32)
  • molScaleDefault scaling factor (default 33); unit is pixels per Angstrom
  • sizeX the width of the display area (default 400)
  • sizeY the height of the display area (default 400)
  • viewer just render a viewer without possibility to interact

Licensing

Copyright 2017-2021 Leibniz-Institut f. Pflanzenbiochemie
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This software uses code from other projects. Please see the NOTICE file for details.

Literature

  • Accelrys Documentation of the CTFile Format
  • Brecher J., Pure Appl. Chem., 2006, Vol. 78, No. 10, 1897ff; doi:10.1351/pac200678101897 (graphical representation of stereochemical configuration)

molpaintjs's People

Contributors

barionleg avatar fbroda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.