Skip to content

Commit

Permalink
updaetd drug descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
sgosline committed Jun 21, 2024
1 parent 2443aa6 commit c8194e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion build/broad_sanger/build_drugs.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/opt/venv/bin/python 03a-nci60Drugs.py
Rscript 03-createDrugFile.R CTRPv2,GDSC,gCSI,PRISM,CCLE,FIMM
/opt/venv/bin/python build_drug_desc.py --drugtable /tmp/broad_sanger_drugs.tsv --desctable /tmp/broad_sanger_drug_desciptors.tsv.gz
yes
/opt/venv/bin/python build_drug_desc.py --drugtable /tmp/broad_sanger_drugs.tsv --desctable /tmp/broad_sanger_drug_descriptors.tsv.gz
12 changes: 10 additions & 2 deletions build/utils/build_drug_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,20 @@ def smiles_to_mordred(smiles):
'''
print('Computing mordred descriptors for '+str(len(smiles))+' SMILES')


mols = [Chem.MolFromSmiles(s) for s in smiles]
smols = []
ssmil = []
for i in range(len(mols)):
m = moles[i]
if m is not None:
smols.append(m)
ssmil.append(smiles[i])

calc = Calculator(descriptors, ignore_3D=True)
dd = calc.pandas( mols, nmols=None, quiet=False, ipynb=False )
dd = calc.pandas( smols, nmols=None, quiet=False, ipynb=False )
values = dd.columns
dd['smile'] = smiles
dd['smile'] = ssmil
##reformat here
longtab = pd.melt(dd,id_vars='smile',value_vars=values)
longtab = longtab.rename({'variable':'structural_descriptor','value':'descriptor_value'},axis=1)
Expand Down

0 comments on commit c8194e8

Please sign in to comment.