diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28222ea9..bf5eea23 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,10 +8,11 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.0 + rev: v0.6.6 hooks: - id: ruff-format -# - id: ruff + - id: ruff + args: ['--fix'] - repo: https://github.com/Yelp/detect-secrets rev: v1.5.0 hooks: diff --git a/alphastats/DataSet.py b/alphastats/DataSet.py index 51535856..53bb7fd9 100644 --- a/alphastats/DataSet.py +++ b/alphastats/DataSet.py @@ -1,26 +1,24 @@ -from typing import List, Union, Dict, Optional, Tuple - -import pandas as pd -import numpy as np import logging import warnings +from typing import Dict, List, Optional, Tuple, Union + +import numpy as np +import pandas as pd import plotly import scipy from alphastats import BaseLoader - - +from alphastats.dataset_factory import DataSetFactory from alphastats.DataSet_Plot import Plot from alphastats.DataSet_Preprocess import Preprocess from alphastats.DataSet_Statistics import Statistics -from alphastats.utils import LoaderError, check_for_missing_values, ignore_warning -from alphastats.statistics.tukey_test import tukey_test from alphastats.plots.ClusterMap import ClusterMap from alphastats.plots.DimensionalityReduction import DimensionalityReduction from alphastats.plots.IntensityPlot import IntensityPlot from alphastats.plots.SampleHistogram import SampleHistogram from alphastats.plots.VolcanoPlot import VolcanoPlot -from alphastats.dataset_factory import DataSetFactory +from alphastats.statistics.tukey_test import tukey_test +from alphastats.utils import LoaderError, check_for_missing_values, ignore_warning plotly.io.templates["alphastats_colors"] = plotly.graph_objects.layout.Template( layout=plotly.graph_objects.Layout( diff --git a/alphastats/DataSet_Pathway.py b/alphastats/DataSet_Pathway.py index 3994b118..b9dd4dc3 100644 --- a/alphastats/DataSet_Pathway.py +++ b/alphastats/DataSet_Pathway.py @@ -1,13 +1,14 @@ # TODO this whole module is unused # Check if this can be merged with the enrichment code accessible through the p'interpreter -import plotly.express as px -import requests -import pandas as pd from io import StringIO + import numpy as np +import pandas as pd +import plotly.express as px +import requests from alphastats import AlphaPeptLoader -from alphastats.utils import check_internetconnection, check_if_df_empty +from alphastats.utils import check_if_df_empty, check_internetconnection class enrichment_df(pd.DataFrame): diff --git a/alphastats/DataSet_Plot.py b/alphastats/DataSet_Plot.py index bc3749ac..d2214d46 100644 --- a/alphastats/DataSet_Plot.py +++ b/alphastats/DataSet_Plot.py @@ -1,15 +1,15 @@ -import plotly.express as px -import plotly -import scipy +from typing import Dict -import plotly.graph_objects as go -import seaborn as sns import pandas as pd +import plotly +import plotly.express as px import plotly.figure_factory -from typing import Dict +import plotly.graph_objects as go +import scipy +import seaborn as sns -from alphastats.utils import check_for_missing_values from alphastats.plots.PlotUtils import PlotUtils +from alphastats.utils import check_for_missing_values class plotly_object(plotly.graph_objs._figure.Figure): diff --git a/alphastats/DataSet_Preprocess.py b/alphastats/DataSet_Preprocess.py index 1dfe27fa..6b00011a 100644 --- a/alphastats/DataSet_Preprocess.py +++ b/alphastats/DataSet_Preprocess.py @@ -1,5 +1,5 @@ import logging -from typing import Tuple, Dict, List, Union +from typing import Dict, List, Tuple, Union import numpy as np import pandas as pd @@ -7,7 +7,6 @@ import sklearn.ensemble import sklearn.impute import streamlit as st - from sklearn.experimental import enable_iterative_imputer # noqa from alphastats.utils import ignore_warning diff --git a/alphastats/DataSet_Statistics.py b/alphastats/DataSet_Statistics.py index 8804e2af..bf3a8be7 100644 --- a/alphastats/DataSet_Statistics.py +++ b/alphastats/DataSet_Statistics.py @@ -1,17 +1,17 @@ -import pandas as pd +from functools import lru_cache +from typing import Dict, Union + import numpy as np +import pandas as pd import pingouin from alphastats.DataSet_Preprocess import PreprocessingStateKeys -from alphastats.utils import ignore_warning -from functools import lru_cache -from typing import Union, Dict - -from alphastats.statistics.MultiCovaAnalysis import MultiCovaAnalysis +from alphastats.statistics.Anova import Anova from alphastats.statistics.DifferentialExpressionAnalysis import ( DifferentialExpressionAnalysis, ) -from alphastats.statistics.Anova import Anova +from alphastats.statistics.MultiCovaAnalysis import MultiCovaAnalysis +from alphastats.utils import ignore_warning class Statistics: diff --git a/alphastats/__init__.py b/alphastats/__init__.py index 633cf4af..fd6b3498 100644 --- a/alphastats/__init__.py +++ b/alphastats/__init__.py @@ -40,10 +40,11 @@ } # TODO get rid of these imports +import alphastats.gui + +from .cli import * from .loader.AlphaPeptLoader import * from .loader.DIANNLoader import * from .loader.FragPipeLoader import * from .loader.MaxQuantLoader import * from .loader.SpectronautLoader import * -from .cli import * -import alphastats.gui diff --git a/alphastats/dataset_factory.py b/alphastats/dataset_factory.py index 7e619979..48f89862 100644 --- a/alphastats/dataset_factory.py +++ b/alphastats/dataset_factory.py @@ -1,9 +1,9 @@ -from typing import List, Union, Dict, Optional, Tuple - -import pandas as pd -import numpy as np import logging import warnings +from typing import Dict, List, Optional, Tuple, Union + +import numpy as np +import pandas as pd class DataSetFactory: diff --git a/alphastats/gui/AlphaPeptStats.py b/alphastats/gui/AlphaPeptStats.py index 7050652a..182bbff3 100644 --- a/alphastats/gui/AlphaPeptStats.py +++ b/alphastats/gui/AlphaPeptStats.py @@ -1,11 +1,11 @@ import os -import streamlit as st +import streamlit as st from alphastats.gui.utils.ui_helper import ( - sidebar_info, img_to_bytes, init_session_state, + sidebar_info, ) st.set_page_config(layout="wide") diff --git a/alphastats/gui/gui.py b/alphastats/gui/gui.py index 5893d011..a4e0e8be 100644 --- a/alphastats/gui/gui.py +++ b/alphastats/gui/gui.py @@ -1,5 +1,6 @@ import os import sys + from streamlit.web import cli as stcli diff --git a/alphastats/gui/pages/02_Import Data.py b/alphastats/gui/pages/02_Import Data.py index 1fcbdeab..350a2e3e 100644 --- a/alphastats/gui/pages/02_Import Data.py +++ b/alphastats/gui/pages/02_Import Data.py @@ -2,24 +2,23 @@ import streamlit as st -from alphastats.DataSet import DataSet from alphastats import BaseLoader -from alphastats.gui.utils.options import SOFTWARE_OPTIONS - +from alphastats.DataSet import DataSet from alphastats.gui.utils.import_helper import ( load_example_data, - uploaded_file_to_df, - show_loader_columns_selection, - load_proteomics_data, load_options, - show_select_sample_column_for_metadata, + load_proteomics_data, show_button_download_metadata_template_file, + show_loader_columns_selection, + show_select_sample_column_for_metadata, + uploaded_file_to_df, ) +from alphastats.gui.utils.options import SOFTWARE_OPTIONS from alphastats.gui.utils.ui_helper import ( - sidebar_info, + StateKeys, empty_session_state, init_session_state, - StateKeys, + sidebar_info, ) diff --git a/alphastats/gui/pages/03_Data Overview.py b/alphastats/gui/pages/03_Data Overview.py index ba581deb..dfa1bfc1 100644 --- a/alphastats/gui/pages/03_Data Overview.py +++ b/alphastats/gui/pages/03_Data Overview.py @@ -1,13 +1,13 @@ import streamlit as st from alphastats.gui.utils.overview_helper import ( + display_loaded_dataset, display_matrix, get_intensity_distribution_processed, - get_sample_histogram_matrix, get_intensity_distribution_unprocessed, - display_loaded_dataset, + get_sample_histogram_matrix, ) -from alphastats.gui.utils.ui_helper import sidebar_info, init_session_state, StateKeys +from alphastats.gui.utils.ui_helper import StateKeys, init_session_state, sidebar_info init_session_state() sidebar_info() diff --git a/alphastats/gui/pages/03_Preprocessing.py b/alphastats/gui/pages/03_Preprocessing.py index 07d72aa1..d1a668a9 100644 --- a/alphastats/gui/pages/03_Preprocessing.py +++ b/alphastats/gui/pages/03_Preprocessing.py @@ -1,17 +1,16 @@ -import streamlit as st import pandas as pd - +import streamlit as st from alphastats.gui.utils.preprocessing_helper import ( - draw_workflow, + PREPROCESSING_STEPS, configure_preprocessing, display_preprocessing_info, - update_workflow, - run_preprocessing, + draw_workflow, reset_preprocessing, - PREPROCESSING_STEPS, + run_preprocessing, + update_workflow, ) -from alphastats.gui.utils.ui_helper import sidebar_info, init_session_state, StateKeys +from alphastats.gui.utils.ui_helper import StateKeys, init_session_state, sidebar_info init_session_state() sidebar_info() diff --git a/alphastats/gui/pages/04_Analysis.py b/alphastats/gui/pages/04_Analysis.py index aac6af63..a81633b3 100644 --- a/alphastats/gui/pages/04_Analysis.py +++ b/alphastats/gui/pages/04_Analysis.py @@ -1,19 +1,19 @@ import streamlit as st -from alphastats.gui.utils.ui_helper import ( - sidebar_info, - init_session_state, - convert_df, - StateKeys, -) from alphastats.gui.utils.analysis_helper import ( - get_analysis, - load_options, + display_df, display_figure, - save_plot_to_session_state, download_figure, - display_df, download_preprocessing_info, + get_analysis, + load_options, + save_plot_to_session_state, +) +from alphastats.gui.utils.ui_helper import ( + StateKeys, + convert_df, + init_session_state, + sidebar_info, ) diff --git a/alphastats/gui/pages/05_LLM.py b/alphastats/gui/pages/05_LLM.py index b1ec5e9a..3a55c7c8 100644 --- a/alphastats/gui/pages/05_LLM.py +++ b/alphastats/gui/pages/05_LLM.py @@ -1,27 +1,28 @@ import os -import streamlit as st + import pandas as pd +import streamlit as st from openai import AuthenticationError from alphastats.gui.utils.analysis_helper import ( check_if_options_are_loaded, display_figure, - save_plot_to_session_state, gui_volcano_plot_differential_expression_analysis, helper_compare_two_groups, + save_plot_to_session_state, ) from alphastats.gui.utils.gpt_helper import ( - get_assistant_functions, display_proteins, - get_subgroups_for_each_group, + get_assistant_functions, get_general_assistant_functions, + get_subgroups_for_each_group, ) +from alphastats.gui.utils.ollama_utils import LLMIntegration from alphastats.gui.utils.openai_utils import ( set_api_key, ) -from alphastats.gui.utils.ollama_utils import LLMIntegration from alphastats.gui.utils.options import interpretation_options -from alphastats.gui.utils.ui_helper import sidebar_info, init_session_state, StateKeys +from alphastats.gui.utils.ui_helper import StateKeys, init_session_state, sidebar_info init_session_state() sidebar_info() diff --git a/alphastats/gui/pages/06_Results.py b/alphastats/gui/pages/06_Results.py index c3d2293b..a3e0a1fa 100644 --- a/alphastats/gui/pages/06_Results.py +++ b/alphastats/gui/pages/06_Results.py @@ -1,12 +1,13 @@ -import streamlit as st -import pandas as pd import io +import pandas as pd +import streamlit as st + from alphastats.gui.utils.ui_helper import ( - sidebar_info, - init_session_state, - convert_df, StateKeys, + convert_df, + init_session_state, + sidebar_info, ) diff --git a/alphastats/gui/utils/analysis_helper.py b/alphastats/gui/utils/analysis_helper.py index ae660f68..c6a6d972 100644 --- a/alphastats/gui/utils/analysis_helper.py +++ b/alphastats/gui/utils/analysis_helper.py @@ -1,8 +1,9 @@ +import io + import pandas as pd import streamlit as st -import io -from alphastats.gui.utils.ui_helper import convert_df, StateKeys +from alphastats.gui.utils.ui_helper import StateKeys, convert_df from alphastats.plots.VolcanoPlot import VolcanoPlot diff --git a/alphastats/gui/utils/enrichment_analysis.py b/alphastats/gui/utils/enrichment_analysis.py index e487b406..ac9ced65 100644 --- a/alphastats/gui/utils/enrichment_analysis.py +++ b/alphastats/gui/utils/enrichment_analysis.py @@ -1,10 +1,8 @@ from typing import List -import requests - - -from gprofiler import GProfiler import pandas as pd +import requests +from gprofiler import GProfiler def _get_functional_annotation_string(identifier, species_id="9606") -> pd.DataFrame: diff --git a/alphastats/gui/utils/gpt_helper.py b/alphastats/gui/utils/gpt_helper.py index 3296dd56..0e84a7f0 100644 --- a/alphastats/gui/utils/gpt_helper.py +++ b/alphastats/gui/utils/gpt_helper.py @@ -1,15 +1,15 @@ import copy -from typing import Union, List, Dict - import json - -from Bio import Entrez +from typing import Dict, List, Union import pandas as pd +import requests import streamlit as st +from Bio import Entrez +from gprofiler import GProfiler -from alphastats.plots.DimensionalityReduction import DimensionalityReduction from alphastats.gui.utils.ui_helper import StateKeys +from alphastats.plots.DimensionalityReduction import DimensionalityReduction Entrez.email = "lebedev_mikhail@outlook.com" # Always provide your email address when using NCBI services. diff --git a/alphastats/gui/utils/import_helper.py b/alphastats/gui/utils/import_helper.py index dd313d78..8f39337c 100644 --- a/alphastats/gui/utils/import_helper.py +++ b/alphastats/gui/utils/import_helper.py @@ -1,17 +1,16 @@ +import io +import os from pathlib import Path -from typing import Optional, Tuple, List +from typing import List, Optional, Tuple -import streamlit as st import pandas as pd -import os -import io - +import streamlit as st from streamlit.runtime.uploaded_file_manager import UploadedFile from alphastats.DataSet import DataSet from alphastats.gui.utils.options import SOFTWARE_OPTIONS -from alphastats.loader.MaxQuantLoader import MaxQuantLoader, BaseLoader from alphastats.gui.utils.ui_helper import StateKeys +from alphastats.loader.MaxQuantLoader import BaseLoader, MaxQuantLoader def load_options(): diff --git a/alphastats/gui/utils/ollama_utils.py b/alphastats/gui/utils/ollama_utils.py index 2b483cca..42b100ae 100644 --- a/alphastats/gui/utils/ollama_utils.py +++ b/alphastats/gui/utils/ollama_utils.py @@ -1,22 +1,22 @@ +import json import logging +from typing import Any, Dict, List, Optional, Tuple -from openai import OpenAI -from typing import List, Dict, Any, Optional, Tuple -import json -import streamlit as st import pandas as pd -from IPython.display import display, Markdown, HTML import plotly.io as pio +import streamlit as st +from IPython.display import HTML, Markdown, display +from openai import OpenAI + +from alphastats.gui.utils.enrichment_analysis import get_enrichment_data from alphastats.gui.utils.gpt_helper import ( - perform_dimensionality_reduction, get_general_assistant_functions, + perform_dimensionality_reduction, ) +from alphastats.gui.utils.ui_helper import StateKeys # from alphastats.gui.utils.artefacts import ArtifactManager from alphastats.gui.utils.uniprot_utils import get_gene_function -from alphastats.gui.utils.enrichment_analysis import get_enrichment_data -from alphastats.gui.utils.ui_helper import StateKeys - logger = logging.getLogger(__name__) diff --git a/alphastats/gui/utils/openai_utils.py b/alphastats/gui/utils/openai_utils.py index f8f3e051..45bff60e 100644 --- a/alphastats/gui/utils/openai_utils.py +++ b/alphastats/gui/utils/openai_utils.py @@ -1,9 +1,7 @@ -from typing import Optional, List -from pathlib import Path - -import time import json - +import time +from pathlib import Path +from typing import List, Optional import openai import streamlit as st @@ -22,12 +20,12 @@ from utils.gpt_helper import ( turn_args_to_float, ) - from utils.uniprot_utils import ( - get_gene_function, - ) from utils.openai_utils import ( wait_for_run_completion, ) + from utils.uniprot_utils import ( + get_gene_function, + ) def wait_for_run_completion( diff --git a/alphastats/gui/utils/options.py b/alphastats/gui/utils/options.py index 87687167..8481304b 100644 --- a/alphastats/gui/utils/options.py +++ b/alphastats/gui/utils/options.py @@ -1,11 +1,10 @@ -from alphastats.loader.MaxQuantLoader import MaxQuantLoader +from alphastats.gui.utils.ui_helper import StateKeys from alphastats.loader.AlphaPeptLoader import AlphaPeptLoader -from alphastats.loader.FragPipeLoader import FragPipeLoader from alphastats.loader.DIANNLoader import DIANNLoader -from alphastats.loader.SpectronautLoader import SpectronautLoader +from alphastats.loader.FragPipeLoader import FragPipeLoader from alphastats.loader.GenericLoader import GenericLoader +from alphastats.loader.MaxQuantLoader import MaxQuantLoader from alphastats.loader.mzTabLoader import mzTabLoader -from alphastats.gui.utils.ui_helper import StateKeys def plotting_options(state): diff --git a/alphastats/gui/utils/overview_helper.py b/alphastats/gui/utils/overview_helper.py index 6a631462..15c50ca2 100644 --- a/alphastats/gui/utils/overview_helper.py +++ b/alphastats/gui/utils/overview_helper.py @@ -1,9 +1,8 @@ -import streamlit as st import pandas as pd +import streamlit as st -from alphastats.DataSet_Preprocess import PreprocessingStateKeys from alphastats.DataSet import DataSet -from alphastats.gui.utils.ui_helper import convert_df, StateKeys +from alphastats.gui.utils.ui_helper import StateKeys, convert_df # @st.cache_data # TODO check if caching is sensible here and if so, reimplement with dataset-hash diff --git a/alphastats/gui/utils/preprocessing_helper.py b/alphastats/gui/utils/preprocessing_helper.py index 69e621ad..a0108556 100644 --- a/alphastats/gui/utils/preprocessing_helper.py +++ b/alphastats/gui/utils/preprocessing_helper.py @@ -1,7 +1,7 @@ from typing import List -import streamlit as st import pandas as pd +import streamlit as st from st_cytoscape import cytoscape from alphastats.DataSet import DataSet diff --git a/alphastats/gui/utils/ui_helper.py b/alphastats/gui/utils/ui_helper.py index 22d5d18b..8814e04b 100644 --- a/alphastats/gui/utils/ui_helper.py +++ b/alphastats/gui/utils/ui_helper.py @@ -1,8 +1,9 @@ +import base64 import uuid -import streamlit as st import pandas as pd -import base64 +import streamlit as st + from alphastats import __version__ # TODO add logo above the options when issue is closed diff --git a/alphastats/gui/utils/uniprot_utils.py b/alphastats/gui/utils/uniprot_utils.py index f767ecd8..18ba7d93 100644 --- a/alphastats/gui/utils/uniprot_utils.py +++ b/alphastats/gui/utils/uniprot_utils.py @@ -1,7 +1,6 @@ -from typing import Union, List, Dict -import requests - +from typing import Dict, List, Union +import requests import streamlit as st from alphastats.gui.utils.ui_helper import StateKeys diff --git a/alphastats/loader/AlphaPeptLoader.py b/alphastats/loader/AlphaPeptLoader.py index ae4e358d..7b56176d 100644 --- a/alphastats/loader/AlphaPeptLoader.py +++ b/alphastats/loader/AlphaPeptLoader.py @@ -1,8 +1,10 @@ -from alphastats.loader.BaseLoader import BaseLoader -import pandas as pd -import numpy as np import logging +import numpy as np +import pandas as pd + +from alphastats.loader.BaseLoader import BaseLoader + class AlphaPeptLoader(BaseLoader): """Loader for AlphaPept outputfiles diff --git a/alphastats/loader/BaseLoader.py b/alphastats/loader/BaseLoader.py index 911c3263..e0d8ca7b 100644 --- a/alphastats/loader/BaseLoader.py +++ b/alphastats/loader/BaseLoader.py @@ -1,11 +1,12 @@ -import pandas as pd import logging import os -import numpy as np -from alphastats.utils import find_duplicates_in_list +import sys from typing import Union -import sys +import numpy as np +import pandas as pd + +from alphastats.utils import find_duplicates_in_list if sys.version_info >= (3, 9): import importlib.resources as importlib_resources diff --git a/alphastats/loader/DIANNLoader.py b/alphastats/loader/DIANNLoader.py index 4b22720b..b3638927 100644 --- a/alphastats/loader/DIANNLoader.py +++ b/alphastats/loader/DIANNLoader.py @@ -1,6 +1,7 @@ -from alphastats.loader.BaseLoader import BaseLoader import pandas as pd +from alphastats.loader.BaseLoader import BaseLoader + class DIANNLoader(BaseLoader): """Loader for DIA-NN output files diff --git a/alphastats/loader/FragPipeLoader.py b/alphastats/loader/FragPipeLoader.py index 4c6ca885..2ac1273d 100644 --- a/alphastats/loader/FragPipeLoader.py +++ b/alphastats/loader/FragPipeLoader.py @@ -1,7 +1,9 @@ -from alphastats.loader.BaseLoader import BaseLoader -import pandas as pd from typing import Union +import pandas as pd + +from alphastats.loader.BaseLoader import BaseLoader + # Philosopher # class name needs to be discussed whether MSFragger/Fragpipe/Philospher diff --git a/alphastats/loader/GenericLoader.py b/alphastats/loader/GenericLoader.py index 4625a172..bc7f19c4 100644 --- a/alphastats/loader/GenericLoader.py +++ b/alphastats/loader/GenericLoader.py @@ -1,7 +1,8 @@ -from alphastats.loader.BaseLoader import BaseLoader +from typing import Union import pandas as pd -from typing import Union + +from alphastats.loader.BaseLoader import BaseLoader class GenericLoader(BaseLoader): diff --git a/alphastats/loader/MaxQuantLoader.py b/alphastats/loader/MaxQuantLoader.py index fd77ff6b..65ec5878 100644 --- a/alphastats/loader/MaxQuantLoader.py +++ b/alphastats/loader/MaxQuantLoader.py @@ -1,8 +1,10 @@ -from alphastats.loader.BaseLoader import BaseLoader -import pandas as pd -import numpy as np from typing import Union +import numpy as np +import pandas as pd + +from alphastats.loader.BaseLoader import BaseLoader + class MaxQuantLoader(BaseLoader): """Loader for MaxQuant outputfiles""" diff --git a/alphastats/loader/SpectronautLoader.py b/alphastats/loader/SpectronautLoader.py index 94b6b0a8..96eff9be 100644 --- a/alphastats/loader/SpectronautLoader.py +++ b/alphastats/loader/SpectronautLoader.py @@ -1,12 +1,19 @@ -from alphastats.loader.BaseLoader import BaseLoader -from typing import Union -import pandas as pd -import numpy as np import re import warnings +from typing import Union + +import numpy as np +import pandas as pd + +from alphastats.loader.BaseLoader import BaseLoader SPECTRONAUT_COLUMN_DELIM = "." +import numpy as np +import pandas as pd + +from alphastats.loader.BaseLoader import BaseLoader + class SpectronautLoader(BaseLoader): """Loader for Spectronaut outputfiles""" diff --git a/alphastats/loader/mzTabLoader.py b/alphastats/loader/mzTabLoader.py index 19dac472..bfb85c01 100644 --- a/alphastats/loader/mzTabLoader.py +++ b/alphastats/loader/mzTabLoader.py @@ -1,4 +1,5 @@ from pyteomics import mztab + from alphastats.loader.BaseLoader import BaseLoader diff --git a/alphastats/multicova/multicova.py b/alphastats/multicova/multicova.py index 6d7707b3..ae7105d0 100644 --- a/alphastats/multicova/multicova.py +++ b/alphastats/multicova/multicova.py @@ -1,22 +1,23 @@ -import numpy as np -import pandas as pd +import math +import multiprocessing +import os +import random +from collections import Counter +from pathlib import Path + import numba as nb import numba_stats as nbs +import numpy as np +import pandas as pd import plotly.express as px import plotly.graph_objects as go -from sklearn.linear_model import LinearRegression -from scipy import stats import statsmodels.api as sm -from collections import Counter -import multiprocessing -from joblib import Parallel, delayed -import random -import math import swifter +from joblib import Parallel, delayed +from scipy import stats +from sklearn.linear_model import LinearRegression from sklearn.preprocessing import StandardScaler from statsmodels.stats.multitest import multipletests -import os -from pathlib import Path # code taken from Isabel Bludau - multicova diff --git a/alphastats/plots/ClusterMap.py b/alphastats/plots/ClusterMap.py index e3cedfcf..f313625d 100644 --- a/alphastats/plots/ClusterMap.py +++ b/alphastats/plots/ClusterMap.py @@ -1,13 +1,12 @@ +import random from typing import Dict import pandas as pd +import seaborn as sns from alphastats.DataSet_Statistics import Statistics from alphastats.plots.PlotUtils import PlotUtils -import seaborn as sns -import random - class ClusterMap(PlotUtils): def __init__( diff --git a/alphastats/plots/DimensionalityReduction.py b/alphastats/plots/DimensionalityReduction.py index 3260e1be..40e3e94e 100644 --- a/alphastats/plots/DimensionalityReduction.py +++ b/alphastats/plots/DimensionalityReduction.py @@ -1,12 +1,13 @@ from typing import Dict, Optional -from alphastats.DataSet_Preprocess import Preprocess -from alphastats.plots.PlotUtils import PlotUtils, plotly_object +import pandas as pd import plotly import plotly.express as px import plotly.graph_objects as go import sklearn -import pandas as pd + +from alphastats.DataSet_Preprocess import Preprocess +from alphastats.plots.PlotUtils import PlotUtils, plotly_object # make own alphastats theme plotly.io.templates["alphastats_colors"] = plotly.graph_objects.layout.Template( diff --git a/alphastats/plots/IntensityPlot.py b/alphastats/plots/IntensityPlot.py index 8486905b..87738e7d 100644 --- a/alphastats/plots/IntensityPlot.py +++ b/alphastats/plots/IntensityPlot.py @@ -1,15 +1,15 @@ import logging from typing import Dict -import pandas as pd -import scipy import numpy as np -import plotly.graph_objects as go -import plotly.express as px +import pandas as pd import plotly +import plotly.express as px +import plotly.graph_objects as go +import scipy -from alphastats.plots.PlotUtils import plotly_object, PlotUtils from alphastats.gui.utils.gpt_helper import get_gene_to_prot_id_mapping +from alphastats.plots.PlotUtils import PlotUtils, plotly_object plotly.io.templates["alphastats_colors"] = plotly.graph_objects.layout.Template( layout=plotly.graph_objects.Layout( diff --git a/alphastats/plots/PlotUtils.py b/alphastats/plots/PlotUtils.py index 620521dc..eaec32c0 100644 --- a/alphastats/plots/PlotUtils.py +++ b/alphastats/plots/PlotUtils.py @@ -1,10 +1,9 @@ -from typing import Optional, Dict +from typing import Dict, Optional import pandas as pd import plotly import plotly.graph_objects as go - plotly.io.templates["alphastats_colors"] = plotly.graph_objects.layout.Template( layout=plotly.graph_objects.Layout( paper_bgcolor="rgba(0,0,0,0)", diff --git a/alphastats/plots/SampleHistogram.py b/alphastats/plots/SampleHistogram.py index 45812637..49617b42 100644 --- a/alphastats/plots/SampleHistogram.py +++ b/alphastats/plots/SampleHistogram.py @@ -1,9 +1,9 @@ +import math + import pandas as pd -from plotly.subplots import make_subplots -import plotly.graph_objects as go import plotly.express as px - -import math +import plotly.graph_objects as go +from plotly.subplots import make_subplots class SampleHistogram: diff --git a/alphastats/plots/VolcanoPlot.py b/alphastats/plots/VolcanoPlot.py index 965376d4..7bda7478 100644 --- a/alphastats/plots/VolcanoPlot.py +++ b/alphastats/plots/VolcanoPlot.py @@ -1,16 +1,16 @@ +from functools import lru_cache from typing import Dict, List, Union -from alphastats.DataSet_Statistics import Statistics -from alphastats.DataSet_Preprocess import PreprocessingStateKeys -from alphastats.plots.PlotUtils import PlotUtils, plotly_object -from alphastats.utils import ignore_warning - import numpy as np import pandas as pd +import plotly import plotly.express as px import plotly.graph_objects as go -import plotly -from functools import lru_cache + +from alphastats.DataSet_Preprocess import PreprocessingStateKeys +from alphastats.DataSet_Statistics import Statistics +from alphastats.plots.PlotUtils import PlotUtils, plotly_object +from alphastats.utils import ignore_warning # TODO this is repeated and needs to go elsewhere! plotly.io.templates["alphastats_colors"] = plotly.graph_objects.layout.Template( diff --git a/alphastats/statistics/DifferentialExpressionAnalysis.py b/alphastats/statistics/DifferentialExpressionAnalysis.py index 3228819e..2405f6e4 100644 --- a/alphastats/statistics/DifferentialExpressionAnalysis.py +++ b/alphastats/statistics/DifferentialExpressionAnalysis.py @@ -1,8 +1,8 @@ -import pandas as pd -import numpy as np +from typing import Dict, Union +import numpy as np +import pandas as pd import scipy -from typing import Union, Dict from alphastats.DataSet_Preprocess import PreprocessingStateKeys diff --git a/alphastats/statistics/MultiCovaAnalysis.py b/alphastats/statistics/MultiCovaAnalysis.py index 0a490b44..26dd179a 100644 --- a/alphastats/statistics/MultiCovaAnalysis.py +++ b/alphastats/statistics/MultiCovaAnalysis.py @@ -1,10 +1,12 @@ -import scipy -import tqdm -import pandas as pd +import warnings + import numpy as np +import pandas as pd import plotly.express as px +import scipy +import tqdm + from alphastats.statistics.StatisticUtils import StatisticUtils -import warnings class MultiCovaAnalysis(StatisticUtils): diff --git a/alphastats/utils.py b/alphastats/utils.py index 3b286181..a8cedf4c 100644 --- a/alphastats/utils.py +++ b/alphastats/utils.py @@ -1,8 +1,8 @@ import functools +import http.client as httplib +import logging import warnings from typing import Type -import logging -import http.client as httplib def ignore_warning(warning: Type[Warning]): diff --git a/nbs/getting_started.ipynb b/nbs/getting_started.ipynb index 857e7707..205f9afa 100644 --- a/nbs/getting_started.ipynb +++ b/nbs/getting_started.ipynb @@ -7,12 +7,15 @@ "metadata": {}, "outputs": [], "source": [ - "import pandas as pd\n", "import warnings\n", "\n", + "import pandas as pd\n", + "\n", "from alphastats.DataSet import DataSet\n", "\n", - "warnings.filterwarnings(\"ignore\", category=UserWarning, module=\"openpyxl\") # remove warning from mac" + "warnings.filterwarnings(\n", + " \"ignore\", category=UserWarning, module=\"openpyxl\"\n", + ") # remove warning from mac" ] }, { @@ -328,7 +331,9 @@ } ], "source": [ - "protein_groups = pd.read_csv(\"../testfiles/maxquant/proteinGroups.txt\", sep = \"\\t\", low_memory=False)\n", + "protein_groups = pd.read_csv(\n", + " \"../testfiles/maxquant/proteinGroups.txt\", sep=\"\\t\", low_memory=False\n", + ")\n", "protein_groups.head(5)" ] }, @@ -683,7 +688,7 @@ "maxquant_data = alphastats.MaxQuantLoader(\n", " file=\"../testfiles/maxquant/proteinGroups.txt\",\n", " intensity_column=\"LFQ intensity [sample]\",\n", - " index_column=\"Protein IDs\"\n", + " index_column=\"Protein IDs\",\n", ")" ] }, @@ -717,9 +722,9 @@ ], "source": [ "ds = DataSet(\n", - " loader = maxquant_data, \n", - " metadata_path = \"../testfiles/maxquant/metadata.xlsx\",\n", - " sample_column = \"sample\" # specify the column that corresponds to the sample names in proteinGroups\n", + " loader=maxquant_data,\n", + " metadata_path=\"../testfiles/maxquant/metadata.xlsx\",\n", + " sample_column=\"sample\", # specify the column that corresponds to the sample names in proteinGroups\n", ")" ] }, @@ -757,7 +762,9 @@ } ], "source": [ - "print(f\"Number of samples in the matrix: {ds.mat.shape[0]}, number of samples in metadata: {ds.metadata.shape[0]}.\")" + "print(\n", + " f\"Number of samples in the matrix: {ds.mat.shape[0]}, number of samples in metadata: {ds.metadata.shape[0]}.\"\n", + ")" ] }, { @@ -794,7 +801,9 @@ } ], "source": [ - "print(f\"Number of samples in the matrix: {ds.mat.shape[0]}, number of samples in metadata: {ds.metadata.shape[0]}.\")" + "print(\n", + " f\"Number of samples in the matrix: {ds.mat.shape[0]}, number of samples in metadata: {ds.metadata.shape[0]}.\"\n", + ")" ] }, { @@ -821,7 +830,7 @@ } ], "source": [ - "ds.plot_sampledistribution(color = \"disease\").show(renderer = \"png\")" + "ds.plot_sampledistribution(color=\"disease\").show(renderer=\"png\")" ] }, { @@ -853,11 +862,7 @@ } ], "source": [ - "ds.preprocess(\n", - " remove_contaminations=True,\n", - " normalization = \"quantile\",\n", - " imputation = \"knn\"\n", - ")" + "ds.preprocess(remove_contaminations=True, normalization=\"quantile\", imputation=\"knn\")" ] }, { @@ -884,7 +889,7 @@ } ], "source": [ - "ds.plot_sampledistribution(method = \"box\", color = \"disease\").show(renderer = \"png\")" + "ds.plot_sampledistribution(method=\"box\", color=\"disease\").show(renderer=\"png\")" ] }, { @@ -954,7 +959,7 @@ } ], "source": [ - "ds.plot_pca(group = \"disease\", circle = True).show(renderer = \"png\")" + "ds.plot_pca(group=\"disease\", circle=True).show(renderer=\"png\")" ] } ], diff --git a/nbs/liu_2019.ipynb b/nbs/liu_2019.ipynb index 8a8abff9..87f5df7d 100644 --- a/nbs/liu_2019.ipynb +++ b/nbs/liu_2019.ipynb @@ -18,12 +18,12 @@ "metadata": {}, "outputs": [], "source": [ - "import alphastats\n", "import plotly.io as pio\n", "\n", + "import alphastats\n", "from alphastats.DataSet import DataSet\n", "\n", - "pio.renderers.default = \"plotly_mimetype+notebook\" " + "pio.renderers.default = \"plotly_mimetype+notebook\"" ] }, { @@ -83,17 +83,17 @@ "source": [ "# we are going to load the proteomics data\n", "loader = alphastats.MaxQuantLoader(\n", - " file = \"../testfiles/maxquant/proteinGroups.txt\", \n", + " file=\"../testfiles/maxquant/proteinGroups.txt\",\n", " intensity_column=\"LFQ intensity [sample]\",\n", " # for indexing we are going to use the gene name columm\n", " # it is adivsed to use the ProteinIDs for indexing as these are unique\n", " index_column=\"Gene names\",\n", - " gene_names_column=None\n", + " gene_names_column=None,\n", ")\n", "dataset = DataSet(\n", - " loader = loader, \n", - " metadata_path=\"../testfiles/maxquant/metadata.xlsx\", \n", - " sample_column=\"sample\"\n", + " loader=loader,\n", + " metadata_path=\"../testfiles/maxquant/metadata.xlsx\",\n", + " sample_column=\"sample\",\n", ")" ] }, @@ -115,7 +115,7 @@ "new_names = {\n", " \"non-alcoholic fatty liver disease\": \"NAFLD\",\n", " \"type 2 diabetes mellitus\": \"T2DM\",\n", - " \"type 2 diabetes mellitus|non-alcoholic fatty liver disease\": \"T2DM+NAFLD\"\n", + " \"type 2 diabetes mellitus|non-alcoholic fatty liver disease\": \"T2DM+NAFLD\",\n", "}\n", "dataset.metadata[\"disease\"].replace(new_names, inplace=True)" ] @@ -137,10 +137,10 @@ "source": [ "dataset.preprocess(\n", " log2_transform=False,\n", - " remove_contaminations=True, \n", - " subset=True, \n", - " imputation=\"knn\", \n", - " normalization=\"quantile\"\n", + " remove_contaminations=True,\n", + " subset=True,\n", + " imputation=\"knn\",\n", + " normalization=\"quantile\",\n", ")" ] }, @@ -216,13 +216,13 @@ ], "source": [ "volcano_plot = dataset.plot_volcano(\n", - " column=\"disease\", # column in metadata\n", + " column=\"disease\", # column in metadata\n", " group1=\"T2DM\",\n", " group2=\"T2DM+NAFLD\",\n", - " labels=True, # add label to significantly enriched proteins\n", - " alpha=0.001 # cutoff for pvalue\n", + " labels=True, # add label to significantly enriched proteins\n", + " alpha=0.001, # cutoff for pvalue\n", ")\n", - "volcano_plot.show(renderer = \"png\")\n" + "volcano_plot.show(renderer=\"png\")" ] }, { @@ -284,15 +284,15 @@ } ], "source": [ - "for protein in [\"LGALS3BP\",\"AFM\",\"SERPINC1\",\"CTSD;HEL-S-130P\",\"ALDOB\"]:\n", + "for protein in [\"LGALS3BP\", \"AFM\", \"SERPINC1\", \"CTSD;HEL-S-130P\", \"ALDOB\"]:\n", " plot = dataset.plot_intensity(\n", " method=\"all\",\n", - " protein_id=protein, \n", - " group=\"disease\", # column in metadata\n", - " subgroups=[\"T2DM\",\"T2DM+NAFLD\"], # we only want to see T2DM and T2DM+NAFLD\n", - " add_significance=True # add bar with pvalue\n", - " )\n", - " plot.show(renderer = \"png\")" + " protein_id=protein,\n", + " group=\"disease\", # column in metadata\n", + " subgroups=[\"T2DM\", \"T2DM+NAFLD\"], # we only want to see T2DM and T2DM+NAFLD\n", + " add_significance=True, # add bar with pvalue\n", + " )\n", + " plot.show(renderer=\"png\")" ] }, { diff --git a/nbs/ramus_2016.ipynb b/nbs/ramus_2016.ipynb index 8d16837a..df3c59af 100644 --- a/nbs/ramus_2016.ipynb +++ b/nbs/ramus_2016.ipynb @@ -6,9 +6,10 @@ "metadata": {}, "outputs": [], "source": [ - "import alphastats\n", + "import numpy as np\n", "import pandas as pd\n", - "import numpy as np" + "\n", + "import alphastats" ] }, { @@ -54,8 +55,10 @@ "source": [ "# Get list of UPS-spiked proteins\n", "original_df = pd.read_excel(\"Supplementary Table 1.xlsx\", sheet_name=\"LFQ MaxQuant (7)\")\n", - "original_df =original_df[original_df['Majority protein IDs'].notna()]\n", - "ups_proteins = original_df[(original_df['Species'] == \"UPS\")]['Majority protein IDs'].to_list()" + "original_df = original_df[original_df[\"Majority protein IDs\"].notna()]\n", + "ups_proteins = original_df[(original_df[\"Species\"] == \"UPS\")][\n", + " \"Majority protein IDs\"\n", + "].to_list()" ] }, { @@ -78,16 +81,14 @@ "source": [ "# load data\n", "loader = alphastats.MaxQuantLoader(\n", - " file= \"ProteinGroups.txt\",\n", + " file=\"ProteinGroups.txt\",\n", " index_column=\"Majority protein IDs\",\n", - " intensity_column = \"[sample]\",\n", - " filter_columns=[]\n", + " intensity_column=\"[sample]\",\n", + " filter_columns=[],\n", ")\n", - " \n", + "\n", "ds = alphastats.DataSet(\n", - " loader = loader,\n", - " metadata_path = \"metadata.csv\",\n", - " sample_column = \"sample\" \n", + " loader=loader, metadata_path=\"metadata.csv\", sample_column=\"sample\"\n", ")" ] }, @@ -104,19 +105,19 @@ "metadata": {}, "outputs": [], "source": [ - "column=\"condition_replicate\"\n", - "group1=\"50Vs5_A\"\n", - "group2=\"50Vs5_B\"\n", - "method=\"sam\"\n", - "perm=10\n", - "color_list=ups_proteins\n", + "column = \"condition_replicate\"\n", + "group1 = \"50Vs5_A\"\n", + "group2 = \"50Vs5_B\"\n", + "method = \"sam\"\n", + "perm = 10\n", + "color_list = ups_proteins\n", "\n", - "draw_line=False,\n", - "labels:bool=False\n", - "min_fc:float=1.0\n", - "alpha:float=0.05\n", - "draw_line:bool=False\n", - "fdr:float=0.05" + "draw_line = (False,)\n", + "labels: bool = False\n", + "min_fc: float = 1.0\n", + "alpha: float = 0.05\n", + "draw_line: bool = False\n", + "fdr: float = 0.05" ] }, { @@ -332,7 +333,7 @@ 2.7227157844208527, 4.212073096840278, 3.2175773545164006, - 3.6627736099249653, + 3.6627736099249657, 4.367175815240508, 3.636656775116716, 3.446360818235732, @@ -348,11 +349,11 @@ 4.224655001144278, 4.432459437435682, 3.6250582923985633, - 3.7692555288283955, + 3.769255528828395, 3.899846540959519, 1.462117060518196, 4.183003715381314, - 3.8289377177696764, + 3.828937717769677, 2.845245432743827, 2.9411028232606675, 3.5924817878111917, @@ -362,11 +363,11 @@ 3.580125078101343, 3.0283676791611533, 4.175298115750035, - 3.9493736850988164, + 3.949373685098816, 3.0492222686379264, 3.892871873470515, 2.935341288299778, - 3.7157585010870626, + 3.715758501087062, 3.111476396747605, 3.066124703603542, 3.801530558215646, @@ -416,7 +417,7 @@ 3.023594041165077, 4.995195670152632, 4.056896119336375, - 3.3170547689333882, + 3.317054768933388, 7.989982739651462, 5.809734228285325, 6.357883033776596, @@ -2928,11 +2929,11 @@ "type": "scatter", "x": [ -0.3244758903270295, - -0.21613055181066798, + -0.216130551810668, -0.5358716891132289, -0.071328003121927, - -0.41355241100316675, - -0.21961673811643578, + -0.4135524110031667, + -0.21961673811643576, -0.006821808754612135, -0.012820949417825744, -0.29708656706675995, @@ -2941,32 +2942,32 @@ -0.29678269753907927, -0.4464308371157557, -0.7312922970038684, - -0.14353082303326659, + -0.1435308230332666, 0.038908763713003225, -1.0450651329754237, -0.2944930960136283, -0.09876534082983568, -0.48900002264132425, - -0.38460063605639405, + -0.3846006360563941, -0.025709569327489135, -0.5625072340934807, -0.28236620580014105, -0.2932029293601026, -0.11940847171543112, -0.3046382391252038, - -0.11415450653072767, - -0.20647685408927074, + -0.11415450653072769, + -0.20647685408927072, -0.1935666568765555, -1.1590091939940308, - -0.18254081629315522, + -0.1825408162931552, -0.3010669256779046, 0.3987646535791285, - -0.12358657754439051, + -0.12358657754439052, -0.17619869281369205, -0.2930582718346777, -0.3392476500521546, -0.12723987982028362, - 0.15276096386083537, + 0.15276096386083535, 0.043310257600069235, -0.17906928339699135, 0.08593383622780593, @@ -3000,26 +3001,26 @@ -0.035352549074112005, 0.08521032971644615, -0.0677145282493612, - -0.21080585367955962, + -0.2108058536795596, -0.10532682473624178, -0.24125521940775485, -0.06847031142926951, - 0.09678321390726907, + 0.09678321390726909, 1.1323266471293358, 0.21308822169008224, -0.4397852981066812, 0.08345647226100539, -0.1329968084289206, - -0.010792825494711167, + -0.010792825494711169, -0.11486577940063825, - -0.10118693621491559, + -0.1011869362149156, 0.043565462805823074, -0.20595710676483492, -0.0923315558069504, -0.13290637236258362, -0.3268905388103853, -0.10415631714399964, - 1.1429268477871695, + 1.1429268477871697, -0.1432234657032012, -0.35862780405053485, -0.14388918644154103, @@ -3031,7 +3032,7 @@ 0.033926654062884865, -0.1717591930199518, -0.08002830168577901, - 0.18199537844681402, + 0.181995378446814, 0.14905352069462907, -0.36032457153219255, -0.02019560310463575, @@ -3040,14 +3041,14 @@ -0.1434981065781571, -0.1131612727340574, -0.018915946167194164, - -0.19222989021326597, + -0.19222989021326595, -0.14453908065927124, -3.5487155446102996, -0.10683425015275816, -0.4795185937891304, -0.016462692522807743, 0.3151571437922627, - -0.09464758697424003, + -0.09464758697424004, 0.04825654408201885, -0.1415168497968331, -0.3743615593829155, @@ -3057,20 +3058,20 @@ -0.24583298182729507, -0.17684901992292978, -0.24833926737208145, - -0.24414014325938282, + -0.2441401432593828, 0.5013660261239998, -0.22797991648243965, -0.36835011525788985, -0.0786246852684016, -0.15092641435686716, - -0.19428192610801887, + -0.1942819261080189, -0.047451280168747445, - -0.22805643555030386, + -0.22805643555030383, -0.21546132228946036, -0.18881497280860415, -0.3458525088448603, -0.027257174815289886, - -0.10465193043398813, + -0.10465193043398811, -0.30264004978474546, -0.48934116478636014, -0.15424643524955428, @@ -3080,8 +3081,8 @@ -0.22702723911151068, -0.12286052066574982, 0.1173445289019206, - -0.42655720537257835, - -0.16169116246033965, + -0.4265572053725783, + -0.16169116246033963, -0.1366654858997265, -0.08218608899173319, -0.25315269680262276, @@ -3089,19 +3090,19 @@ 0.10729058703152816, -0.1848356397565709, -0.29773733888137954, - -0.19598783783188978, + -0.19598783783188975, -0.07718572732663986, -0.4915434596973256, -0.1593298524560609, 1.0130620728170072, - -0.9859901992296507, - -0.030429318993189014, + -0.9859901992296508, + -0.030429318993189017, -0.2955767901019897, -0.13146476489201575, 0.021958714567020365, -0.3660784894682081, -0.06568513960326428, - 0.24229373389328046, + 0.2422937338932805, -0.07417973338938211, -0.3188768365322048, 0.008299454248898996, @@ -3109,7 +3110,7 @@ -0.9093172887590022, -0.052819320392341496, -0.2061984668351755, - -0.11005813081312255, + -0.11005813081312256, 0.004984440888694763, -0.36648906635608114, -0.21024080418739288, @@ -3127,7 +3128,7 @@ -0.2269177174472361, -0.03881368081436776, -0.23077877933247493, - -0.11795458829029215, + -0.11795458829029216, -0.05325109588395094, -0.29577653743621113, 0.39278188037554074, @@ -3146,7 +3147,7 @@ 0.002365732852112501, -0.009720738845469867, -0.31197588913912, - -0.37901110741942645, + -0.3790111074194265, 0.5546697839777828, 0.15634435403148572, -0.2846402024807162, @@ -3157,7 +3158,7 @@ -0.17215983964914372, -0.120478029325362, -0.40389005108858456, - 0.009933481941860833, + 0.009933481941860832, -0.07287021794180859, -0.1014548187522415, -0.49746629452912217, @@ -3183,9 +3184,9 @@ 0.10926549077048264, -0.7030657452833431, -0.1192759915919197, - -0.12984613637809161, + -0.1298461363780916, -0.2802026319410693, - -0.0036621330456085843, + -0.003662133045608584, -0.1678257527702165, -0.20833156901090888, 0.22916940795452945, @@ -3215,17 +3216,17 @@ -0.3572124780468968, -0.4606253760209924, 0.29952938181209277, - -0.010220994729927213, + -0.010220994729927211, -0.2060181138731103, -0.48607895509723775, -0.3014446209991348, -0.1639270683145142, -0.12668943354304574, - -0.14036512668229761, - -0.20873933085550078, - -0.22784985661965607, + -0.1403651266822976, + -0.2087393308555008, + -0.2278498566196561, -0.25726749158173234, - 0.19208216701005654, + 0.19208216701005656, -0.32282993414057515, -0.4187321576949188, -0.5238291061669393, @@ -3246,37 +3247,37 @@ 0.015269491972453864, -0.2822057514583456, 0.27709192796866944, - -0.0076941863307062874, + -0.007694186330706288, -0.316800891406114, -0.03259115709406046, -0.24329511374912016, - -0.40397945759630005, + -0.4039794575963001, -0.744941344633606, -0.5289442539054647, -0.2749589440760616, -0.11951354401923808, -0.11878890954521992, -0.3300687522383754, - -0.09644927431484263, + -0.09644927431484264, -0.12730185466200794, -0.1198539138132908, -0.2118319989484725, -0.537329645177131, - -0.23548831357780386, + -0.23548831357780384, 0.17992790202198705, -0.11273548918971343, -0.1817010546155089, - 0.011494637861410695, + 0.011494637861410697, -0.3015552667449626, -0.9489722959074172, -0.1483978418466485, -0.17675917449829726, 0.0938631099273195, -0.2851721193788528, - 0.9062798105275007, + 0.9062798105275008, -0.17916682962504993, -0.4795383879180015, - -0.21878730588277406, + -0.2187873058827741, 0.025866878337815535, -0.20063902922397503, -0.18996840091592304, @@ -3298,12 +3299,12 @@ -0.07673792663312895, -0.2568263091260903, -0.15879268446582628, - -0.21129587265778582, + -0.21129587265778585, -0.4589009464623537, -0.23249705526510667, -0.22156875356682448, -0.3389209580853638, - 0.20935950683049498, + 0.20935950683049495, 0.3696985163099633, -0.331993764108482, -0.26097290896345626, @@ -3324,7 +3325,7 @@ -0.30862614747223915, -0.08737235301694923, -0.2502419937627032, - -0.23161307767790262, + -0.23161307767790265, 0.1993223134491231, -0.20398465688893452, -0.4661195230451227, @@ -3333,12 +3334,12 @@ -0.2098010534915069, -0.546518035075664, -0.15583469238612935, - -0.20894615976596498, + -0.20894615976596495, -0.18418021711886823, -0.09623502739882284, -0.4450371439859424, -0.30672541934011477, - -0.21542151443905766, + -0.2154215144390577, -0.5758555640874263, -0.40621626251735066, -0.17667268385976698, @@ -3355,30 +3356,30 @@ -0.2881769966233527, -0.1312468401207738, -0.3110140455666546, - -0.37016446472961917, + -0.3701644647296192, -0.18661581177925513, -0.11130514209525089, -0.4099639696055952, -0.17656863049914406, -0.16911839047081756, - -0.21573575526566557, + -0.21573575526566555, 0.16178652114450287, -0.12676047314726802, 0.023232876105652167, -0.006520744170234849, -0.2644667961853422, -0.30022871399947704, - 0.09122056486457453, - -0.20741528035723178, + 0.09122056486457451, + -0.20741528035723175, 0.3197603657696959, - -0.10161957446158709, + -0.10161957446158708, -0.20345309566207348, -0.47039824150154175, -0.11524900394820747, -0.19450442644031085, -0.09919682091327786, 0.5320934508451671, - -0.20373530139880458, + -0.20373530139880455, -0.18458995197127948, -0.1302015910663421, -0.45214093998264815, @@ -3390,13 +3391,13 @@ -0.4756648235172811, -0.5959856743327236, -0.0319891473146221, - -0.41790969029716507, - -0.10480465176972231, + -0.417909690297165, + -0.10480465176972233, -0.142815811415673, -0.17448990222221994, -0.18278547993985228, - 0.11311893197203915, - -0.19030235866603462, + 0.11311893197203916, + -0.19030235866603465, -0.2753778419137092, -0.2406139827097462, 0.2865473722935086, @@ -3418,7 +3419,7 @@ -0.05930458852889231, -0.23307481471688973, -0.3009006048749612, - 0.11182621018943095, + 0.11182621018943097, -0.4297097127089131, -0.49291753995194654, -0.28340210223099405, @@ -3436,14 +3437,14 @@ -0.13662635082092223, -0.12451496744875357, -0.31696958116913976, - -0.19180285211236026, + -0.19180285211236023, 0.30822271033119364, -0.1649172049045866, -0.1547613694421628, - 1.3516190426513361, + 1.351619042651336, -0.28324594244231704, -0.21299362761632423, - -0.12164879059825395, + -0.12164879059825397, -0.102296844764453, -0.15001983103237748, -0.09054741002566402, @@ -3467,15 +3468,15 @@ -0.22587616801283517, -0.22792006141085963, 0.12322954210419113, - 0.10950129305913947, + 0.10950129305913948, -0.07512511940626965, -0.6282376992187153, - -0.13423377800646819, + -0.1342337780064682, -0.2218353246293816, 0.08605660323620512, 0.060978996333204805, - -0.39720405203636844, - -0.13741899383503053, + -0.3972040520363685, + -0.1374189938350305, -0.1190705579562632, 0.03104514077479692, 0.04069600592910305, @@ -3487,15 +3488,15 @@ -0.5877169289206421, -0.2107858638276987, -0.2919845500260827, - -0.10757009685076113, - -0.010892569122386675, + -0.10757009685076112, + -0.010892569122386677, -0.290475864990686, -0.049264684721350704, -0.29775128371387893, -0.10846069437428696, - 0.11737691589247135, + 0.11737691589247136, -0.0661510773503089, - -0.10700665896039041, + -0.1070066589603904, -0.1785428520068706, -0.1975616782983458, -0.08155977286431693, @@ -3514,7 +3515,7 @@ -0.05067369452218884, -0.11071957299544266, -0.06400980114341692, - -0.22301611083749862, + -0.22301611083749864, -0.38284013373510106, -0.10546642240930026, -0.09038728286979492, @@ -3523,7 +3524,7 @@ -0.5428866314205649, 0.7189367594728395, 0.789278579552068, - -0.21728477067044594, + -0.2172847706704459, -0.08557005230799675, -0.1510131982738656, -0.21675591806122796, @@ -3535,7 +3536,7 @@ -0.25839195945515314, -0.13769768839587115, -0.08333018624838928, - 0.10994602269228437, + 0.10994602269228436, -0.013477849021580113, 0.30112817729394337, -0.4515838366678331, @@ -3546,7 +3547,7 @@ -0.4334463706611196, -0.15599003618885376, 0.03991261454980233, - -0.16992895424062127, + -0.1699289542406213, -0.25712269394552933, -0.3242984856396056, 0.10084746048396198, @@ -3556,7 +3557,7 @@ -0.11955185702591464, 0.4596412018160443, -0.34837450269261083, - -0.09191200752155737, + -0.09191200752155736, -0.19963448923852312, 0.037750983966940765, 0.1303362592296935, @@ -3569,12 +3570,12 @@ -0.22067563922193756, -0.2638049488264862, -0.18317734496315552, - -0.030844987697204118, + -0.03084498769720412, 0.06504931492888133, -0.3865710977267156, 0.02389934164184737, -0.3669712577352122, - -0.13392925498489205, + -0.13392925498489203, -0.3150168704855645, -1.1833693311056024, -0.15776083051142464, @@ -3593,18 +3594,18 @@ -0.12344063777077352, -0.16161405728327694, -0.36019220098453886, - -0.36762037654820645, + -0.3676203765482065, -0.0955804538498981, -0.1434723517060732, -0.2846638931242076, -0.4024121641685703, - 0.21888649979812058, + 0.21888649979812055, -0.2409849598921312, -0.10321731115350374, -0.08922365039187952, -0.596195924667029, - -0.40314163426166516, - 0.060522033353613836, + -0.4031416342616651, + 0.06052203335361384, -0.23459955827827983, -0.344340107900603, -0.2540604509114246, @@ -3622,7 +3623,7 @@ -0.06865135664471822, -0.3948127554779397, -0.04459224004154194, - -0.19146521918418458, + -0.19146521918418455, -0.16927584365892656, -0.07126355531415385, 0.01504792348346129, @@ -3641,7 +3642,7 @@ -0.32867665828421977, -0.33442029293988895, -0.4512816090876477, - -0.010335798057329981, + -0.01033579805732998, -0.3876789196130339, -0.3983189929439206, -0.0670388075012518, @@ -3650,8 +3651,8 @@ 0.05067128950902955, -0.07890388692677774, -0.4783926608761817, - -0.20828343969298402, - -0.36995583956049316, + -0.208283439692984, + -0.3699558395604931, -0.07483086884341361, -0.174033676846161, -0.2297861096799778, @@ -3660,27 +3661,27 @@ 0.04868923937847924, 0.07554047332457259, -0.2845617858916043, - -0.24418583812171946, + -0.24418583812171943, -0.12446242603085622, -0.2295078150400549, -0.2923394577668432, -0.02868226293423959, -0.10225957637640803, -0.2797636591925503, - 0.11148329147072289, + 0.11148329147072288, -0.3662339870772833, -0.4991143166369838, -0.34163035722445656, -0.2562534364209128, -0.0878889280794084, - -0.39112346109753915, - -0.37273234558108115, + -0.3911234610975391, + -0.3727323455810811, -0.16455735245791914, -0.43520516892803585, -0.12458569242286188, -0.3711534034620776, -0.20091309357451337, - -0.15365899388685023, + -0.15365899388685025, -0.1841317900312731, -0.1885016608151382, -0.2631173393697672, @@ -3694,13 +3695,13 @@ 0.04074965049236212, 0.00035830819062354635, -0.8267096390815389, - -0.10556758294669777, + -0.10556758294669775, 0.15424573054097124, - -0.19204419525352634, - -0.46952855132440163, + -0.1920441952535263, + -0.4695285513244016, 0.9533890381007808, -0.2899962311302886, - -0.24824494140883147, + -0.2482449414088315, 0.3061769314896523, 1.0637979982388934, -0.11139892615492286, @@ -3714,19 +3715,19 @@ -0.2774150609983721, -0.2599513870625749, -0.5083960318001566, - -0.22675251952908582, - 0.23984780149719498, + -0.22675251952908584, + 0.23984780149719495, -0.12763379215144255, -1.356135819271021, -0.2057310406375059, -0.29181365948786464, -0.10114885615947244, - -0.19152443709156586, + -0.19152443709156583, -0.22948354141477623, -0.152501571981972, -0.08347441742872164, 0.031170030760282685, - -0.21909186264680613, + -0.2190918626468061, -0.08471522753403704, -0.07066355522837497, -0.28806712168508497, @@ -3766,7 +3767,7 @@ 1.3693705525627275, 0.04400085411106545, 0.02384087621886024, - 1.5430954343710281, + 1.543095434371028, 2.3341668705257157, 2.1994917925086983, 2.114912575342879, @@ -3776,12 +3777,12 @@ 0.22457801483064405, 3.341262356783983, 1.7282514955144892, - 0.9675995668249205, + 0.9675995668249204, 1.5515494439560082, 2.6041370482453883, 0.0711271088910535, 1.8406185824474872, - 1.9909708195771358, + 1.990970819577136, 1.5790845505658433, 1.2133053362321344, 0.880580776172882, @@ -3793,9 +3794,9 @@ 2.7511685496427636, 0.7726539910324397, 0.8399456119087928, - 1.6233788660745125, + 1.6233788660745123, 1.63990385874623, - 1.9083755916135319, + 1.908375591613532, 2.4502415497393866, 1.0887514266079057, 1.3409767426129415, @@ -3807,17 +3808,17 @@ 0.28487041257921186, 2.2295758617326547, 0.7048393771296154, - 1.7731873167999275, + 1.7731873167999277, 0.6473479176372623, 2.3845155787045846, 0.5536673492286343, - 0.09045375178223483, + 0.09045375178223485, 1.583341361340467, 0.04706099857658561, 1.7776934394342574, 0.2267439197632942, 3.2903903425259196, - 2.4759497657113774, + 2.475949765711378, 1.0170116446744275, 0.6855120283267475, 0.8375621303398667, @@ -3826,7 +3827,7 @@ 4.494010380643039, 3.760957621684614, 2.9445894065776814, - 1.9897280487455906, + 1.9897280487455904, 3.7786872159245384, 0.3207713695398054, 0.4749080604687462, @@ -3847,7 +3848,7 @@ 0.23873001585796136, 1.8326616459090737, 1.0073358650226467, - 1.2372591995030777, + 1.2372591995030775, 3.2310418181963017, 0.6933381577482766, 4.362929469985763, @@ -3884,11 +3885,11 @@ 2.1189639708530983, 1.8401198598258297, 2.915302747604021, - 1.6287056936632693, + 1.6287056936632691, 1.6512198861766978, - 1.6116383235972083, + 1.6116383235972085, 1.3251398260532146, - 1.9094208035922053, + 1.9094208035922051, 3.5343436364891545, 4.225419344476545, 1.554037367213989, @@ -3938,7 +3939,7 @@ 0.13886721154710235, 0.965815062150651, 1.221800025288568, - 0.22960261032010382, + 0.22960261032010384, 1.473563916731634, 0.2687249570215108, 0.05579962601224675, @@ -3958,13 +3959,13 @@ 2.1857485192974933, 0.3647353343453791, 1.6764305772215278, - 1.8985997094754261, + 1.898599709475426, 0.1475130201839737, 2.0025154935363365, 0.4603527067555622, 0.041253333722478726, 1.564313077436711, - 0.9047499378476681, + 0.904749937847668, 2.4793620509140997, 1.77778667370143, 2.0771658101727812, @@ -4011,9 +4012,9 @@ 3.087634693495328, 0.9601195712340322, 1.198295314166336, - 0.9831011203978245, + 0.9831011203978244, 3.389327135741941, - 0.9405978274469701, + 0.94059782744697, 2.439245382042326, 0.3295056430530915, 0.030088289541211705, @@ -4022,7 +4023,7 @@ 1.1317106478052403, 2.914735675228885, 3.571243963000618, - 3.7396489477301933, + 3.7396489477301937, 0.892386087636055, 0.641264740790568, 0.6862715534682898, @@ -4048,11 +4049,11 @@ 0.8019762012594812, 0.08979541982515363, 2.270490137655977, - 1.0213285026532595, + 1.0213285026532597, 0.3949270517565374, 1.6181484298819448, 0.4366811677135841, - 1.3680800297736677, + 1.3680800297736675, 1.2362760527215282, 1.474688395119688, 1.016735100982176, @@ -4062,7 +4063,7 @@ 2.077646588289039, 0.7142698013070701, 1.6935548628707708, - 0.9580730313318291, + 0.9580730313318292, 3.0786409080727317, 1.150510687151595, 0.8975558062039668, @@ -4070,13 +4071,13 @@ 0.14929911016697794, 0.7602806846729203, 1.3856285139787612, - 1.1478374699304439, + 1.147837469930444, 0.6885067072852773, 1.781759198511485, 0.10609799247168068, 0.02772933514839367, - 1.9489677029355215, - 2.3722565396420046, + 1.9489677029355217, + 2.372256539642005, 0.02048195436174201, 2.4732186652497976, 0.144293804328343, @@ -4084,7 +4085,7 @@ 1.5506968357912716, 3.279381873480292, 1.6711552197829138, - 1.8430573596281365, + 1.8430573596281363, 0.26174125425920863, 1.026442920930038, 1.6220025659690946, @@ -4096,7 +4097,7 @@ 1.5611074242816192, 0.8279203079861159, 1.025792435973067, - 1.8410002569598283, + 1.8410002569598285, 0.08506009130891658, 4.273444117240567, 1.8527088541299344, @@ -4118,17 +4119,17 @@ 0.2115349045863839, 2.4885656217886427, 1.1371761815280077, - 0.46771677623800356, + 0.4677167762380035, 1.2685507100800062, 0.25996482158398543, 0.8990081519985822, 1.5326362293640694, 1.8418262049118472, - 1.0172681749094379, + 1.017268174909438, 0.058045502195471874, 0.4784311062610049, 2.2152250133942335, - 1.8833197196827423, + 1.8833197196827425, 1.7483428045806313, 2.6063186126050293, 2.526796504061849, @@ -4141,13 +4142,13 @@ 1.0177598609469884, 1.475703799166044, 1.7632407303434607, - 1.4434808082219401, + 1.44348080822194, 2.027012038337096, 0.2571674475347406, 2.034366947596445, 0.3920185029572083, 0.3201931208838413, - 1.4088924554647715, + 1.4088924554647717, 1.834139386320618, 1.5691054359151897, 3.12627026160098, @@ -4158,14 +4159,14 @@ 0.893809630104279, 0.2910252167912844, 2.269412008292607, - 1.4625839899614395, - 1.4872105484225617, + 1.4625839899614397, + 1.4872105484225615, 2.22061015003756, 1.240598267329638, - 1.9446879750119586, + 1.9446879750119583, 1.0911528679909746, 2.131880730732978, - 0.13874035295503861, + 0.1387403529550386, 1.475345034613331, 1.2742949306656837, 2.1648705632498433, @@ -4178,7 +4179,7 @@ 0.8307969624335433, 0.6731163508452589, 1.8345601928439876, - 1.3185879358095647, + 1.318587935809565, 1.4327799016723932, 2.063886098436303, 1.2907623158361672, @@ -4186,7 +4187,7 @@ 1.5819172628193536, 0.7029411544983922, 1.5566737601289584, - 3.5086468789030962, + 3.508646878903096, 1.190506615397934, 0.31901024329357747, 0.6674918701777263, @@ -4213,8 +4214,8 @@ 2.688650180037503, 1.8258112210103776, 1.4855594123984208, - 0.10978382129731219, - 1.4686689867441973, + 0.1097838212973122, + 1.468668986744197, 1.6602064962019725, 2.591674715163256, 1.3917269312660954, @@ -4234,7 +4235,7 @@ 0.7965854864405422, 0.5913860176815622, 0.5637281909048096, - 1.5184834947504657, + 1.5184834947504655, 0.2542158431346257, 1.9468039365456584, 2.0991283824624687, @@ -4248,7 +4249,7 @@ 0.17229790800172573, 0.5429480329036573, 0.7622669317002914, - 2.5532446974976106, + 2.55324469749761, 0.6790289792359718, 3.1995316425692386, 2.999146872138599, @@ -4300,7 +4301,7 @@ 0.269850473523652, 0.6664635397130172, 0.4808421387585614, - 1.0497783664070235, + 1.0497783664070237, 0.40653794592833614, 1.2431335736156894, 0.45415882682457814, @@ -4313,7 +4314,7 @@ 0.2154721745576943, 0.9253242443966414, 1.1148221760836832, - 1.0490415240573425, + 1.0490415240573423, 0.030791900400482287, 0.8647028125022551, 4.3133758659211585, @@ -4321,9 +4322,9 @@ 0.23536836205950287, 0.02346651949821833, 1.7178648666008387, - 0.48692097362248116, + 0.4869209736224811, 2.185287622007031, - 1.8928610932558094, + 1.8928610932558096, 0.553668197122209, 0.18871968993908203, 0.20285462048407035, @@ -4331,11 +4332,11 @@ 2.404934367135037, 2.687440345742475, 1.223734394525414, - 1.4953521450789067, + 1.495352145078907, 0.737860028287191, 2.541292037646264, 2.350181051750591, - 1.5267394714737539, + 1.526739471473754, 0.994283496181897, 0.6827731997484898, 0.009491817601318855, @@ -4344,11 +4345,11 @@ 0.6922337698347553, 0.5156191575358935, 1.1499465467919858, - 0.19480119144195218, + 0.19480119144195215, 1.6215165493070918, 2.123569627822102, 0.37026942394101825, - 0.42349044512183276, + 0.4234904451218328, 0.4071751175504122, 0.693258699231916, 2.731449846803155, @@ -4377,12 +4378,12 @@ 1.5041848113955714, 1.3913009943121002, 0.1871295030935077, - 1.4034018457461725, + 1.4034018457461723, 2.7338387907409447, 1.841717791330024, 0.3925730909519981, 1.5324338844906218, - 1.2044466376137901, + 1.20444663761379, 0.08051217302556256, 0.5578372339518515, 1.3806769296698445, @@ -4392,20 +4393,20 @@ 0.14564267802745182, 0.15047942890860733, 0.14515108635225238, - 3.3365120991361246, - 1.5829441841949061, + 3.336512099136125, + 1.582944184194906, 0.6140629434560458, 4.253052138209942, 2.042834505298378, 1.7362410335910765, 1.5423968934404282, 1.6310629131243326, - 0.20651570695826282, + 0.2065157069582628, 0.21985988850191968, 1.270541030394008, 0.08061497833892035, 2.3768310639432237, - 1.9274912830967106, + 1.9274912830967104, 2.191913525403656, 3.067865059266511, 1.5731185467666626, @@ -4423,10 +4424,10 @@ 2.659171799344398, 1.7448398858702634, 0.5283709705095866, - 1.8527235965693702, + 1.8527235965693705, 2.933879049885868, 0.23428336326530225, - 1.2949143558855987, + 1.2949143558855989, 2.679445340073318, 0.6888673411303065, 0.2736821583293024, @@ -4434,7 +4435,7 @@ 2.088366809874686, 0.7812137097933034, 2.050399995447707, - 1.8001901634418487, + 1.800190163441849, 0.5049764235054831, 1.6012282845056842, 3.077691801993157, @@ -4443,12 +4444,12 @@ 0.7624370363114068, 1.611361611055505, 2.9720547101703554, - 0.42652169579173677, + 0.4265216957917368, 0.19212964774745048, 0.5070038280200106, 0.9862253876443146, 2.3833488152759443, - 1.1084252605501705, + 1.1084252605501703, 1.049034631040109, 0.6429506012797653, 1.7502854536157202, @@ -4465,14 +4466,14 @@ 0.24361854150545809, 0.992554358928099, 0.5893186894314197, - 1.0370965825824385, + 1.0370965825824383, 1.4294630053615884, 1.9998286180694451, 0.1447109174095764, 3.2191026334690496, 1.6964033318910567, 2.5331786577949296, - 0.09902281198965429, + 0.09902281198965428, 1.2906288628013345, 0.891451748833514, 0.1732653682773481, @@ -4480,7 +4481,7 @@ 2.084425867981239, 0.2758556813686608, 0.4178050377863811, - 1.8946691524660382, + 1.8946691524660384, 1.7897517103528595, 3.984184559766896, 0.4334305368029198, @@ -4488,7 +4489,7 @@ 1.5608943579988948, 0.8020844068376642, 0.36149431408879856, - 0.38500426365383156, + 0.3850042636538315, 1.1377249718464564, 1.885792689712628, 0.8138681855443072, @@ -4499,7 +4500,7 @@ 0.4978341204926043, 1.5621754204647171, 0.17503857313995605, - 0.9969638870747679, + 0.996963887074768, 2.576730398509976, 0.579280315575145, 1.2353006954277237, @@ -4508,13 +4509,13 @@ 1.2524366048160096, 0.7405920039959077, 2.5040833417810746, - 1.6590543543299099, + 1.65905435432991, 2.068966548848126, - 1.9613602170429913, + 1.9613602170429911, 1.3145323256994972, - 1.3345853052995083, + 1.3345853052995085, 0.7470442023252043, - 1.5564598968903183, + 1.5564598968903185, 0.15010492236674997, 0.7129913600657714, 0.6465830133386465, @@ -4522,10 +4523,10 @@ 1.1334273989751134, 2.3019139575984355, 1.8581400905436425, - 0.40713840596861156, - 0.0009850997101449055, + 0.4071384059686115, + 0.0009850997101449057, 2.925587279921627, - 0.9304924343366805, + 0.9304924343366804, 0.6168497427174666, 0.6480077211730428, 0.5269598552038441, @@ -4549,7 +4550,7 @@ 0.5003798387266699, 0.7242032938296608, 4.0668457774600135, - 1.5106008910122835, + 1.5106008910122837, 3.5571283943529113, 0.1457844116907847, 1.4666657389796676, @@ -4567,8 +4568,8 @@ 0.841323011382395, 0.35996649070445397, 0.8548150955037863, - 1.2396151015556713, - 1.8131753673470314, + 1.2396151015556711, + 1.8131753673470312, 1.2353204649161795, 0.19380631363205464, 1.374057913098775, @@ -4582,7 +4583,7 @@ 0.1747048639753512, 2.806823941103335, 0.6980586300799491, - 1.8560598437774922, + 1.856059843777492, 2.3972427744982427, 1.1596090799323724, 2.4463009852632047 @@ -5525,9 +5526,9 @@ " min_fc=min_fc,\n", " alpha=alpha,\n", " draw_line=draw_line,\n", - " perm=perm, \n", + " perm=perm,\n", " fdr=fdr,\n", - " color_list=color_list\n", + " color_list=color_list,\n", ")\n", "volcano_plot" ] @@ -5633,10 +5634,10 @@ " min_fc=min_fc,\n", " alpha=alpha,\n", " draw_line=draw_line,\n", - " perm=perm, \n", + " perm=perm,\n", " fdr=fdr,\n", - " color_list=color_list, \n", - " compare_preprocessing_modes=True\n", + " color_list=color_list,\n", + " compare_preprocessing_modes=True,\n", ")" ] }, @@ -5657,50 +5658,49 @@ } ], "source": [ - "from sklearn.metrics._ranking import roc_curve\n", - "from sklearn.metrics._ranking import auc\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", - "sns.set_palette('Set1', n_colors=12)\n", + "from sklearn.metrics._ranking import auc, roc_curve\n", "\n", - "def get_plot_from_predictions(y_true, y_pred,name, color=None):\n", - " fpr, tpr, _ = roc_curve(y_true, y_pred,)\n", - " roc_auc = auc(fpr, tpr)\n", - " plot = plt.plot(\n", - " fpr, \n", - " tpr, \n", - " label=\"{}, AUC={:.3f}\".format(name, roc_auc)\n", + "sns.set_palette(\"Set1\", n_colors=12)\n", + "\n", + "\n", + "def get_plot_from_predictions(y_true, y_pred, name, color=None):\n", + " fpr, tpr, _ = roc_curve(\n", + " y_true,\n", + " y_pred,\n", " )\n", - " return plot \n", + " roc_auc = auc(fpr, tpr)\n", + " plot = plt.plot(fpr, tpr, label=\"{}, AUC={:.3f}\".format(name, roc_auc))\n", + " return plot\n", + "\n", "\n", "for result in results:\n", " res = result.plot.plotting_data\n", - " res['TP'] = res['Majority protein IDs'].str.contains('UPS')\n", - " res['FP'] = ~res['Majority protein IDs'].str.contains('UPS')\n", + " res[\"TP\"] = res[\"Majority protein IDs\"].str.contains(\"UPS\")\n", + " res[\"FP\"] = ~res[\"Majority protein IDs\"].str.contains(\"UPS\")\n", " res.replace([np.inf, -np.inf], np.nan, inplace=True)\n", - " resna = res[~res['pval'].isna()]\n", - " resna = res[~res['tval'].isna()]\n", - " \n", + " resna = res[~res[\"pval\"].isna()]\n", + " resna = res[~res[\"tval\"].isna()]\n", + "\n", " norm_meth = result.plot.preprocessing[\"Normalization\"]\n", " imp_meth = result.plot.preprocessing[\"Imputation\"]\n", " preprocessing_mode = f\"Normalization: {norm_meth}, Imputation: {imp_meth}\"\n", - " \n", - " probs = resna['pval']\n", + "\n", + " probs = resna[\"pval\"]\n", " probs = -probs\n", - " \n", + "\n", " plot = get_plot_from_predictions(\n", - " y_true = resna['TP'],\n", - " y_pred = probs,\n", - " name = preprocessing_mode\n", + " y_true=resna[\"TP\"], y_pred=probs, name=preprocessing_mode\n", " )\n", - " \n", + "\n", "plt.plot([0, 1], [0, 1], \"k--\", label=\"chance level (AUC = 0.5)\")\n", "plt.axis(\"square\")\n", "plt.xlabel(\"False Positive Rate\")\n", "plt.ylabel(\"True Positive Rate\")\n", - "plt.title('pval')\n", + "plt.title(\"pval\")\n", "plt.legend(bbox_to_anchor=(1.04, 1), loc=\"upper left\")\n", - "plt.show() " + "plt.show()" ] }, { diff --git a/pyproject.toml b/pyproject.toml index af671d70..5dd7e60b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [tool.ruff] extend-exclude = [".bumpversion.cfg", ".secrets.baseline"] -# [tool.ruff.lint] -# select = [ + [tool.ruff.lint] + select = [ # # pycodestyle # "E", # # Pyflakes @@ -13,9 +13,9 @@ extend-exclude = [".bumpversion.cfg", ".secrets.baseline"] # "B", # # flake8-simplify # "SIM", -# # isort -# "I", -# ] + # isort + "I", + ] # ignore = [ # "E501", # Line too long (ruff wraps code, but not docstrings) diff --git a/release/pyinstaller/alphastats_pyinstaller.py b/release/pyinstaller/alphastats_pyinstaller.py index 00163c24..1be7c73a 100644 --- a/release/pyinstaller/alphastats_pyinstaller.py +++ b/release/pyinstaller/alphastats_pyinstaller.py @@ -1,8 +1,9 @@ if __name__ == "__main__": try: - import alphastats import multiprocessing + import alphastats + multiprocessing.freeze_support() except ModuleNotFoundError: diff --git a/requirements_dev.txt b/requirements_dev.txt index 387d0c39..b32a93d0 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -2,6 +2,6 @@ coverage==7.2.2 jupyter==1.1.1 nbmake==1.5.4 -pre-commit==3.5.0 +pre-commit==3.5.0 # TODO this is the last version supported for python 3.8 pytest==8.3.2 pytest-cov==5.0.0 diff --git a/setup.py b/setup.py index 797f8451..ad2d1e35 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ # builtin -import setuptools -import re import os +import re + +import setuptools # local # info has to be imported individually or sidepacakges will already be installed diff --git a/tests/gui/conftest.py b/tests/gui/conftest.py index 0ed80355..0ed23323 100644 --- a/tests/gui/conftest.py +++ b/tests/gui/conftest.py @@ -1,8 +1,10 @@ -from streamlit.testing.v1 import AppTest -from alphastats.load_data import load_data +from io import BytesIO from pathlib import Path + +from streamlit.testing.v1 import AppTest + from alphastats.DataSet import DataSet -from io import BytesIO +from alphastats.load_data import load_data # TODO: Turn the helpers into fixtures diff --git a/tests/gui/test_02_import_data.py b/tests/gui/test_02_import_data.py index d768f531..94174b41 100644 --- a/tests/gui/test_02_import_data.py +++ b/tests/gui/test_02_import_data.py @@ -1,8 +1,11 @@ -from streamlit.testing.v1 import AppTest from unittest.mock import MagicMock, patch -from .conftest import APP_FOLDER, data_buf, metadata_buf + +from streamlit.testing.v1 import AppTest + from alphastats.gui.utils.ui_helper import StateKeys +from .conftest import APP_FOLDER, data_buf, metadata_buf + TESTED_PAGE = f"{APP_FOLDER}/pages/02_Import Data.py" diff --git a/tests/gui/test_03_data_overview.py b/tests/gui/test_03_data_overview.py index c3c3416a..3a9f6db7 100644 --- a/tests/gui/test_03_data_overview.py +++ b/tests/gui/test_03_data_overview.py @@ -1,7 +1,9 @@ from streamlit.testing.v1 import AppTest -from .conftest import create_dataset_alphapept, APP_FOLDER + from alphastats.gui.utils.ui_helper import StateKeys +from .conftest import APP_FOLDER, create_dataset_alphapept + TESTED_PAGE = f"{APP_FOLDER}/pages/03_Data Overview.py" diff --git a/tests/gui/test_04_preprocessing.py b/tests/gui/test_04_preprocessing.py index 71c1e0ed..347352d4 100644 --- a/tests/gui/test_04_preprocessing.py +++ b/tests/gui/test_04_preprocessing.py @@ -1,10 +1,12 @@ -from streamlit.testing.v1 import AppTest from pathlib import Path -from .conftest import create_dataset_alphapept, APP_FOLDER + +from streamlit.testing.v1 import AppTest from alphastats.DataSet import DataSet -from alphastats.load_data import load_data from alphastats.gui.utils.ui_helper import StateKeys +from alphastats.load_data import load_data + +from .conftest import APP_FOLDER, create_dataset_alphapept TESTED_PAGE = f"{APP_FOLDER}/pages/03_Preprocessing.py" diff --git a/tests/test_DataSet.py b/tests/test_DataSet.py index ede7479d..cae9499f 100644 --- a/tests/test_DataSet.py +++ b/tests/test_DataSet.py @@ -1,27 +1,27 @@ +import copy +import logging +import os +import shutil import unittest +from contextlib import contextmanager from unittest import skip from unittest.mock import patch -import logging + import numpy as np import pandas as pd import plotly -from contextlib import contextmanager -import shutil -import os -import copy +from alphastats.DataSet import DataSet +from alphastats.dataset_factory import DataSetFactory from alphastats.DataSet_Preprocess import PreprocessingStateKeys -from alphastats.loader.DIANNLoader import DIANNLoader -from alphastats.loader.MaxQuantLoader import MaxQuantLoader +from alphastats.gui.utils.ui_helper import StateKeys from alphastats.loader.AlphaPeptLoader import AlphaPeptLoader +from alphastats.loader.DIANNLoader import DIANNLoader from alphastats.loader.FragPipeLoader import FragPipeLoader -from alphastats.loader.SpectronautLoader import SpectronautLoader from alphastats.loader.GenericLoader import GenericLoader -from alphastats.DataSet import DataSet - +from alphastats.loader.MaxQuantLoader import MaxQuantLoader +from alphastats.loader.SpectronautLoader import SpectronautLoader from alphastats.utils import LoaderError -from alphastats.dataset_factory import DataSetFactory -from alphastats.gui.utils.ui_helper import StateKeys logger = logging.getLogger(__name__) diff --git a/tests/test_DataSet_Pathway.py b/tests/test_DataSet_Pathway.py index 3eb6a9b5..1125f861 100644 --- a/tests/test_DataSet_Pathway.py +++ b/tests/test_DataSet_Pathway.py @@ -1,10 +1,11 @@ import unittest -import pandas as pd + import numpy as np +import pandas as pd +from alphastats.DataSet import DataSet from alphastats.DataSet_Pathway import Enrichment from alphastats.loader.MaxQuantLoader import MaxQuantLoader -from alphastats.DataSet import DataSet class BaseTestDataSet: diff --git a/tests/test_gpt.py b/tests/test_gpt.py index 4d1e415a..d3a8e3f5 100644 --- a/tests/test_gpt.py +++ b/tests/test_gpt.py @@ -1,15 +1,13 @@ import logging - import unittest -from unittest.mock import patch, MagicMock - +from unittest.mock import MagicMock, patch import streamlit as st -from alphastats.gui.utils.uniprot_utils import get_uniprot_data, extract_data -from alphastats.loader.MaxQuantLoader import MaxQuantLoader from alphastats.DataSet import DataSet from alphastats.gui.utils.ui_helper import StateKeys +from alphastats.gui.utils.uniprot_utils import extract_data, get_uniprot_data +from alphastats.loader.MaxQuantLoader import MaxQuantLoader if StateKeys.GENE_TO_PROT_ID not in st.session_state: st.session_state[StateKeys.GENE_TO_PROT_ID] = {} diff --git a/tests/test_loaders.py b/tests/test_loaders.py index 4143b98d..ccaa97b2 100644 --- a/tests/test_loaders.py +++ b/tests/test_loaders.py @@ -1,21 +1,20 @@ +import copy +import logging +import os +import shutil import unittest +from contextlib import contextmanager from unittest import skip - -import pandas as pd from unittest.mock import patch -import logging -import shutil -import os -import copy +import pandas as pd -from alphastats.loader.DIANNLoader import DIANNLoader -from alphastats.loader.MaxQuantLoader import MaxQuantLoader from alphastats.loader.AlphaPeptLoader import AlphaPeptLoader +from alphastats.loader.DIANNLoader import DIANNLoader from alphastats.loader.FragPipeLoader import FragPipeLoader -from alphastats.loader.SpectronautLoader import SpectronautLoader +from alphastats.loader.MaxQuantLoader import MaxQuantLoader from alphastats.loader.mzTabLoader import mzTabLoader -from contextlib import contextmanager +from alphastats.loader.SpectronautLoader import SpectronautLoader logger = logging.getLogger(__name__)