cimm-kzn / cgrtools Goto Github PK
View Code? Open in Web Editor NEWThis project forked from python3pkg/cgrtools
CGRs, molecules and reactions manipulation
License: GNU Lesser General Public License v3.0
This project forked from python3pkg/cgrtools
CGRs, molecules and reactions manipulation
License: GNU Lesser General Public License v3.0
Hello! I wonder if it is possible to convert individual SMILES string into a molecule container object? Without working with files
I am trying to use your tool to generate inchi strings. This is my way around of installing the obenbabel. Here is the script I wrote:
with cgr.files.XYZRead(file='h.xyz') as f:
xyz = f.read()
xyz = xyz[0]
rdkitMol = cgr_utils.to_rdkit_molecule(data =xyz)
inchi = rdkit.Chem.inchi.MolToInchi(rdkitMol)
As you can see I go from the cgr molecule object into rdkit mol and then do the conversion to inchi. The problem is that for, e.g. a single hydrogen atom xyz file:
1
H 0.0 0.0 0.0
the produced inchi is as follows: InChI=1S/H/q-1 where it should rather be InChI=1S/H
I also noticed that in the MoleculeContainer for atomic hydrogen, the molecular_charge property was set to -1. Should not it rather be 0?
Similarly for the following xyz input:
1
F 0.0 0.0 0.0
the corresponding inchi is: InChI=1S/FH/h1H/p-1 as compared to InChI=1S/F
Similarly to hydrogen example, the molecular_charge property is also -1.
I wonder if there are any settings I could try while parsing the xyz files or converting to the rdkit mol object so that the resulting molecules would produce the expected inchi strings.
Just to say that for all larger molecules I have converted with my script the produced inchis were identical to those from openbabel.
The following script doesn't translate all lines to the rdf format:
#!/usr/bin/env python3
import sys
from CGRtools import SMILESRead
from CGRtools import RDFWrite
input_fn = sys.argv[1]
count = 0
with SMILESRead(input_fn) as input:
with RDFWrite(sys.stdout) as output:
for d in input:
output.write(d)
count += 1
print('read %d' % count, file = sys.stderr)
currently, you need to use the tilde operator, but this is not very easy to find / explicit
when you are new to this package.
Also, there could be a to_CGR method in the reaction object/container.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.