Skip to content

Commit 02cd10d

Browse files
authored
Merge pull request #98 from isabelleliuu/master
2 parents ea93151 + adfdb34 commit 02cd10d

3 files changed

Lines changed: 21 additions & 10 deletions

File tree

screenpro/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
from .dashboard import DrugScreenDashboard
3232

3333

34-
__version__ = "0.4.15"
34+
__version__ = "0.4.16"
3535
__author__ = "Abe Arab"
3636
__email__ = 'abea@arcinstitute.org' # "abarbiology@gmail.com"

screenpro/assays/__init__.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,22 +286,29 @@ def calculateFlowBasedScreen(self, low_bin, high_bin, score_level, run_name=None
286286
run_name (str): name for the phenotype calculation run
287287
**kwargs: additional arguments to pass to runPhenoScore
288288
"""
289+
if not run_name: run_name = score_level
290+
if run_name in self.phenotypes.keys():
291+
raise ValueError(f"Phenotype calculation run '{run_name}' already exists in self.phenoypes!")
292+
else:
293+
self.phenotypes[run_name] = {}
294+
self.phenotypes[run_name]['config'] = {
295+
'method':'ScreenPro2 - phenoscore',
296+
'low_bin':low_bin,
297+
'high_bin':high_bin,
298+
'test':self.test,
299+
'score_level':score_level,
300+
}
301+
self.phenotypes[run_name]['results'] = {}
302+
289303
# calculate phenotype scores
290304
delta_name, delta = runPhenoScore(
291305
self.adata, cond_ref=low_bin, cond_test=high_bin, n_reps=self.n_reps,
292306
test=self.test, score_level=score_level,
293307
**kwargs
294308
)
295309

296-
if not run_name: run_name = score_level
297-
# save all results into a multi-index dataframe
298-
self.phenotypes[run_name] = pd.concat({
299-
f'delta:{delta_name}': delta
300-
}, axis=1)
301-
302-
# save phenotype name for reference
303-
self._add_phenotype_results(f'delta:{delta_name}')
304-
310+
self._add_phenotype_results(run_name, f'delta:{delta_name}', delta)
311+
305312
def listPhenotypeScores(self, run_name='auto'):
306313
"""
307314
List available phenotype scores for a given run_name

screenpro/phenoscore/_annotate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
'rho':{
1818
'up_hit':'resistance_hit',
1919
'down_hit':'sensitivity_hit'
20+
},
21+
'delta':{
22+
'up_hit':'up_hit',
23+
'down_hit':'down_hit'
2024
}
2125
}
2226

0 commit comments

Comments
 (0)