示例#1
0
 def hide_test_getCinfonyDesc(self):
     allDescs = getCinfonyDesc.getAvailableDescs()
     print "\nN Retrieved desc: ",len(allDescs)
     self.assert_(len(allDescs) > 200)  # Actualy 220
     descs = ['cdk.BCUT', 'cdk.weight','webel.AtomCountDescriptor', 'webel.AutocorrelationDescriptorCharge', 'webel.AutocorrelationDescriptorMass',"obabel.TPSA","obabel.HBA2" , "obabel.MW","rdk.TPSA","rdk.Chi0n","rdk.MolWt"]
     resD = getCinfonyDesc.getCinfonyDescResults(self.smiData,descs)
     self.assertEqual(len(resD),len(self.smiData))
示例#2
0
    def __initListBox(self):
        ## Get available descriptors from Cinfony and show progress bar. 
        progressSteps = 3 
        progress1 = QProgressDialog("Retrieving available descriptors from Cinfony.", "Cancel", 0, progressSteps , None, Qt.Dialog )
        progress1.setWindowModality(Qt.WindowModal)
        progress1.setMinimumDuration(0)
        progress1.forceShow()
        progress1.setValue(1)
        time.sleep(0.1)
        progress1.setValue(2)
        try: 
            availableDescriptors = getCinfonyDesc.getAvailableDescs() 
        except:
            typeEx, val, traceback = sys.exc_info()
            progress1.close()
            #self.updateInfo()
            self.error("Error retrieving descriptors from Cinfony.\n")
            print typeEx
            print "\t",val
            return
        progress1.setValue(3)
        progress1.close()

        # Create a sorted list of descriptors available in Cinfony
        self.Descriptors.setInputItems(availableDescriptors)
        #toolkitsEnabled
        if getCinfonyDesc.toolkitsEnabled:
            self.info.setText("Toolkits available for retrieving descriptors: "+ str(getCinfonyDesc.toolkitsEnabled)[1:-1].replace("'",""))
        else:
            self.error("No available toolkits for retrieving descriptors!")
            self.info.setText("Cinfony returned no available scripts!")
示例#3
0
def getDescTypes(descList):
    clabDescList = []
    cinfonyDescList = []
    bbrcDesc = []
    signDesc = []
    signatureHeight = None
    cinfonyDescs = getCinfonyDesc.getAvailableDescs()
    cinfonyTags = [tk["tag"] for tk in getCinfonyDesc.toolkitsDef.values()]
    for desc in descList:
        if desc in AZOC.SMILESNAMES:
            continue
        # Cinfony
        if desc in cinfonyDescs or sum([tag in desc for tag in cinfonyTags]):
            cinfonyDescList.append(desc)
        # None signature CLab
        elif "clab" in DescMethodsAvailable and string.find(desc, "[") != 0:
            if desc == "SMILES" or desc == "ID":
                print "Warning"
                print "The model was built with SMILES or IDs!!"
            else:
                clabDescList.append(desc)
        # BBRCDesc
        elif "bbrc" in DescMethodsAvailable and desc[0] == "[" and desc[
                1] == "#" and "&" in desc:
            bbrcDesc.append(desc)
        # Signature descriptor by exclusion
        elif "sign" in DescMethodsAvailable:  # else!!
            newSignatureHeight = getSignatures.getSignatureHeight(desc)
            signDesc.append(desc)
            if newSignatureHeight > signatureHeight:
                signatureHeight = newSignatureHeight
    return cinfonyDescList, clabDescList, signatureHeight, bbrcDesc, signDesc
示例#4
0
 def test_getCinfonyDesc(self):
     allDescs = getCinfonyDesc.getAvailableDescs()
     print "\nN Retrieved desc: ",len(allDescs)
     self.assert_(len(allDescs) > 200)  # Actualy 220
     descs = ['cdk.BCUT', 'cdk.weight','webel.AtomCountDescriptor', 'webel.AutocorrelationDescriptorCharge', 'webel.AutocorrelationDescriptorMass',"obabel.TPSA","obabel.HBA2" , "obabel.MW","rdk.TPSA","rdk.Chi0n","rdk.MolWt"]
     resD = getCinfonyDesc.getCinfonyDescResults(self.smiData,descs)
     self.assertEqual(len(resD),len(self.smiData))
示例#5
0
def getDescTypes(descList):
        clabDescList = []
        cinfonyDescList = []
        bbrcDesc = []
        signDesc = []
        signatureHeight = None
        cinfonyDescs = getCinfonyDesc.getAvailableDescs()
        cinfonyTags = [tk["tag"] for tk in getCinfonyDesc.toolkitsDef.values()]
        for desc in descList:
            if desc in AZOC.SMILESNAMES:
                continue 
            # Cinfony
            if desc in cinfonyDescs or sum([tag in desc for tag in cinfonyTags]):
                cinfonyDescList.append(desc)
            # None signature CLab
            elif "clab" in DescMethodsAvailable and string.find(desc, "[") != 0:
                if desc == "SMILES" or desc == "ID":
                    print "Warning"
                    print "The model was built with SMILES or IDs!!"
                else:
                    clabDescList.append(desc)
            # BBRCDesc
            elif "bbrc" in DescMethodsAvailable and desc[0] == "[" and desc[1] == "#" and "&" in desc:
                bbrcDesc.append(desc)
            # Signature descriptor by exclusion
            elif "sign" in DescMethodsAvailable:  # else!!
                newSignatureHeight = getSignatures.getSignatureHeight(desc)
                signDesc.append(desc)
                if newSignatureHeight > signatureHeight: signatureHeight = newSignatureHeight
        return cinfonyDescList, clabDescList, signatureHeight, bbrcDesc, signDesc
def getDesc(trainDataFile):

    # Read the SAR for which to calculate descriptors
    sarData = dataUtilities.DataTable(trainDataFile) 

    # Get names of RDK descriptors
    rdkDescs = getCinfonyDesc.getAvailableDescs("rdk")
   
    # Calculate the descriptors 
    trainData = getCinfonyDesc.getCinfonyDescResults(sarData, rdkDescs)

    # Deselect the SMILES attribute
    attrList = ["SMILES"]
    trainData = dataUtilities.attributeDeselectionData(trainData, attrList)
     
    # Save the trainData set
    trainData.save("trainData.tab") 

    return trainData
示例#7
0
def getDesc(trainDataFile):

    # Read the SAR for which to calculate descriptors
    sarData = dataUtilities.DataTable(trainDataFile)

    # Get names of RDK descriptors
    rdkDescs = getCinfonyDesc.getAvailableDescs("rdk")

    # Calculate the descriptors
    trainData = getCinfonyDesc.getCinfonyDescResults(sarData, rdkDescs)

    # Deselect the SMILES attribute
    attrList = [
        attr.name for attr in trainData.domain.attributes
        if attr.varType == orange.Variable.String
    ]

    trainData = dataUtilities.attributeDeselectionData(trainData, attrList)

    # Save the trainData set
    trainData.save("trainData.tab")

    return trainData
示例#8
0
import os
from AZutilities import dataUtilities
from AZutilities import getCinfonyDesc
import Orange
import orange

#fileName = "XEN025dragonNewHeaderResp.txt"
fileName = "LiuJCIM2015dragonNewHeaderResp.txt"
path, ext = os.path.splitext(fileName)
outFileName = path + "RDKbulk" + ext

data = dataUtilities.DataTable(fileName)
descList = getCinfonyDesc.getAvailableDescs("rdkPhysChem")
newData = getCinfonyDesc.getRdkDescResult(data, descList)
#descList = getCinfonyDesc.getAvailableDescs("rdk")
#newData = getCinfonyDesc.getRdkDescResult(data, descList, radius = 3)
newData.save(outFileName)
def parseToFile(assay, data):
    descList = getCinfonyDesc.getAvailableDescs("rdkPhysChem")
    print descList
    data = getCinfonyDesc.getCinfonyDescResults(data, descList)
    data.save(assay + "AZOdesc.txt")