Esempio n. 1
0
 def test_webel(self):
     from cinfony import webel
     mol = webel.readstring("smi", "CCC")
     desc = mol.calcdesc(webel.getdescs()[5:7])
     for d in desc:
         if desc[d] != desc[d]:
             desc[d] = '?'
     expectedDesc = {'AtomCountDescriptor_nAtom': 11.0, 'AutocorrelationDescriptorCharge_ATSc5': 0.0, 'AutocorrelationDescriptorCharge_ATSc4': 0.0, 'AutocorrelationDescriptorCharge_ATSc3': 0.0, 'AutocorrelationDescriptorCharge_ATSc2': 0.0, 'AutocorrelationDescriptorCharge_ATSc1': 0.0}
     self.assertEqual(desc,expectedDesc)
Esempio n. 2
0
def getAvailableDescs(descSet = "all"):
    """
    descSet : all, rdk, rdkFP, rdkPhysChem, cdk, webel, obabel
    """
    
    #Get descs from obabel
    if "obabel" in toolkitsEnabled:
        obabelDescs = [obabelTag+desc for desc in obabel.descs]
    else:
        obabelDescs = []
    #Get descs from RDKit
    if "rdk" in toolkitsEnabled:
        rdkDescs = [rdkTag+desc for desc in rdk.descs] + [rdkTag+"FingerPrints"]
        rdkFP = [rdkTag+"FingerPrints"]
        rdkPhysChem = [rdkTag+desc for desc in rdk.descs]
    else:
        rdkDescs = [] 
    #Get cdk from CDK
    if "cdk" in toolkitsEnabled:
        cdkDescs = [cdkTag+desc for desc in cdk.descs]
    else:
        cdkDescs = []

    #Get descs from webel     
    try:
        if "webel" in toolkitsEnabled: 
            webelDescs = [webelTag+desc for desc in webel.getdescs()]
        else:
            webelDescs = []
    except:
        print "WARNING: Could not get the descriptors from webel!"
        if "webel" in toolkitsEnabled: toolkitsEnabled.remove("webel")
        webelDescs = []

    if descSet == "all":
        cinfonyDesc = obabelDescs + rdkDescs + cdkDescs + webelDescs
    elif descSet == "rdk":
        cinfonyDesc = rdkDescs 
    elif descSet == "rdkFP":
        cinfonyDesc = rdkFP
    elif descSet == "rdkPhysChem":
        cinfonyDesc = rdkPhysChem
    elif descSet == "cdk":
        cinfonyDesc = cdkDescs
    elif descSet == "webel":
        cinfonyDesc = webelDescs
    elif descSet == "obabel":
        cinfonyDesc = obabelDescs
    else:
        print descSet+" Is not an allowed descriptor set specification"
        cinfonyDesc = None

    return cinfonyDesc