Skip to content

Commit

Permalink
Merge pull request #334 from MannLabs/linitin-rule-I
Browse files Browse the repository at this point in the history
Linitin rule i
  • Loading branch information
mschwoer authored Sep 20, 2024
2 parents 629b03c + 7f9d794 commit 5d31b4b
Show file tree
Hide file tree
Showing 60 changed files with 541 additions and 513 deletions.
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 7 additions & 9 deletions alphastats/DataSet.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
9 changes: 5 additions & 4 deletions alphastats/DataSet_Pathway.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
14 changes: 7 additions & 7 deletions alphastats/DataSet_Plot.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
3 changes: 1 addition & 2 deletions alphastats/DataSet_Preprocess.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import logging
from typing import Tuple, Dict, List, Union
from typing import Dict, List, Tuple, Union

import numpy as np
import pandas as pd
import sklearn
import sklearn.ensemble
import sklearn.impute
import streamlit as st

from sklearn.experimental import enable_iterative_imputer # noqa

from alphastats.utils import ignore_warning
Expand Down
14 changes: 7 additions & 7 deletions alphastats/DataSet_Statistics.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
5 changes: 3 additions & 2 deletions alphastats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions alphastats/dataset_factory.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions alphastats/gui/AlphaPeptStats.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
1 change: 1 addition & 0 deletions alphastats/gui/gui.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys

from streamlit.web import cli as stcli


Expand Down
17 changes: 8 additions & 9 deletions alphastats/gui/pages/02_Import Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand Down
6 changes: 3 additions & 3 deletions alphastats/gui/pages/03_Data Overview.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
13 changes: 6 additions & 7 deletions alphastats/gui/pages/03_Preprocessing.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
20 changes: 10 additions & 10 deletions alphastats/gui/pages/04_Analysis.py
Original file line number Diff line number Diff line change
@@ -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,
)


Expand Down
13 changes: 7 additions & 6 deletions alphastats/gui/pages/05_LLM.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
11 changes: 6 additions & 5 deletions alphastats/gui/pages/06_Results.py
Original file line number Diff line number Diff line change
@@ -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,
)


Expand Down
5 changes: 3 additions & 2 deletions alphastats/gui/utils/analysis_helper.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
6 changes: 2 additions & 4 deletions alphastats/gui/utils/enrichment_analysis.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 5 additions & 5 deletions alphastats/gui/utils/gpt_helper.py
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]" # Always provide your email address when using NCBI services.

Expand Down
Loading

0 comments on commit 5d31b4b

Please sign in to comment.