mcs07 / cirpy Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for the NCI Chemical Identifier Resolver (CIR)
Home Page: https://cirpy.readthedocs.io
License: MIT License
Python wrapper for the NCI Chemical Identifier Resolver (CIR)
Home Page: https://cirpy.readthedocs.io
License: MIT License
4,4',4''-methanetriyltris(N,N-diethylaniline) (https://pubchem.ncbi.nlm.nih.gov/compound/Leucocrystal-Violet#section=MeSH-Entry-Terms) comes up with the following SMILES:
[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].[W].CCN(CC)c1ccc(cc1)C+c3ccc(cc3)N(CC)CC'
Hi All, if anyone is looking for an alternative name resolver we have built another version that uses a local copy of OPSIN here: https://github.com/JacksonBurns/py2opsin
Hi.
CIRpy is so nice tool for me.
I found some trouble about "image_url".
To get imange_url with smiles, when the smiles has triple bond "#", this query will fail.
For example, smiles = "C#N" could not get the image_url.
So, I got image like that
get smiles.
smi = cirpy.resolve(query,"smiles",["cir_name","chemspider_name","opsin_name"])
then replace "#"
html_smi = smi.replace("#","%23")
and get image
imageurl = cirpy.Molecule(html_smi, ["smiles"]).image_url
Is that correct way?
Thanks.
with cirpy.resolve('5263-34-3', 'smiles')
the result is '[Cl]|[Hg]|12|[OH+]=C(CC[OH+]|1C)NC3CCCCC23' which I don't think is valid. I believe this is the compound it should resolve to: https://pubchem.ncbi.nlm.nih.gov/substance/273559422
CIRpy version: v1.0.2
I recently installed cirpy on mac osx (10.11.1) using pip. I tried the example and got the following:
cirpy.resolve('Aspirin', 'smiles')
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/cirpy.py", line 192, in resolve
results = query(input, representation, resolvers, False, get3d, *_kwargs)
File "/Library/Python/2.7/site-packages/cirpy.py", line 162, in query
tree = request(input, representation, resolvers, get3d, tautomers, *_kwargs)
File "/Library/Python/2.7/site-packages/cirpy.py", line 95, in request
response = urlopen(url)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
context=self._context)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:590)>
urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
Having the above issue while running this command
cirpy.resolve('Aspirin', 'smiles')
I just installed CIRpy and tried it out, but got this error, even though my internet is fine:
>>> from cirpy import Molecule
>>> Molecule("water")
Molecule(input='water', resolvers=None, get3d=False, kwargs={})
>>> Molecule("water").formula
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1392, in connect
super().connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 722, in create_connection
raise err
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
TimeoutError: [Errno 60] Operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/BenjaminLee/Desktop/Python/Research/flow-chem/env/lib/python3.6/site-packages/cirpy.py", line 296, in fget_memoized
setattr(self, attr_name, fget(self))
File "/Users/BenjaminLee/Desktop/Python/Research/flow-chem/env/lib/python3.6/site-packages/cirpy.py", line 384, in formula
return resolve(self.input, 'formula', self.resolvers, **self.kwargs)
File "/Users/BenjaminLee/Desktop/Python/Research/flow-chem/env/lib/python3.6/site-packages/cirpy.py", line 192, in resolve
results = query(input, representation, resolvers, False, get3d, **kwargs)
File "/Users/BenjaminLee/Desktop/Python/Research/flow-chem/env/lib/python3.6/site-packages/cirpy.py", line 162, in query
tree = request(input, representation, resolvers, get3d, tautomers, **kwargs)
File "/Users/BenjaminLee/Desktop/Python/Research/flow-chem/env/lib/python3.6/site-packages/cirpy.py", line 95, in request
response = urlopen(url)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 60] Operation timed out>```
The documentation is very limited regarding the meaning of these two properties. I can guess that one of them indicates the number of aromatic rings in the molecule, but what does the other refer to then? Does anybody know?
Dear CIRpy developers, I would like to give you a code sample that could be useful for many people and could be provided in some form in the basic documentation (or even integrated as a function). This simple code gets a list of molecule names in a text file and outputs their SMILES in the command prompt.
#!/usr/bin/python
# -*- coding: Latin-1 -*-
# ----- Get SMILES from list of names -----
#
import cirpy
with open("names.txt") as file:
data = file.readlines()
for molecule in data:
name = molecule.rstrip("\n\r")
SMILES = cirpy.resolve(name, 'smiles')
print name, SMILES
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.