Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -51,7 +51,7 @@ from deepscreen.predict import predict
|
|
51 |
sys.path.append(os.path.join(RDConfig.RDContribDir, 'SA_Score'))
|
52 |
import sascorer
|
53 |
|
54 |
-
DATASET_MAX_LEN =
|
55 |
SERVER_DATA_DIR = os.getenv('DATA') # '/data'
|
56 |
DB_EXPIRY = timedelta(hours=48).total_seconds()
|
57 |
|
@@ -212,7 +212,9 @@ TARGET_LIBRARY_MAP = {
|
|
212 |
|
213 |
DRUG_LIBRARY_MAP = {
|
214 |
'DrugBank (Human)': 'drugbank_compounds.csv',
|
215 |
-
'Drug Repurposing Hub': 'drug_repurposing_hub.csv'
|
|
|
|
|
216 |
}
|
217 |
|
218 |
COLUMN_ALIASES = {
|
@@ -730,11 +732,12 @@ def submit_predict(predict_filepath, task, preset, target_family, opts, state):
|
|
730 |
|
731 |
if 'Target Family' not in orig_df.columns:
|
732 |
orig_df['Target Family'] = None
|
733 |
-
orig_df.
|
734 |
-
orig_df[
|
735 |
-
|
736 |
-
orig_df[
|
737 |
-
|
|
|
738 |
|
739 |
detect_family.cache_clear()
|
740 |
|
@@ -835,7 +838,7 @@ def submit_predict(predict_filepath, task, preset, target_family, opts, state):
|
|
835 |
max_tanimoto_similarity,
|
836 |
seen_smiles=tuple(get_seen_smiles(family=family, task=task_value))
|
837 |
)
|
838 |
-
|
839 |
if "Include Max. Sequence Identity" in opts:
|
840 |
for family in prediction_df['Target Family'].unique():
|
841 |
prediction_df.loc[
|
@@ -844,7 +847,7 @@ def submit_predict(predict_filepath, task, preset, target_family, opts, state):
|
|
844 |
max_sequence_identity,
|
845 |
seen_fastas=tuple(get_seen_fastas(family=family, task=task_value))
|
846 |
)
|
847 |
-
|
848 |
prediction_df.drop(['N'], axis=1).to_csv(predictions_file, index=False, na_rep='')
|
849 |
status = "COMPLETED"
|
850 |
|
@@ -2335,10 +2338,10 @@ QALAHAYFAQYHDPDDEPVADPYDQSFESRDLLIDEWKSLTYDEVISFVPPPLDQEEMES
|
|
2335 |
)
|
2336 |
|
2337 |
report_clr_btn.click(
|
2338 |
-
lambda: [[]] * 3 + [None] *
|
2339 |
[gr.Button(interactive=False)] * 3 +
|
2340 |
[gr.File(visible=False, value=None)] * 2 +
|
2341 |
-
[gr.Dropdown(visible=False, value=None), ''],
|
2342 |
outputs=[
|
2343 |
scores, filters, html_opts,
|
2344 |
file_for_report, raw_df, report_df,
|
|
|
51 |
sys.path.append(os.path.join(RDConfig.RDContribDir, 'SA_Score'))
|
52 |
import sascorer
|
53 |
|
54 |
+
DATASET_MAX_LEN = 10_240
|
55 |
SERVER_DATA_DIR = os.getenv('DATA') # '/data'
|
56 |
DB_EXPIRY = timedelta(hours=48).total_seconds()
|
57 |
|
|
|
212 |
|
213 |
DRUG_LIBRARY_MAP = {
|
214 |
'DrugBank (Human)': 'drugbank_compounds.csv',
|
215 |
+
'Drug Repurposing Hub': 'drug_repurposing_hub.csv',
|
216 |
+
'Enamine Discovery Diversity Set (DDS-10)': 'Enamine_Discovery_Diversity_Set_10_10240cmpds_20240130.csv',
|
217 |
+
'Enamine Phenotypic Screening Library (PSL-5760)': 'Enamine_Phenotypic_Screening_Library_plated_5760cmds_2020_07_20.csv'
|
218 |
}
|
219 |
|
220 |
COLUMN_ALIASES = {
|
|
|
732 |
|
733 |
if 'Target Family' not in orig_df.columns:
|
734 |
orig_df['Target Family'] = None
|
735 |
+
if orig_df['Target Family'].isna().any():
|
736 |
+
orig_df.loc[
|
737 |
+
orig_df['Target Family'].isna(), 'Target Family'
|
738 |
+
] = orig_df.loc[
|
739 |
+
orig_df['Target Family'].isna(), 'X2'
|
740 |
+
].parallel_apply(detect_family)
|
741 |
|
742 |
detect_family.cache_clear()
|
743 |
|
|
|
838 |
max_tanimoto_similarity,
|
839 |
seen_smiles=tuple(get_seen_smiles(family=family, task=task_value))
|
840 |
)
|
841 |
+
max_tanimoto_similarity.cache_clear()
|
842 |
if "Include Max. Sequence Identity" in opts:
|
843 |
for family in prediction_df['Target Family'].unique():
|
844 |
prediction_df.loc[
|
|
|
847 |
max_sequence_identity,
|
848 |
seen_fastas=tuple(get_seen_fastas(family=family, task=task_value))
|
849 |
)
|
850 |
+
max_sequence_identity.cache_clear()
|
851 |
prediction_df.drop(['N'], axis=1).to_csv(predictions_file, index=False, na_rep='')
|
852 |
status = "COMPLETED"
|
853 |
|
|
|
2338 |
)
|
2339 |
|
2340 |
report_clr_btn.click(
|
2341 |
+
lambda: [[]] * 3 + [None] * 3 +
|
2342 |
[gr.Button(interactive=False)] * 3 +
|
2343 |
[gr.File(visible=False, value=None)] * 2 +
|
2344 |
+
[gr.Dropdown(visible=False, value=None), gr.HTML(value='')],
|
2345 |
outputs=[
|
2346 |
scores, filters, html_opts,
|
2347 |
file_for_report, raw_df, report_df,
|