Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address bugs in processing flow cytometry based screens #98

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions screenpro/assays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,29 @@ def calculateFlowBasedScreen(self, low_bin, high_bin, score_level, run_name=None
run_name (str): name for the phenotype calculation run
**kwargs: additional arguments to pass to runPhenoScore
"""
if not run_name: run_name = score_level
if run_name in self.phenotypes.keys():
raise ValueError(f"Phenotype calculation run '{run_name}' already exists in self.phenoypes!")
else:
self.phenotypes[run_name] = {}
self.phenotypes[run_name]['config'] = {
'method':'ScreenPro2 - phenoscore',
'low_bin':low_bin,
'high_bin':high_bin,
'test':self.test,
'score_level':score_level,
}
self.phenotypes[run_name]['results'] = {}

# calculate phenotype scores
delta_name, delta = runPhenoScore(
self.adata, cond_ref=low_bin, cond_test=high_bin, n_reps=self.n_reps,
test=self.test, score_level=score_level,
**kwargs
)

if not run_name: run_name = score_level
# save all results into a multi-index dataframe
self.phenotypes[run_name] = pd.concat({
f'delta:{delta_name}': delta
}, axis=1)

# save phenotype name for reference
self._add_phenotype_results(f'delta:{delta_name}')

self._add_phenotype_results(run_name, f'delta:{delta_name}', delta)

def listPhenotypeScores(self, run_name='auto'):
"""
List available phenotype scores for a given run_name
Expand Down
4 changes: 4 additions & 0 deletions screenpro/phenoscore/_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
'rho':{
'up_hit':'resistance_hit',
'down_hit':'sensitivity_hit'
},
'delta':{
'up_hit':'up_hit',
'down_hit':'down_hit'
}
}

Expand Down
Loading