def main():
   SmilesString1 = sys.argv[1]
   SmilesString2 = sys.argv[2]
   print SmilesString1, SmilesString2

   mw1 = float(tca.molecularMass(SmilesString1))
   mw2 = float(tca.molecularMass(SmilesString2))

   print mw1, mw2, math.fabs(mw1-mw2)

   

   formula1 = tca.MolecularFormula(SmilesString1)
   formula2 = tca.MolecularFormula(SmilesString2)
   val = tca.compareFormula(formula1,formula2)
        if (smiles1 == ''):
            continue
        lig_smiles[lig1] = smiles1
        fileout2.write(smiles1 + ' ' + lig1 + '\n')

    if (lig1 in lig_formula):
        formula1 = lig_formula[lig1]
    else:
        formula1 = tancal.MolecularFormula(smiles1)
        lig_formula[lig1] = formula1
        fileout3.write(formula1 + ' ' + lig1 + '\n')

    if (lig1 in lig_mw):
        mw1 = lig_mw[lig1]
    else:
        mw1 = float(tancal.molecularMass(smiles1))
        lig_mw[lig1] = mw1

    # for ligand2
    if (lig2 in lig_smiles):
        smiles2 = lig_smiles[lig2]
    else:
        smiles2 = spfl.scrape_pdb_for_lig_smiles(lig2)
        if (smiles2 == ''):
            continue
        lig_smiles[lig2] = smiles2
        #fileout2.write(lig2+' '+smiles2+'\n')
        fileout2.write(smiles2 + ' ' + lig2 + '\n')

    if (lig2 in lig_formula):
        formula2 = lig_formula[lig2]
Exemplo n.º 3
0
fileout = open("uniprot_lig_tanamoto.txt", 'w')
for uniprot in uniprot_to_ligands_dict.keys():
    fileout = open("uniprot_lig_tanamoto_flush.txt", 'a')
    if (len(uniprot_to_ligands_dict[uniprot]) > 6):
        liglist = uniprot_to_ligands_dict[uniprot]
        print uniprot, uniprot_to_ligands_dict[uniprot]
        # put to forloops, both over the ligands (do uppper diagonal), here and cal tanamotos
        for i in range(len(liglist)):
            lig_i = liglist[i]
            if (lig_i in lig_smiles):
                smiles_i = lig_smiles[lig_i]
                fp1 = lig_fp[lig_i]
            else:
                smiles_i = spfl.scrape_pdb_for_lig_smiles(lig_i)
                M = tancal.molecularMass(smiles_i)
                if float(M) > max_MM:
                    print lig_i, M
                    continue
                #H = tancal.heavyAtoms(smiles_j)
                fp1 = tancal.fingerprint(smiles_i)
                lig_smiles[lig_i] = smiles_i
                lig_fp[lig_i] = fp1

            for j in range(i + 1, len(liglist)):
                lig_j = liglist[j]
                if (lig_j in lig_smiles):
                    smiles_j = lig_smiles[lig_j]
                    fp2 = lig_fp[lig_j]
                else:
                    smiles_j = spfl.scrape_pdb_for_lig_smiles(lig_j)
Exemplo n.º 4
0
def main():
    SmilesString = sys.argv[1]
    print SmilesString
    mw = tca.molecularMass(SmilesString)
    print mw