Package CHEM :: Package Common :: Module Smi2Depict :: Class Smi2Depict
[hide private]
[frames] | no frames]

Class Smi2Depict



Instance Methods [hide private]
 
__init__(self)
Constructor.
 
smi2depict(self, smilesFilename, depictFilename)
Primary method, reads the SMILES file to generate the Depict output file.
 
__call__(self, smiles)
Abbreviated synonym for depictImg method
 
depictImg(self, smiles)
Top level function to generate and HTML image tag to display a depiction of the respective SMILES string.
 
oghamDepictImg(self, smiles)
Generate the HTML IMG tag for a SMILES string to reach our OGham service
 
chemaxonMarvinDepictImg(self, smiles, arrowCodes="")
Generate the HTML IMG tag for a SMILES string to reach the ChemAxon Marvin service
 
chemaxonMarvinViewApplet(self, smiles, arrowCodes="", cgibinDir=None)
Generate the HTML to load a MarvinView applet of the respective SMILES.
 
chemaxonMarvinSketchApplet(self, smiles, arrowCodes="", cgibinDir=None, appletName="MSketch")
Generate the HTML to load a MarvinSketch applet of the respective SMILES.
 
__marvinStr(self, smi, arrowStr, cgibinDir)
Given a SMILES string and arrow codes, generate the molecule string to feed to a Marvin applet.
 
__patchMarvinLine(self, line)
Manual override corrections if needed
 
daylightDepictImg(self, smiles)
Generate the HTML IMG tag for a SMILES string to reach the Daylight Depict server
 
jmeDepictImg(self, smiles)
Generate the HTML to depict a SMILES string via the JME (http://www.molinspiration.com/jme) applet.
 
jmeMolText(self, smiles)
Given a SMILES string, convert it into a 2D Mol2 format, with "|" in place of new line characters.
 
oghamEncryptDepictImg(self, smiles)
Generate the HTML IMG tag for a SMILES string to reach our OGham service via the encrypted / obfuscated interface.
 
parseSmiles(self, smilesLine)
Given a string, strip out the first white-space separated token as the SMILES string.
Method Details [hide private]

__init__(self)
(Constructor)

 
Constructor. Set default parameters, not all of which are used, depending on the depiction format.

smi2depict(self, smilesFilename, depictFilename)

 
Primary method, reads the SMILES file to generate the Depict output file. See module documentation for more information.

depictImg(self, smiles)

 
Top level function to generate and HTML image tag to display a depiction of the respective SMILES string. The implementation will probably be updated towards an object-oriented approach in the future.

chemaxonMarvinViewApplet(self, smiles, arrowCodes="", cgibinDir=None)

 
Generate the HTML to load a MarvinView applet of the respective SMILES. Depends on generation of a temp file that the browser will load separately, which means have to be careful about relative paths.

chemaxonMarvinSketchApplet(self, smiles, arrowCodes="", cgibinDir=None, appletName="MSketch")

 

Generate the HTML to load a MarvinSketch applet of the respective SMILES. Depends on generation of a temp file that the browser will load separately, which means have to be careful about relative paths.

MarvinSketch support options like "detach" to appear more like a viewer.

__marvinStr(self, smi, arrowStr, cgibinDir)

 

Given a SMILES string and arrow codes, generate the molecule string to feed to a Marvin applet. In this case, will actaully generate a temp file and the molecule string will be the temp filename.

Depending on how called (e.g., CGI vs. PSP), have to be careful as the relative location of the temp file can differ between where this script is executing and where the web browser will try to retrieve it. Use the cgibinDir parameter to try and figure things out

jmeDepictImg(self, smiles)

 
Generate the HTML to depict a SMILES string via the JME (http://www.molinspiration.com/jme) applet. Requires a combination with OEDepict since JME doesn't actually generate the 2D atom coordinates.

jmeMolText(self, smiles)

 
Given a SMILES string, convert it into a 2D Mol2 format, with "|" in place of new line characters. This is the format needed for JME depiction. Note that JME cannot generate the 2D coordinates itself, so this is based on the OEDepict library.

oghamEncryptDepictImg(self, smiles)

 

Generate the HTML IMG tag for a SMILES string to reach our OGham service via the encrypted / obfuscated interface.

To decrypt the smiles string back to normal, just do the following. Of course, this assumes you have access to the ENCRYPT_KEY and that passing through an http request processor has already done the equivalent of urllib.unquote_plus(...): >>> import rotor >>> smiles = rotor.newrotor(ENCRYPT_KEY).decrypt(smilesEncrypted)

Can accept options parameters to pass through query string, expected as a dictionary of option:values. The smiles (molecule) title / name may be specified to pass as well as the net location and path to find the depiction server.

parseSmiles(self, smilesLine)

 
Given a string, strip out the first white-space separated token as the SMILES string. The remaining stripped text of the line, if any, will be returned as the molecule title.