Skip to content

Commit

Permalink
Merge branch 'development' into main_to_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
boopthesnoot authored Jun 11, 2024
2 parents cabbe2b + a4144fe commit 992e8e5
Show file tree
Hide file tree
Showing 82 changed files with 33,903 additions and 32,050 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ current_version = 0.6.7
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
serialize =
{major}.{minor}.{patch}-{release}{build}
{major}.{minor}.{patch}

Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ updates:
interval: "weekly"
target-branch: "developer"
labels:
- "pip dependencies"
- "pip dependencies"
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python


name: CI
name: Build and run tests


on: [push, pull_request]
# push:
# branches: [ "main", "developer"]
# pull_request:
# branches: [ "main", "developer"]
on:
push:
branches: [ main, development ]
pull_request:

jobs:
build:

pre-commit:
name: Run all pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
build-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -34,7 +37,7 @@ jobs:
pip install dictdiffer
- name: Test installation
run: |
pip install -e.
pip install -e .
- name: Run tests
run: |
coverage run -m unittest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ alphastats.egg-info
_build
build
dist
.coverage
.coverage
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.0
hooks:
- id: ruff-format
# - id: ruff
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ sphinx:
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: docs/requirements_docs.txt
- requirements: docs/requirements_docs.txt
6 changes: 2 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ message: "If you use this software, please cite both the article from preferred-
authors:
- family-names: Krismer
given-names: Elena
orcid:
orcid:
title: "AlphaPeptStats: an open-source Python package for automated and scalable statistical analysis of mass spectrometry-based proteomics "
version: 0.6.5
doi: "10.1093/bioinformatics/btad461"
Expand All @@ -17,13 +17,11 @@ preferred-citation:
- family-names: Bludau
given-names: Isabell
- family-names: Strauss
given-names: Maximilian T.
given-names: Maximilian T.
- family-names: Mann
given-names: Matthias
title: "AlphaPeptStats: an open-source Python package for automated and scalable statistical analysis of mass spectrometry-based proteomics"
type: article
year: 2023
doi: "10.1093/bioinformatics/btad461"
journal: "Bioinformatics"


2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

WORKDIR "/app/alphastats/gui"

ENTRYPOINT ["streamlit", "run", "AlphaPeptStats.py", "--server.port=8501", "--server.address=0.0.0.0"]
ENTRYPOINT ["streamlit", "run", "AlphaPeptStats.py", "--server.port=8501", "--server.address=0.0.0.0"]
21 changes: 3 additions & 18 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# 0.6.3
* ENH download metadata template in the GUI
* ENH multicova analysis
* ENH filter data completeness `dataset.preprocess(data_completeness=0.7)`
* ENH filter data completeness `dataset.preprocess(data_completeness=0.7)`
* ADD `GenericLoader` for not supported data formats

# 0.6.2
Expand Down Expand Up @@ -46,7 +46,7 @@

# 0.5.0
* ADD plot Sample Distribution Histogram
* ADD paired-ttest option
* ADD paired-ttest option
* ENH add option to remove samples in GUI
* ADD pyComBat Batch correction Behdenna A, Haziza J, Azencot CA and Nordor A. (2020) pyComBat, a Python tool for batch effects correction in high-throughput molecular data using empirical Bayes methods. bioRxiv doi: 10.1101/2020.03.17.995431
* remove iteration utilities, remove C++ dependency
Expand All @@ -71,7 +71,7 @@
* ADD functionionality `dataset.reset_preprocessing()` to reset all preprocessing steps

# 0.4.0
* SAM implementation from Isabel (MultiCova)
* SAM implementation from Isabel (MultiCova)
* Volcano Plot with permutation based FDR line
* Bug fix when reseting matrix and saving info

Expand Down Expand Up @@ -133,18 +133,3 @@
* remove dependency for Microsoft Visual Studio C++ (dash_bio) (Windows PCs)
* clustermap with seaborn, adding bar labels is possible
* save plotting data, preprocessing, method in figure object (accessible using figure.plotting_data, figure.method, figure.preprocessing)















32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,28 @@ An open-source Python package for downstream mass spectrometry downstream data a
## Citation
Publication: [AlphaPeptStats: an open-source Python package for automated and scalable statistical analysis of mass spectrometry-based proteomics](https://doi.org/10.1093/bioinformatics/btad461)
> **Citation:** <br>
> Krismer, E., Bludau, I., Strauss M. & Mann M. (2023). AlphaPeptStats: an open-source Python package for automated and scalable statistical analysis of mass spectrometry-based proteomics. Bioinformatics
> Krismer, E., Bludau, I., Strauss M. & Mann M. (2023). AlphaPeptStats: an open-source Python package for automated and scalable statistical analysis of mass spectrometry-based proteomics. Bioinformatics
> https://doi.org/10.1093/bioinformatics/btad461
---
## Installation

AlphaPeptStats can be used as
* python library (pip-installation), or
* Graphical User Interface (either pip-installation or one-click installer).
AlphaPeptStats can be used as
* python library (pip-installation), or
* Graphical User Interface (either pip-installation or one-click installer).

Further we provide a Dockerimage for the GUI.

### Pip Installation

AlphaStats can be installed in an existing Python 3.8/3.9/3.10 environment with a single `bash` command.
AlphaStats can be installed in an existing Python 3.8/3.9/3.10 environment with a single `bash` command.

```bash
pip install alphastats
```

In case you want to use the Graphical User Interface, use following command in the command line:

```bash
alphastats gui
```
Expand Down Expand Up @@ -116,6 +116,24 @@ AlphaStats was developed by the [Mann Group at the University of Copenhagen](htt

If you like this software, you can give us a [star](https://github.com/MannLabs/alphapeptstats/stargazers) to boost our visibility! All direct contributions are also welcome. Feel free to post a new [issue](https://github.com/MannLabs/alphapeptstats/issues) or clone the repository and create a [pull request](https://github.com/MannLabs/alphapeptstats/pulls) with a new branch. For an even more interactive participation, check out the [discussions](https://github.com/MannLabs/alphapeptstats/discussions) and the [the Contributors License Agreement](misc/CLA.md).


### Notes for developers
#### pre-commit hooks
It is highly recommended to use the provided pre-commit hooks, as the CI pipeline enforces all checks therein to
pass in order to merge a branch.

The hooks need to be installed once by
```bash
pip install -r requirements_dev.txt
pre-commit install
```
You can run the checks yourself using:
```bash
pre-commit run --all-files
```



---
## Changelog

Expand Down
18 changes: 10 additions & 8 deletions alphastats/DataSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,19 @@ def __init__(self, loader, metadata_path=None, sample_column=None):
self.create_matrix()
self._check_matrix_values()
self.metadata = None

if metadata_path is not None:
self.sample = sample_column
self.load_metadata(file_path=metadata_path)
self._remove_misc_samples_in_metadata()

else:
self._create_metadata()

if self.loader == "Generic":
intensity_column = loader._extract_sample_names(metadata=self.metadata, sample_column=self.sample)
intensity_column = loader._extract_sample_names(
metadata=self.metadata, sample_column=self.sample
)
self.intensity_column = intensity_column

# save preprocessing settings
Expand All @@ -104,7 +106,6 @@ def _check_loader(self, loader):
loader : loader
"""
if not isinstance(

loader,
(
AlphaPeptLoader,
Expand All @@ -113,9 +114,8 @@ def _check_loader(self, loader):
FragPipeLoader,
SpectronautLoader,
GenericLoader,
mzTabLoader
mzTabLoader,
),

):
raise LoaderError(
"loader must be from class: AlphaPeptLoader, MaxQuantLoader, DIANNLoader, FragPipeLoader or SpectronautLoader"
Expand Down Expand Up @@ -158,12 +158,14 @@ def create_matrix(self):
df = df.set_index(self.index_column)

if isinstance(self.intensity_column, str):
regex_find_intensity_columns = self.intensity_column.replace("[sample]", ".*")
regex_find_intensity_columns = self.intensity_column.replace(
"[sample]", ".*"
)
df = df.filter(regex=(regex_find_intensity_columns), axis=1)
# remove Intensity so only sample names remain
substring_to_remove = regex_find_intensity_columns.replace(".*", "")
df.columns = df.columns.str.replace(substring_to_remove, "")

else:
df = df[self.intensity_column]
# transpose dataframe
Expand Down
1 change: 0 additions & 1 deletion alphastats/DataSet_Pathway.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _extract_protein_ids(entry):
return protein_id_concentate

def _get_ptm_proteins(self, sample=None):

if self.evidence_df is None:
raise ValueError(
"No informations about PTMs."
Expand Down
47 changes: 27 additions & 20 deletions alphastats/DataSet_Plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,21 @@ def plot_umap(self, group: str = None, circle: bool = False):
)
return dimensionality_reduction.plot


@ignore_warning(RuntimeWarning)
def plot_volcano(
self,
group1: Union[str, list],
group2: Union[str, list],
column:str=None,
method:str="ttest",
labels:bool=False,
min_fc:float=1.0,
alpha:float=0.05,
draw_line:bool=True,
perm:int=100,
fdr:float=0.05,
compare_preprocessing_modes:bool=False,
color_list:list=[]
column: str = None,
method: str = "ttest",
labels: bool = False,
min_fc: float = 1.0,
alpha: float = 0.05,
draw_line: bool = True,
perm: int = 100,
fdr: float = 0.05,
compare_preprocessing_modes: bool = False,
color_list: list = [],
):
"""Plot Volcano Plot
Expand Down Expand Up @@ -178,9 +177,9 @@ def plot_volcano(
min_fc=min_fc,
alpha=alpha,
draw_line=draw_line,
perm=perm,
perm=perm,
fdr=fdr,
color_list=color_list
color_list=color_list,
)

return volcano_plot.plot
Expand Down Expand Up @@ -221,14 +220,22 @@ def plot_sampledistribution(
df = df.merge(self.metadata, how="inner", on=[self.sample])

if method == "violin":
fig = px.violin(df, x=self.sample, y="Intensity", color=color,
template="simple_white+alphastats_colors"
)
fig = px.violin(
df,
x=self.sample,
y="Intensity",
color=color,
template="simple_white+alphastats_colors",
)

elif method == "box":
fig = px.box(df, x=self.sample, y="Intensity", color=color,
template="simple_white+alphastats_colors"
)
fig = px.box(
df,
x=self.sample,
y="Intensity",
color=color,
template="simple_white+alphastats_colors",
)

else:
raise ValueError(
Expand Down Expand Up @@ -390,7 +397,7 @@ def plot_imputed_values(self):
color="Imputation",
opacity=0.8,
hover_data=plot_df.columns,
template="simple_white+alphastats_colors"
template="simple_white+alphastats_colors",
)

pass
2 changes: 1 addition & 1 deletion alphastats/DataSet_Preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sklearn.impute
import streamlit as st

from sklearn.experimental import enable_iterative_imputer #noqa
from sklearn.experimental import enable_iterative_imputer # noqa
from alphastats.utils import ignore_warning


Expand Down
Loading

0 comments on commit 992e8e5

Please sign in to comment.