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

Enable multicova #347

Open
wants to merge 195 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
33545c5
readd multicova analysis
mschwoer Oct 8, 2024
1b2ad95
make _check_loader static
mschwoer Oct 8, 2024
34a9672
remove unused StatisticUtils class
mschwoer Oct 8, 2024
aacf6b8
add a TODO
mschwoer Oct 8, 2024
5631982
fix tests
mschwoer Oct 8, 2024
02d4c75
fix detect-secrets hook and add instructions to Readme
mschwoer Oct 8, 2024
dfa51ed
usafe auto-fixes for rule B
mschwoer Oct 10, 2024
7dabb77
manual fixes for rule B
mschwoer Oct 10, 2024
ebee7cf
auto fixes for rule UP
mschwoer Oct 10, 2024
b411229
auto fixes for rule F
mschwoer Oct 10, 2024
d0de8a9
auto fixes for rule F
mschwoer Oct 10, 2024
ed26e48
manual fixes for rule F
mschwoer Oct 18, 2024
074150c
remove automatic unsafe fixes
mschwoer Oct 18, 2024
072e38f
fix tests
mschwoer Oct 18, 2024
5c991d4
auto fixes for rule E
mschwoer Oct 18, 2024
8d618cc
manual fixes for rule E
mschwoer Oct 18, 2024
190496d
remove nono-breaking spaces
mschwoer Oct 18, 2024
77dccce
get rif of load_options
mschwoer Oct 18, 2024
b423a72
remove PLOTTING_OPTIONS and STATISTIC_OPTIONS from session state
mschwoer Oct 18, 2024
6a9e59a
add comment
mschwoer Oct 18, 2024
bec56ac
reduce code duplication in analysis submitting
mschwoer Oct 18, 2024
8d45d50
simplify analysis page
mschwoer Oct 18, 2024
106588e
simplify results page
mschwoer Oct 18, 2024
b564d5c
simplify results page
mschwoer Oct 18, 2024
f029596
allow to remove results
mschwoer Oct 18, 2024
57a8b83
simplify
mschwoer Oct 18, 2024
03ccb92
make do_analysis return whole object
mschwoer Oct 21, 2024
ad9f175
simplify LLM page
mschwoer Oct 21, 2024
488c7ac
clean up session state
mschwoer Oct 21, 2024
92b9040
make API key messages nicer
mschwoer Oct 21, 2024
d51d82b
remove unused send_message_save_thread and wait_for_run_completion, t…
mschwoer Oct 21, 2024
7288aef
remove unused switch_backend
mschwoer Oct 21, 2024
4175a52
move tools selection to LLMIntegration
mschwoer Oct 21, 2024
72f11e1
move session state handling to LLM page
mschwoer Oct 21, 2024
be04ded
introduce get_print_view
mschwoer Oct 21, 2024
37ede9c
further clean session state
mschwoer Oct 22, 2024
5fe72f7
fix ollama
mschwoer Oct 22, 2024
9cda0ae
make chat display more versatile
mschwoer Oct 22, 2024
c4ed533
fix api key handling
mschwoer Oct 22, 2024
1c3fc86
remove unused get_interpretation_options
mschwoer Oct 22, 2024
9db90d4
decouple get_gene_to_prot_id_mapping from session state
mschwoer Oct 22, 2024
33c5cf5
move mapping of gene name to execute_function
mschwoer Oct 22, 2024
ba65923
remove GENE_TO_PROT_ID from session state
mschwoer Oct 22, 2024
4d05375
renaming
mschwoer Oct 22, 2024
3cc37bf
renaming
mschwoer Oct 22, 2024
b7f02a7
adapt IntensityPlot.py
mschwoer Oct 22, 2024
9d0903e
renaming
mschwoer Oct 22, 2024
3bd1e86
fix perform_dimensionality_reduction
mschwoer Oct 22, 2024
79c5e5d
reorganize llm code
mschwoer Oct 22, 2024
79bcbf7
reorganize llm code
mschwoer Oct 22, 2024
5efb020
add system message to LLM integration constructor
mschwoer Oct 22, 2024
bcbc860
make private things private in llm_integration.py
mschwoer Oct 22, 2024
2207f9f
move prompts to a dedicated module
mschwoer Oct 22, 2024
ceaa3e4
move a helper to llm
mschwoer Oct 22, 2024
e8b5d4d
move get_tool_call_message to prompts
mschwoer Oct 22, 2024
74a7369
simplify
mschwoer Oct 22, 2024
29fbee3
introduce _append_message
mschwoer Oct 22, 2024
de5a07a
truncate only internal messages, change truncation logic
mschwoer Oct 22, 2024
7f4d674
add option to display all messages
mschwoer Oct 22, 2024
3f58b57
minor fixes
mschwoer Oct 22, 2024
6e4602d
add button for LLM analysis
mschwoer Oct 22, 2024
1b5c3dc
add some eye candy
mschwoer Oct 22, 2024
a9b985a
add some eye candy
mschwoer Oct 22, 2024
0473d03
add "test api" functionality
mschwoer Oct 23, 2024
e10db38
allow multiple models in parallel
mschwoer Oct 23, 2024
2785ae2
add support for ollama 8b for testing
mschwoer Oct 23, 2024
2ae765e
adapt README.md
mschwoer Oct 23, 2024
2306929
fix import
mschwoer Oct 23, 2024
559ce85
make link between LLM function definitions and actual definitions mor…
mschwoer Oct 23, 2024
500c60e
use generic perform_dimensionality_reduction
mschwoer Oct 23, 2024
14baaa5
add tests for assistant functions
mschwoer Oct 23, 2024
278a314
add tests for utils functions
mschwoer Oct 23, 2024
457f7b1
add tests for llm_helper and refactor
mschwoer Oct 23, 2024
4f3f919
first bunch of llm_integration unit tests
mschwoer Oct 23, 2024
48b8dd1
next bunch of llm_integration unit tests and refactoring
mschwoer Oct 23, 2024
ced836d
next bunch of llm_integration unit tests
mschwoer Oct 23, 2024
3979e07
last bunch of llm_integration unit tests
mschwoer Oct 23, 2024
396a2e0
simplify tests
mschwoer Oct 23, 2024
548ae85
introduce _chat_completion_create
mschwoer Oct 23, 2024
d5e9d84
fix imports
mschwoer Oct 23, 2024
721245f
fix some functionality
mschwoer Oct 23, 2024
1386b24
rename api_type -> model_name
mschwoer Oct 23, 2024
bc56430
preserve selected model in selectbox
mschwoer Oct 23, 2024
e8ff6c2
make connection test more reliable
mschwoer Oct 23, 2024
2e04da8
add option to reset LLM analysis
mschwoer Oct 23, 2024
4d1670c
fix tests
mschwoer Oct 24, 2024
535d973
remove duplication in get_colored_labels_df
mschwoer Oct 24, 2024
302b5bd
remove duplication of _calculate_foldchange
mschwoer Oct 24, 2024
be3ee71
remove duplication of _ttest
mschwoer Oct 24, 2024
6546012
remove cached ttest functions
mschwoer Oct 24, 2024
1f33306
reduce code duplication in _draw_fdr_line
mschwoer Oct 24, 2024
191d9c7
reduce code duplication around _add_metadata_column
mschwoer Oct 24, 2024
075f7fa
reduce code duplication around _add_metadata_column
mschwoer Oct 24, 2024
0ddbccc
fix tests
mschwoer Oct 24, 2024
7a5e00a
fix tests
mschwoer Oct 24, 2024
2da982b
move calculate_foldchange to StatisticUtils
mschwoer Oct 24, 2024
adc02c7
reduce duplication around _sam()
mschwoer Oct 24, 2024
625f670
get rid of gui_volcano_plot_differential_expression_analysis
mschwoer Oct 24, 2024
db709ba
inline some methods
mschwoer Oct 24, 2024
7792b03
make _perform_differential_expression_analysis return explicitly
mschwoer Oct 24, 2024
d4bb55f
get rid of get_colored_labels_df
mschwoer Oct 24, 2024
33709d2
refactor volcano call
mschwoer Oct 24, 2024
bd959a7
make intensity plot understand gene names
mschwoer Oct 24, 2024
8bcc88b
simplify LLM page
mschwoer Oct 24, 2024
0e81b35
simplify LLM integration
mschwoer Oct 24, 2024
f7df251
fix tests
mschwoer Oct 24, 2024
fcebd7c
break the API of plot_intensity more transparently
mschwoer Oct 25, 2024
230857d
fix LLM page
mschwoer Oct 25, 2024
e887007
use a fixed index_column
mschwoer Oct 25, 2024
543201c
introduce DataHarmonizer
mschwoer Oct 25, 2024
2f65a45
refactor DataHarmonizer
mschwoer Oct 28, 2024
48c8f7e
fix tests
mschwoer Oct 28, 2024
2de39eb
add gene_names to data harmonization
mschwoer Oct 28, 2024
a4ddcd3
rename gene_names column in loaders
mschwoer Oct 28, 2024
3b36755
add some TODO and small refactorings
mschwoer Oct 28, 2024
9de29fe
fix tests
mschwoer Oct 28, 2024
48ddc78
fix tests
mschwoer Oct 28, 2024
31a5e05
introduce harmonized column name for 'sample'
mschwoer Oct 28, 2024
095d2de
introduce harmonizing fpr column name for 'sample'
mschwoer Oct 28, 2024
f04a6f7
remove loader from session state
mschwoer Oct 28, 2024
0240b3b
fix a frontend bug
mschwoer Oct 28, 2024
918295d
fix imports
mschwoer Oct 28, 2024
0fb59eb
remove metadata_columns from session state
mschwoer Oct 28, 2024
12976d1
fix tests
mschwoer Oct 28, 2024
908daa6
refactor harmonizing of metadata
mschwoer Oct 28, 2024
c0c68b9
fix multicova
mschwoer Oct 28, 2024
e9ff5d8
add checks to harmonizer
mschwoer Oct 28, 2024
7c79dea
fix harmonizer
mschwoer Oct 28, 2024
6f8fc80
simplify harmonizer
mschwoer Oct 28, 2024
84718ca
fix SpectronautLoader.py
mschwoer Oct 28, 2024
a79c2fe
fix and add TODO
mschwoer Oct 29, 2024
4fb0342
simplify Preprocessing page
mschwoer Oct 29, 2024
0a1dfc0
use sample col also in frontend
mschwoer Oct 30, 2024
691d4ed
show analysis result next to parameter selection
mschwoer Oct 30, 2024
8d6d69c
add Analysis class and refactor volcano
mschwoer Oct 30, 2024
61d4f78
remove Entrez.email
mschwoer Oct 30, 2024
2a5dd61
remove Volcano Options
mschwoer Oct 30, 2024
d9e83d4
add some TODOs
mschwoer Oct 30, 2024
3edd671
remove biopython dependency
mschwoer Oct 30, 2024
9745b0a
refactor show_widget
mschwoer Oct 30, 2024
943e11c
fix widget logic
mschwoer Oct 30, 2024
f8bb1dd
remove accidental commit
mschwoer Oct 30, 2024
f77a0a2
refactor dim reduction analysis
mschwoer Oct 30, 2024
7c85c01
add Plotting options class
mschwoer Oct 30, 2024
ba8c7bd
remove st_tsne_options
mschwoer Oct 30, 2024
24a8f3f
improve get_all_values
mschwoer Oct 30, 2024
4cf41f8
fix TSNE
mschwoer Oct 30, 2024
e37a877
move method_dict
mschwoer Oct 30, 2024
1766107
move method_dict
mschwoer Oct 30, 2024
d57a90d
fix frontend
mschwoer Oct 30, 2024
6d3c786
refactor intensityplot and sampledistributionplot analysis
mschwoer Oct 30, 2024
d238dd6
add clustermap and NaN-check
mschwoer Oct 30, 2024
d8a7592
remove get_plotting_options
mschwoer Oct 30, 2024
7e334f4
refactor diff expression analysis
mschwoer Oct 30, 2024
049fc3b
refactor tukey test analysis
mschwoer Oct 30, 2024
591adde
simplify
mschwoer Oct 30, 2024
99d7644
refactor ancova and anova analysis
mschwoer Oct 30, 2024
06bbc89
refactor ancova and anova analysis
mschwoer Oct 30, 2024
74b05b3
simplify and remove now obsolete code
mschwoer Oct 30, 2024
c87de99
move ConstantsClass and make it more widely used
mschwoer Oct 30, 2024
b9acd0b
some renamings and fixes
mschwoer Oct 30, 2024
2b2ef2e
bring back dendrogram
mschwoer Oct 30, 2024
8080336
show parameters in plot page & download
mschwoer Oct 30, 2024
fdad453
allow to save & download also statistical analysis
mschwoer Oct 30, 2024
6e5aa4a
rename PLOT_LIST
mschwoer Oct 30, 2024
a3736f2
reduce code duplication
mschwoer Oct 30, 2024
7554fd9
refactoring
mschwoer Oct 30, 2024
22a152a
refactoring
mschwoer Oct 30, 2024
d478b95
refactoring
mschwoer Oct 30, 2024
685a363
refactoring
mschwoer Oct 30, 2024
3f96623
fix csv button
mschwoer Oct 30, 2024
d1f8acd
more eye candy
mschwoer Oct 30, 2024
2ffb7f5
refactor to make csv download reusable
mschwoer Oct 30, 2024
e85187b
more eye candy
mschwoer Oct 30, 2024
5552546
more eye candy
mschwoer Oct 30, 2024
0c7637b
use toasts
mschwoer Oct 31, 2024
2202a24
polish preprocessing page
mschwoer Oct 31, 2024
55ebeaf
add type hints
mschwoer Oct 31, 2024
3b9783c
make all group comparison widgets always show
mschwoer Oct 31, 2024
22cefd7
add comment
mschwoer Oct 31, 2024
1e651d3
enable ignoring columns by name and get rid of special treatment of e…
mschwoer Oct 31, 2024
1cf39aa
make all pages wide
mschwoer Oct 31, 2024
cde4a32
prevent multiple subsequent runs of preprocessing
mschwoer Oct 31, 2024
5e938dc
rename sample_data -> example_data
mschwoer Oct 31, 2024
216bb33
clean up session StateKeys
mschwoer Oct 31, 2024
9cc98c0
renaming
mschwoer Oct 31, 2024
4c8df4a
inline the preprocessing fragment again
mschwoer Oct 31, 2024
b0afa49
some simplifications on overview
mschwoer Oct 31, 2024
e2803df
fix test for toasts
mschwoer Oct 31, 2024
be151ab
fix import
mschwoer Nov 4, 2024
967f351
fix tests
mschwoer Nov 15, 2024
fa531e9
add changes/comments requested by code review
mschwoer Nov 15, 2024
1610bdf
Merge branch 'refactor_analysis_review_comments' into enable_multicova
mschwoer Nov 15, 2024
e88e909
fix merge issues
mschwoer Nov 15, 2024
085cec3
fix merge issues
mschwoer Nov 15, 2024
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
12 changes: 11 additions & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@
}
],
"results": {
".github/workflows/create_release.yml": [
{
"type": "Secret Keyword",
"filename": ".github/workflows/create_release.yml",
"hashed_secret": "3e26d6750975d678acb8fa35a0f69237881576b0",
"is_verified": false,
"line_number": 15,
"is_secret": false
}
],
"docs/workflow_mq.html": [
{
"type": "Base64 High Entropy String",
Expand All @@ -150,5 +160,5 @@
}
]
},
"generated_at": "2024-09-18T09:54:14Z"
"generated_at": "2024-10-08T15:30:41Z"
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ You can run the checks yourself using:
pre-commit run --all-files
```

##### The `detect-secrets` hook fails
This is because you added some code that was identified as a potential secret.
1. Run `detect-secrets scan --exclude-files testfiles --exclude-lines '"(hash|id|image/\w+)":.*' > .secrets.baseline`
(check `.pre-commit-config.yaml` for the exact parameters)
2. Run `detect-secrets audit .secrets.baseline` and check if the detected 'secret' is actually a secret
3. Commit the latest version of `.secrets.baseline`



---
Expand Down
16 changes: 15 additions & 1 deletion alphastats/DataSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def _get_init_dataset(

return rawmat, mat, metadata, sample, preprocessing_info

def _check_loader(self, loader):
@staticmethod
def _check_loader(loader):
"""Checks if the Loader is from class AlphaPeptLoader, MaxQuantLoader, DIANNLoader, FragPipeLoader

Args:
Expand Down Expand Up @@ -240,6 +241,19 @@ def ancova(
"""A wrapper for Statistics.ancova(), see documentation there."""
return self._get_statistics().ancova(protein_id, covar, between)

def multicova_analysis(
self,
covariates: list,
n_permutations: int = 3,
fdr: float = 0.05,
s0: float = 0.05,
subset: dict = None,
) -> Tuple[pd.DataFrame, list]:
"""A wrapper for Statistics.multicova_analysis(), see documentation there."""
return self._get_statistics().multicova_analysis(
covariates, n_permutations, fdr, s0, subset
)

@check_for_missing_values
def plot_pca(self, group: Optional[str] = None, circle: bool = False):
"""Plot Principal Component Analysis (PCA)
Expand Down
73 changes: 37 additions & 36 deletions alphastats/DataSet_Statistics.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from functools import lru_cache
from typing import Dict, Union
from typing import Dict, Tuple, Union

import numpy as np
import pandas as pd
import pingouin

from alphastats.DataSet_Preprocess import PreprocessingStateKeys
from alphastats.statistics.Anova import Anova
from alphastats.statistics.DifferentialExpressionAnalysis import (
DifferentialExpressionAnalysis,
Expand Down Expand Up @@ -131,36 +129,39 @@ def ancova(
ancova_df = pingouin.ancova(df, dv=protein_id, covar=covar, between=between)
return ancova_df

# @ignore_warning(RuntimeWarning)
# def multicova_analysis( # TODO never used outside of tests .. how does this relate to multicova.py?
# self,
# covariates: list,
# n_permutations: int = 3,
# fdr: float = 0.05,
# s0: float = 0.05,
# subset: dict = None,
# ) -> Union[pd.DataFrame, list]:
# """Perform Multicovariat Analysis
# will return a pandas DataFrame with the results and a list of volcano plots (for each covariat)
#
# Args:
# covariates (list): list of covariates, column names in metadata
# n_permutations (int, optional): number of permutations. Defaults to 3.
# fdr (float, optional): False Discovery Rate. Defaults to 0.05.
# s0 (float, optional): . Defaults to 0.05.
# subset (dict, optional): for categorical covariates . Defaults to None.
#
# Returns:
# pd.DataFrame: Multicova Analysis results
# """
#
# res, plot_list = MultiCovaAnalysis(
# dataset=self, # TODO fix .. does this write to it?
# covariates=covariates,
# n_permutations=n_permutations,
# fdr=fdr,
# s0=s0,
# subset=subset,
# plot=True,
# ).calculate()
# return res, plot_list
@ignore_warning(RuntimeWarning)
def multicova_analysis( # TODO never used outside of tests .. how does this relate to multicova.py?
self,
covariates: list,
n_permutations: int = 3,
fdr: float = 0.05,
s0: float = 0.05,
subset: dict = None,
) -> Tuple[pd.DataFrame, list]:
"""Perform Multicovariat Analysis
will return a pandas DataFrame with the results and a list of volcano plots (for each covariat)

Args:
covariates (list): list of covariates, column names in metadata
n_permutations (int, optional): number of permutations. Defaults to 3.
fdr (float, optional): False Discovery Rate. Defaults to 0.05.
s0 (float, optional): . Defaults to 0.05.
subset (dict, optional): for categorical covariates . Defaults to None.

Returns:
pd.DataFrame: Multicova Analysis results
"""

res, plot_list = MultiCovaAnalysis(
mat=self.mat,
metadata=self.metadata,
sample=self.sample,
index_column=self.index_column,
covariates=covariates,
n_permutations=n_permutations,
fdr=fdr,
s0=s0,
subset=subset,
).calculate()

return res, plot_list
7 changes: 4 additions & 3 deletions alphastats/plots/PlotUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ class plotly_object(plotly.graph_objs._figure.Figure):
class PlotUtils:
@staticmethod
def _update_colors_plotly(fig, color_dict):
# plotly doesnt allow to assign color to certain group
# update instead the figure in form of a dict
# color_dict with group_variable/legendgroup as key, and corresponding color as value
# TODO revisit this comment:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://plotly.com/python-api-reference/generated/generated/plotly.graph_objects.Figure.update_traces.html + selector to set individual color or something like:
plot.for_each_trace(lambda t: t.update(marker_color=color_dict.get(t.legendgroup))

# plotly doesnt allow to assign color to certain group
# update instead the figure in form of a dict
# color_dict with group_variable/legendgroup as key, and corresponding color as value
fig_dict = fig.to_plotly_json()
data_dict_list = fig_dict.get("data")
for count, group in enumerate(data_dict_list):
Expand Down
44 changes: 25 additions & 19 deletions alphastats/statistics/MultiCovaAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,30 @@
import numpy as np
import pandas as pd
import plotly.express as px
import scipy
import tqdm

from alphastats.statistics.StatisticUtils import StatisticUtils


class MultiCovaAnalysis(StatisticUtils):
class MultiCovaAnalysis:
def __init__(
self,
dataset,
*,
mat: pd.DataFrame,
metadata: pd.DataFrame,
sample: str,
index_column: str,
covariates: list,
n_permutations: int = 3,
fdr: float = 0.05,
s0: float = 0.05,
subset: dict = None,
plot: bool = False,
):
self.dataset = dataset
self.sample = sample
self.metadata_ori = metadata
self.mat = mat
self.index_column = index_column

self.metadata = None # TODO check if the distinction between metadata and metadata_ori is necessary

self.covariates = covariates
self.n_permutations = n_permutations
self.fdr = fdr
Expand All @@ -35,30 +41,30 @@ def __init__(
self._prepare_matrix()

def _subset_metadata(self):
columns_to_keep = self.covariates + [self.dataset.sample]
columns_to_keep = self.covariates + [self.sample]
if self.subset is not None:
# dict structure {"column_name": ["group1", "group2"]}
subset_column = list(self.subset.keys())[0]
groups = self.subset.get(subset_column)
self.metadata = self.dataset.metadata[
self.dataset.metadata[subset_column].isin(groups)
self.metadata = self.metadata_ori[
self.metadata_ori[subset_column].isin(groups)
][columns_to_keep]

else:
self.metadata = self.dataset.metadata[columns_to_keep]
self.metadata = self.metadata_ori[columns_to_keep]

def _check_covariat_input(self):
# check whether covariates in metadata column
misc_covariates = list(
set(self.covariates) - set(self.dataset.metadata.columns.to_list())
set(self.covariates) - set(self.metadata_ori.columns.to_list())
)
if len(misc_covariates) > 0:
warnings.warn(f"Covariates: {misc_covariates} are not found in Metadata.")
self.covariates = [x for x in self.covariates if x not in misc_covariates]

def _check_na_values(self):
for covariate in self.covariates:
if self.dataset.metadata[covariate].isna().any():
if self.metadata_ori[covariate].isna().any():
self.covariates.remove(covariate)
warnings.warn(
f"Covariate: {covariate} contains missing values"
Expand Down Expand Up @@ -101,10 +107,10 @@ def _convert_string_to_binary(self):
self.covariates.remove(col)

def _prepare_matrix(self):
transposed = self.dataset.mat.transpose()
transposed[self.dataset.index_column] = transposed.index
transposed = self.mat.transpose()
transposed[self.index_column] = transposed.index
transposed = transposed.reset_index(drop=True)
self.transposed = transposed[self.metadata[self.dataset.sample].to_list()]
self.transposed = transposed[self.metadata[self.sample].to_list()]

def _plot_volcano_regression(self, res_real, variable):
sig_col = res_real.filter(regex=variable + "_" + "FDR").columns[0]
Expand All @@ -115,7 +121,7 @@ def _plot_volcano_regression(self, res_real, variable):
y=-np.log10(res_real[variable + "_" + "pval"]),
color=res_real[sig_col],
color_discrete_map={"sig": "#009599", "non_sig": "#404040"},
hover_name=res_real[self.dataset.index_column],
hover_name=res_real[self.index_column],
title=variable,
labels=dict(x="beta value", y="-log10(p-value)", color=sig_level),
)
Expand All @@ -133,12 +139,12 @@ def calculate(self):
quant_data=self.transposed,
annotation=self.metadata,
covariates=self.covariates,
sample_column=self.dataset.sample,
sample_column=self.sample,
n_permutations=self.n_permutations,
fdr=self.fdr,
s0=self.s0,
)
res[self.dataset.index_column] = self.dataset.mat.columns.to_list()
res[self.index_column] = self.mat.columns.to_list()
plot_list = []

if self.plot:
Expand Down
29 changes: 0 additions & 29 deletions alphastats/statistics/StatisticUtils.py

This file was deleted.

2 changes: 0 additions & 2 deletions tests/test_DataSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,6 @@ def test_batch_correction(self):
first_value = self.obj.mat.values[0, 0]
self.assertTrue(np.isclose(2.624937690577153e-08, first_value))

# TODO this opens a plot in a browser window
@skip # TODO multicova_analysis is unused
def test_multicova_analysis_invalid_covariates(self):
self.obj.preprocess(imputation="knn", normalization="zscore", subset=True)
res, _ = self.obj.multicova_analysis(
Expand Down
Loading