@@ -86,12 +86,12 @@ def retrieve_drug_info(compound, ignore_chems, isname=True):
8686
8787 if isname :
8888 urls = {
89- "properties" : f"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/{ compound } /property/CanonicalSMILES ,InChIKey,MolecularFormula,MolecularWeight/JSON" ,
89+ "properties" : f"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/{ compound } /property/SMILES ,InChIKey,MolecularFormula,MolecularWeight/JSON" ,
9090 "synonyms" : f"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/{ compound } /synonyms/JSON"
9191 }
9292 else :
9393 urls = {
94- "properties" : f"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/{ compound } /property/CanonicalSMILES ,InChIKey,MolecularFormula,MolecularWeight/JSON" ,
94+ "properties" : f"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/{ compound } /property/SMILES ,InChIKey,MolecularFormula,MolecularWeight/JSON" ,
9595 "synonyms" : f"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/{ compound } /synonyms/JSON"
9696 }
9797
@@ -131,13 +131,13 @@ def retrieve_drug_info(compound, ignore_chems, isname=True):
131131 existing_synonyms .add (synonym_lower )
132132
133133 # Check for structure
134- if properties ['CanonicalSMILES ' ] in existing_structures .keys ():
134+ if properties ['SMILES ' ] in existing_structures .keys ():
135135 print (f'Found structure for { compound } ' )
136- SMI_assignment = existing_structures [properties ['CanonicalSMILES ' ]]
136+ SMI_assignment = existing_structures [properties ['SMILES ' ]]
137137 else :
138138 improve_drug_id += 1
139139 SMI_assignment = f"SMI_{ improve_drug_id } "
140- existing_structures [properties ['CanonicalSMILES ' ]] = SMI_assignment
140+ existing_structures [properties ['SMILES ' ]] = SMI_assignment
141141
142142 #print(new_syns)
143143 data_for_tsv = [{
@@ -259,7 +259,7 @@ def update_dataframe_and_write_tsv(unique_names, output_filename="drugs.tsv", ig
259259 f .write ("improve_drug_id\t chem_name\t pubchem_id\t canSMILES\t InChIKey\t formula\t weight\n " )
260260 for entry in data :
261261 f .write (f"{ entry ['improve_drug_id' ]} \t { entry ['name' ]} \t { entry .get ('CID' , '' )} \t "
262- f"{ entry ['CanonicalSMILES ' ]} \t { entry ['InChIKey' ]} \t "
262+ f"{ entry ['SMILES ' ]} \t { entry ['InChIKey' ]} \t "
263263 f"{ entry ['MolecularFormula' ]} \t { entry ['MolecularWeight' ]} \n " )
264264
265265 with open (ignore_chems , "a" ) as ig_f :
0 commit comments