コード例 #1
0
theshold = 0.6
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)
                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)
                    fp2 = tancal.fingerprint(smiles_j)
                    lig_smiles[lig_j] = smiles_j
                    lig_fp[lig_j] = fp2
                #smiles_j = spfl.scrape_pdb_for_lig_smiles(lig_j)
コード例 #2
0
    # print lig_list

    for lig in lig_list:
        #if lig in lig_dict: # if the ligand is already in the dictionary then dont looked up smile
        #   continue
        #if lig in ions: ## skip if any ion
        if lig in not_a_ligand:  ## eg. skip if any ion
            #print lig, "in", not_a_ligand
            continue
        ##if lig in cofactors:

        ##if not (lig in lig_dict) and not (lig in ions) :
        if not (
                lig in lig_dict
        ):  # if the ligand is already in the dictionary then dont looked up smile
            smiles = spfl.scrape_pdb_for_lig_smiles(lig)
            lig_dict[lig] = smiles

        entry = [pdb, lig]
        pdbtolig_filehandle.write("%s %s\n" % (pdb, lig))
        pdb_to_ligand.append(entry)

pdbtolig_filehandle.close()
pdbtouniprot_filehandle.close()
#for lig in unprot_list:

## Write out information to files
## consider creating a ProgreSQP to store this information.

unifilehandle = open('uniprotfile.txt', 'w')
for id in uniprot_dict.keys():