Package CHEM :: Package DB :: Package rdb :: Module rdbprivatedb :: Class Controller
[hide private]
[frames] | no frames]

Class Controller



Establishes db connection and controlls db insertion.

Instance Methods [hide private]
 
__init__(self, cmd, db, outputPath)
 
getReactionNames(self)
Returns a list of reaction names,ids from the database.
 
getAnnotationTypeIDs(self, annotationNameList=[])
Returns a list of ids for the specified annotation type names.
 
getReactionReferences(self, nameID, annotationTypeIDList=[])
Returns a list of tuples containing the reference's author and publication year.
 
findValidYears(self, str, min=1880, max=2007)
Uses regex to find the valid years between 1880 and 2007.
 
findValidAuthors(self, str, rxnName, checkRxn=False, checkStop=True)
Uses regex to find the valid authors.
 
getAuthorYearPairs(self, reactionName, referenceLines)
Parse the output of getReactionReferences to extra the author and years.
 
writeQueryFile(self, filename, values=[])
Write expected query file.
 
checkRDB(self, reactionName, annotation, label="smirks_annotation")
 
insertFromFile(self, filename)
Custom insertion from smirks file.
 
queryPrivateDB(self, qdebug=False)
Actually performs the system call to anan's program.
Method Details [hide private]

findValidAuthors(self, str, rxnName, checkRxn=False, checkStop=True)

 
Uses regex to find the valid authors. 
Eg,

    s="M. Amadori, Atti Accad. Naz. Lincei (6), 337 (1925), C.A. 20, 902 (1926); ibid. (6), 68, 226 (1929), C.A. 23, 3211, 3443 (1929). Conversion of N -glycosides of aldoses to N"
    
    >>> r = re.compile("(([A-Z]\.\ *)([A-Z]+[a-z]+)+(,|\.))+")
    >>> pmatch(r,s)
    ['M. Amadori,']
    
    s="L. Claisen, Ber. 45, 3157 (1912). Migration of a carbon-carbon double bond in a three carbon (allylic) system on treatment with nucleophiles under S N 1 conditions (or under S N 2 conditions when the nucleophilic attack takes place at the"
    >>> pmatch(r,s)
    ['L. Claisen,']

getAuthorYearPairs(self, reactionName, referenceLines)

 
Parse the output of getReactionReferences to extra the author and years. Create a combinatorial pairs.

insertFromFile(self, filename)

 
Custom insertion from smirks file. 
Need to determine the name of the reaction from the filename.
Eg, 
    NR_958_Ziegler-Natta Polymerization_Ziegler_1956_selected.smi
    NR_81_Bergmann-Zervas Carbobenzoxy Method_Bergmann_1932_selected.smi