Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: "Install miniconda"
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
auto-update-conda: true
mamba-version: "*"
python-version: ${{ matrix.python-version }}
channels: conda-forge,bioconda
environment-file: environment.yml
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: "Install miniconda"
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
auto-update-conda: true
mamba-version: "*"
python-version: ${{ matrix.python-version }}
channels: conda-forge,bioconda
environment-file: environment.yml
Expand Down
34 changes: 16 additions & 18 deletions screenpro/dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,36 @@ def _get_html(self, p):

class DrugScreenDashboard(DataDashboard):

def __init__(self, screen, treated, untreated, t0='T0', threshold=3, ctrl_label='negative_control',run_name='auto'):
def __init__(
self, screen, treated, untreated,
t0='T0', threshold=3, ctrl_label='negative_control',
run_name='auto',
score_col='score', pvalue_col='pvalue'
):
self.screen = screen
self.threshold = threshold
self.ctrl_label = ctrl_label
self.run_name = run_name
self.gamma_score_name = f'gamma:{untreated}_vs_{t0}'
self.rho_score_name = f'rho:{treated}_vs_{untreated}'
self.df = self._prep_data(screen, score_col=score_col, pvalue_col=pvalue_col)
self.plots = {}
super().__init__()

def _prep_data(self,screen, score_col='score', pvalue_col='pvalue'):

gamma = screen.getPhenotypeScores(
phenotype_name=self.gamma_score_name,
run_name=self.run_name,
score_name=self.gamma_score_name,
threshold=self.threshold,
ctrl_label=self.ctrl_label,
score_col=score_col,
pvalue_col=pvalue_col
)

rho = screen.getPhenotypeScores(
phenotype_name=self.rho_score_name,
run_name=self.run_name,
score_name=self.rho_score_name,
threshold=self.threshold,
ctrl_label=self.ctrl_label,
score_col=score_col,
Expand All @@ -71,17 +77,17 @@ def _prep_data(self,screen, score_col='score', pvalue_col='pvalue'):
df = pd.DataFrame({
'target': rho['target'],
'rho_score': rho['score'],
'rho_pvalue': rho['pvalue'],
'rho_pvalue': rho[pvalue_col],
'rho_label': rho['label'],
'-log10(rho_pvalue)': np.log10(rho['pvalue']) * -1,
'-log10(rho_pvalue)': np.log10(rho[pvalue_col]) * -1,
'gamma_score': gamma.loc[rho.index,'score'],
'gamma_pvalue': gamma.loc[rho.index,'pvalue'],
'gamma_pvalue': gamma.loc[rho.index,pvalue_col],
'gamma_label': gamma.loc[rho.index,'label'],
'-log10(gamma_pvalue)': np.log10(gamma.loc[rho.index,'pvalue']) * -1,
'-log10(gamma_pvalue)': np.log10(gamma.loc[rho.index,pvalue_col]) * -1,
})

return df

def _plot_scatter(
self,
x_source,y_source,
Expand All @@ -93,11 +99,9 @@ def _plot_scatter(
dot_size=1,
width=500, height=400,
toolbar_location='below',
legend_loc="top_left"
legend_loc="top_left",
):

df = self._prep_data(self.screen)

df = self.df.copy()
if y_max == 'auto': y_max = df[y_source].max() * 1.2
if x_max == 'auto': x_max = df[x_source].max() * 1.2
if y_min == 'auto': y_min = df[y_source].min() * 1.2
Expand Down Expand Up @@ -216,15 +220,13 @@ def RhoVolcanoPlot(
hit_label_col='rho_label',
x_min=-2.5, x_max=2.5, y_min=0, y_max='auto',
return_html=True,
**kwargs
):
p = self._plot_scatter(
x_source, y_source,
xaxis_label, yaxis_label,
up_hit, down_hit,
hit_label_col,
x_min, x_max, y_min, y_max,
**kwargs
)

if return_html:
Expand All @@ -243,15 +245,13 @@ def GammaVolcanoPlot(
hit_label_col='gamma_label',
x_min=-2.5, x_max=2.5, y_min=0, y_max='auto',
return_html=True,
**kwargs
):
p = self._plot_scatter(
x_source, y_source,
xaxis_label, yaxis_label,
up_hit, down_hit,
hit_label_col,
x_min, x_max, y_min, y_max,
**kwargs
)

if return_html:
Expand All @@ -270,15 +270,13 @@ def RhoGammaScatter(
hit_label_col='rho_label',
return_html=True,
x_min=-2.5, x_max=2.5, y_min=-2.5, y_max=2.5,
**kwargs
):
p = self._plot_scatter(
x_source, y_source,
xaxis_label, yaxis_label,
up_hit, down_hit,
hit_label_col,
x_min, x_max, y_min, y_max,
**kwargs
)

if return_html:
Expand Down
Loading