Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
improve runPhenoScore function
Browse files Browse the repository at this point in the history
  • Loading branch information
abearab committed Aug 26, 2023
1 parent 3b9c3fe commit 693295b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions screenpro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ def __init__(self, adata, math='log2(x+1)', test='ttest'):
self.adata = adata
self.math = math
self.test = test
self.phenotypes = None
self.phenotypes_score_level = None
self.phenotypes = {}

def __repr__(self):
descriptions = ''
for scoreLevel in self.phenotypes.keys():
scores = "', '".join(self.phenotypes[scoreLevel].columns.get_level_values(0).unique().to_list())
descriptions += f"Phenotypes in scoreLevel = '{scoreLevel}':\n scores: '{scores}'\n"
for score_level in self.phenotypes.keys():
scores = "', '".join(self.phenotypes[score_level].columns.get_level_values(0).unique().to_list())
descriptions += f"Phenotypes in score_level = '{score_level}':\n scores: '{scores}'\n"

return f'obs->samples\nvar->oligos\n\n{self.adata.__repr__()}\n\n{descriptions}'

Expand All @@ -98,8 +97,7 @@ def calculateDrugScreen(self,
)

# save all results into a multi-index dataframe
self.phenotypes = pd.concat({
self.phenotypes[score_level] = pd.concat({
f'gamma:{gamma_name}': gamma, f'tau:{tau_name}': tau, f'rho:{rho_name}': rho
}, axis=1)

self.phenotypes_score_level = score_level

0 comments on commit 693295b

Please sign in to comment.