saicharan2804 commited on
Commit
0e78acb
·
1 Parent(s): e8da7e0

Fixed error

Browse files
Files changed (1) hide show
  1. molgenevalmetric.py +18 -18
molgenevalmetric.py CHANGED
@@ -130,27 +130,27 @@ def novelty(gen, train, n_jobs=1):
130
  return len(gen_smiles_set - train_set) / len(gen_smiles_set)
131
 
132
 
133
- def SAscore(gen):
134
- """
135
- Calculate the average Synthetic Accessibility Score (SAscore) for a list of molecules represented by their SMILES strings.
136
 
137
- Parameters:
138
- - smiles_list (list of str): A list containing the SMILES representations of the molecules.
139
 
140
- Returns:
141
- - float: The average Synthetic Accessibility Score for the valid molecules in the list. Returns None if no valid molecules are found.
142
- """
143
- scores = []
144
- for smiles in gen:
145
- mol = Chem.MolFromSmiles(smiles)
146
- if mol: # Ensures the molecule could be parsed from the SMILES string
147
- score = sascorer.calculateScore(mol)
148
- scores.append(score)
149
 
150
- if scores: # Checks if there are any scores calculated
151
- return np.mean(scores)
152
- else:
153
- return None
154
 
155
 
156
 
 
130
  return len(gen_smiles_set - train_set) / len(gen_smiles_set)
131
 
132
 
133
+ # def SAscore(gen):
134
+ # """
135
+ # Calculate the average Synthetic Accessibility Score (SAscore) for a list of molecules represented by their SMILES strings.
136
 
137
+ # Parameters:
138
+ # - smiles_list (list of str): A list containing the SMILES representations of the molecules.
139
 
140
+ # Returns:
141
+ # - float: The average Synthetic Accessibility Score for the valid molecules in the list. Returns None if no valid molecules are found.
142
+ # """
143
+ # scores = []
144
+ # for smiles in gen:
145
+ # mol = Chem.MolFromSmiles(smiles)
146
+ # if mol: # Ensures the molecule could be parsed from the SMILES string
147
+ # score = sascorer.calculateScore(mol)
148
+ # scores.append(score)
149
 
150
+ # if scores: # Checks if there are any scores calculated
151
+ # return np.mean(scores)
152
+ # else:
153
+ # return None
154
 
155
 
156