Advertisement
santimirandarp

Looking for a better way of writing this code

May 3rd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. def calculate_scores(population):
  2.   scores = []
  3.   for gene in population:
  4.     mol=prepare_molecule(gene)
  5.     Chem.SDWriter('mol_%i.sdf'%(population.index(gene))).write(mol) #add hs, optimize mol, remove hs, write all to sdf file
  6.     shell('obabel mol_%i.sdf -O ligand_%i.pdbqt'%(population.index(gene),population.index(gene)),shell=False)  
  7.     score = sc.smina_score('ligand_%i.pdbqt'%(population.index(gene)))
  8.     print(score)
  9.     scores.append(max(float(score),0.0))
  10.  
  11.   return scores
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement