|
| 1 | +# mol2chemfigPy3 |
| 2 | + |
| 3 | +[](https://pypi.org/project/mol2chemfigPy3/) |
| 4 | +[](https://pepy.tech/project/mol2chemfigpy3) |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +This is NOT an official version of mol2chemfig for python 3. |
| 11 | + |
| 12 | +mol2chemfigPy3 is a translation from py2 to py3 based on |
| 13 | +old [mol2chemfig](http://chimpsky.uwaterloo.ca/mol2chemfig/download) version 1.5. |
| 14 | + |
| 15 | +## Install |
| 16 | + |
| 17 | +### install from PyPi |
| 18 | + |
| 19 | +```bash |
| 20 | +$ pip install -U mol2chemfigPy3 |
| 21 | +``` |
| 22 | + |
| 23 | +## Usage |
| 24 | + |
| 25 | +### Use in command line |
| 26 | + |
| 27 | +> `mol2chemfig` and `python -m mol2chemfigPy3` are equivalent. |
| 28 | +
|
| 29 | +#### 1. getting version |
| 30 | + |
| 31 | +```bash |
| 32 | +$ mol2chemfig --version |
| 33 | +``` |
| 34 | + |
| 35 | +#### 2. getting help |
| 36 | + |
| 37 | +```bash |
| 38 | +$ mol2chemfig -h |
| 39 | +``` |
| 40 | + |
| 41 | +#### 3. some examples |
| 42 | + |
| 43 | +##### 3.1 converting SMILES |
| 44 | + |
| 45 | +```bash |
| 46 | +$ mol2chemfig -zw -i direct "C1=CC=C(C=C1)O" |
| 47 | +``` |
| 48 | + |
| 49 | +it will give you |
| 50 | + |
| 51 | +```latex |
| 52 | +\chemfig{OH-[:180,,1]=_[:240]-[:180]=_[:120]-[:60]=_(-[:300])} |
| 53 | +``` |
| 54 | + |
| 55 | +##### 3.2 writing to an output file |
| 56 | + |
| 57 | +```bash |
| 58 | +$ mol2chemfig -zw -i direct "C1=CC=C(C=C1)O" > phenol-smi-terse.tex |
| 59 | +``` |
| 60 | + |
| 61 | +it will write result to file `phenol-smi-terse.tex` |
| 62 | + |
| 63 | +##### 3.3 searching PubChem database |
| 64 | + |
| 65 | +```bash |
| 66 | +$ mol2chemfig -zw -i pubchem 996 |
| 67 | +``` |
| 68 | + |
| 69 | +##### 3.4 reading from a file |
| 70 | + |
| 71 | +```bash |
| 72 | +$ mol2chemfig -zw peniciling.mol |
| 73 | +``` |
| 74 | + |
| 75 | +### Use as a python package (new add in to this python 3 version) |
| 76 | + |
| 77 | +This is not included in the original Py2 version of mol2chemfig. |
| 78 | + |
| 79 | +> mol2chemfigPy3.___mol2chemfig___(content: _str_, *args: _str_, rotate: _float = 0.0_, aromatic: _bool = True_, marker: _Optional[str] = None_, name: _Optional[str] = None_, relative_angle: _bool = False_, show_carbon: _bool = False_, show_methyl: _bool = False_, inline: _bool = False_) |
| 80 | +
|
| 81 | +e. g. |
| 82 | + |
| 83 | +```python |
| 84 | +from mol2chemfigPy3 import mol2chemfig |
| 85 | + |
| 86 | +mol2chemfig('996') # search the PubChem database |
| 87 | + |
| 88 | +mol2chemfig('C1=CC=C(C=C1)O') # transfer InChI/SMILES to chemfig |
| 89 | + |
| 90 | +mol2chemfig('./methanol.smi') # from a file |
| 91 | +``` |
| 92 | + |
| 93 | +## To future maintainers |
| 94 | + |
| 95 | +The static callgraph of this project is: |
| 96 | + |
| 97 | +[](image/callgraph.svg) |
| 98 | + |
| 99 | +## Document |
| 100 | + |
| 101 | +~~See official document [mol2chemfig-doc.pdf (uwaterloo.ca)](http://chimpsky.uwaterloo.ca/m2cf_static/mol2chemfig-doc.pdf)~~ |
| 102 | + |
| 103 | +The website seems down, so here is a mirror [mol2chemfig Documentation Version 1.5](https://mirror.ox.ac.uk/sites/ctan.org/graphics/mol2chemfig/mol2chemfig-doc.pdf). |
| 104 | + |
| 105 | +## License |
| 106 | + |
| 107 | +MIT license |
| 108 | + |
0 commit comments