Skip to content

Commit

Permalink
Merge pull request #100 from wilhelm-lab/release/0.4.3
Browse files Browse the repository at this point in the history
Release/0.4.3
  • Loading branch information
picciama authored Apr 27, 2024
2 parents 7e09b3e + c6f6a42 commit 25dc1fd
Show file tree
Hide file tree
Showing 34 changed files with 9,153 additions and 1,254 deletions.
2 changes: 1 addition & 1 deletion .cookietemple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ full_name: Mario Picciani
email: mario.picciani@tum.de
project_name: spectrum_io
project_short_description: IO related functionalities for oktoberfest.
version: 0.4.2
version: 0.4.3
license: MIT
4 changes: 2 additions & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name-template: "0.4.2 🌈" # <<COOKIETEMPLE_FORCE_BUMP>>
tag-template: 0.4.2 # <<COOKIETEMPLE_FORCE_BUMP>>
name-template: "0.4.3 🌈" # <<COOKIETEMPLE_FORCE_BUMP>>
tag-template: 0.4.3 # <<COOKIETEMPLE_FORCE_BUMP>>
exclude-labels:
- "skip-changelog"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
python: [3.8, 3.9]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Check out source-code repository

- name: Setup Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2.3.3
uses: actions/checkout@v4

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v4.1.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Check out source-code repository

- name: Setup Python
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2.3.4
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand All @@ -29,7 +29,7 @@ jobs:
poetry build --ansi
- name: Publish package on PyPI
uses: pypa/gh-action-pypi-publish@v1.6.4
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
# TODO COOKIETEMPLE: Configure your PyPI Token to enable automatic deployment to PyPi on releases
# https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_cookietemple_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Check out source-code repository

- name: Setup Python
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

steps:
- name: Check out the repository
uses: actions/checkout@v2.3.4
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
print("::set-output name=result::{}".format(result))
- name: Restore pre-commit cache
uses: actions/cache@v3.2.4
uses: actions/cache@v4.0.2
if: matrix.session == 'pre-commit'
with:
path: ~/.cache/pre-commit
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
needs: tests
steps:
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install cookietemple
run: pip install cookietemple

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.CT_SYNC_TOKEN }}"
Expand Down
2 changes: 1 addition & 1 deletion cookietemple.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.2
current_version = 0.4.3

[bumpversion_files_whitelisted]
init_file = spectrum_io/__init__.py
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
# the built documents.
#
# The short X.Y version.
version = "0.4.2"
version = "0.4.3"
# The full version, including alpha/beta/rc tags.
release = "0.4.2"
release = "0.4.3"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def precommit(session: Session) -> None:
"flake8",
"flake8-bandit",
"flake8-bugbear",
"darglint",
"flake8-docstrings",
"flake8-rst-docstrings",
"isort",
Expand Down
1,942 changes: 883 additions & 1,059 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "spectrum_io"
version = "0.4.2" # <<COOKIETEMPLE_FORCE_BUMP>>
version = "0.4.3" # <<COOKIETEMPLE_FORCE_BUMP>>
description = "IO related functionalities for oktoberfest."
authors = ["Wilhelmlab at Technical University of Munich"]
license = "MIT"
Expand Down Expand Up @@ -29,8 +29,7 @@ h5py = "^3.1.0"
pymzml = "^2.5.0"
pyteomics = "^4.3.3"
lxml= '^4.5.2'
tables = "^3.6.1"
spectrum-fundamentals = ">=0.5.0,<0.6.0"
spectrum-fundamentals = ">=0.5.2,<0.6.0"
alphatims = "^1.0.8"
sortedcontainers = "^2.4.0"

Expand Down
53 changes: 42 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
click>=8.0.0
rich>=10.3.0
PyYAML>=5.4.1
numpy>=1.18.1
pandas>=1.3.0
h5py>=3.1.0
pymzml>=2.5.0
pyteomics>=4.3.3
lxml>=4.5.2
tables>=3.6.1
spectrum-fundamentals>=0.3.0
alphatims==1.0.8 ; python_version >= "3.8" and python_full_version < "3.11.0"
click==8.1.7 ; python_version >= "3.8" and python_full_version < "3.11.0"
colorama==0.4.6 ; python_version >= "3.8" and python_full_version < "3.11.0" and platform_system == "Windows"
contourpy==1.1.1 ; python_version >= "3.8" and python_full_version < "3.11.0"
cycler==0.12.1 ; python_version >= "3.8" and python_full_version < "3.11.0"
fonttools==4.51.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
h5py==3.11.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
importlib-metadata==7.1.0 ; python_version >= "3.8" and python_version < "3.9"
importlib-resources==6.4.0 ; python_version >= "3.8" and python_version < "3.10"
joblib==1.4.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
kiwisolver==1.4.5 ; python_version >= "3.8" and python_full_version < "3.11.0"
llvmlite==0.41.1 ; python_version >= "3.8" and python_full_version < "3.11.0"
lxml==4.9.4 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
markdown-it-py==3.0.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
matplotlib==3.7.5 ; python_version >= "3.8" and python_full_version < "3.11.0"
mdurl==0.1.2 ; python_version >= "3.8" and python_full_version < "3.11.0"
moepy==1.1.4 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
numba==0.58.1 ; python_version >= "3.8" and python_full_version < "3.11.0"
numpy==1.24.4 ; python_version >= "3.8" and python_full_version < "3.11.0"
packaging==24.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
pandas==1.5.3 ; python_version >= "3.8" and python_full_version < "3.11.0"
pillow==10.3.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
psutil==5.9.8 ; python_version >= "3.8" and python_full_version < "3.11.0"
pygments==2.17.2 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
pymzml==2.5.9 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
pyparsing==3.1.2 ; python_version >= "3.8" and python_full_version < "3.11.0"
pyteomics==4.7.2 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_full_version < "3.11.0"
pytz==2024.1 ; python_version >= "3.8" and python_full_version < "3.11.0"
pyyaml==6.0.1 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
pyzstd==0.15.10 ; python_version >= "3.8" and python_full_version < "3.11.0"
regex==2024.4.16 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
rich==13.7.1 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
scikit-learn==1.3.2 ; python_version >= "3.8" and python_full_version < "3.11.0"
scipy==1.10.1 ; python_version >= "3.8" and python_full_version < "3.11.0"
six==1.16.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
sortedcontainers==2.4.0 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
spectrum-fundamentals==0.5.2 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
threadpoolctl==3.4.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
tqdm==4.66.2 ; python_version >= "3.8" and python_full_version < "3.11.0"
typing-extensions==4.11.0 ; python_version >= "3.8" and python_version < "3.9"
zipp==3.18.1 ; python_version >= "3.8" and python_version < "3.10"
2 changes: 1 addition & 1 deletion spectrum_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = "Mario Picciani"
__email__ = "mario.picciani@tum.de"
__version__ = "0.4.2"
__version__ = "0.4.3"

import logging
import logging.handlers
Expand Down
2 changes: 1 addition & 1 deletion spectrum_io/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


@click.command()
@click.version_option(version="0.4.2", message=click.style("spectrum_io Version: 0.4.2"))
@click.version_option(version="0.4.3", message=click.style("spectrum_io Version: 0.4.3"))
def main() -> None:
"""spectrum_io."""

Expand Down
3 changes: 3 additions & 0 deletions spectrum_io/d/bruker.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def read_timstof(hdf_file: Path, scan_to_precursor_map: pd.DataFrame) -> pd.Data
)
df.columns = ["FRAME", "SCAN", "PRECURSOR", "RETENTION_TIME", "INV_ION_MOBILITY", "MZ", "INTENSITIES"]

# converting RETENTION TIME from seconds to minutes
df["RETENTION_TIME"] = df["RETENTION_TIME"].div(60)

# aggregation
df_combined_grouped = (
df.merge(
Expand Down
1 change: 1 addition & 0 deletions spectrum_io/search_result/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
from .maxquant import MaxQuant
from .msfragger import MSFragger
from .sage import Sage
from .xisearch import Xisearch
21 changes: 9 additions & 12 deletions spectrum_io/search_result/sage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def read_result(self, tmt_labeled: str = "") -> pd.DataFrame:
:param tmt_labeled: tmt label as str
:return: pd.DataFrame with the formatted data
"""
logger.info("Reading msms.tsv file")
logger.info(f"Reading {self.path}")
df = pd.read_csv(
self.path,
usecols=["filename", "scannr", "peptide", "charge", "hyperscore", "calcmass", "proteins"],
usecols=["filename", "scannr", "peptide", "charge", "hyperscore", "calcmass", "label", "proteins"],
sep="\t",
)
logger.info("Finished reading msms.tsv file")
logger.info(f"Finished reading {self.path}")

# Standardize column names
df.columns = df.columns.str.upper()
Expand All @@ -51,6 +51,9 @@ def update_columns_for_prosit(df: pd.DataFrame, tmt_labeled: str) -> pd.DataFram
"SCANNR": "SCAN_NUMBER",
"PEPTIDE": "MODIFIED_SEQUENCE",
"CHARGE": "PRECURSOR_CHARGE",
"CALCMASS": "MASS",
"HYPERSCORE": "SCORE",
"LABEL": "REVERSE",
}
)

Expand All @@ -59,18 +62,12 @@ def update_columns_for_prosit(df: pd.DataFrame, tmt_labeled: str) -> pd.DataFram
# extracting only the scan number
df["SCAN_NUMBER"] = [int(x.rsplit("=", 1)[-1]) for x in df["SCAN_NUMBER"]]
# creating a column of decoys and targets
df["REVERSE"] = df["PROTEINS"].str.startswith("rev_")
df["REVERSE"] = df["REVERSE"] < 0
# removing modification to create the unmodified sequences
df["SEQUENCE"] = df["MODIFIED_SEQUENCE"].str.replace(r"\[.*?\]", "", regex=True)
df["SEQUENCE"] = df["MODIFIED_SEQUENCE"].str.replace(r"\-|\[.*?\]", "", regex=True)
# length of the peptide
df["PEPTIDE_LENGTH"] = df["SEQUENCE"].str.len()
# mass of the peptide
df["MASS"] = df["CALCMASS"]
# score of the peptide
df["SCORE"] = df["HYPERSCORE"]
# converting proforma to unimode
print(df)
# converting sage to unimod
df["MODIFIED_SEQUENCE"] = sage_to_internal(df["MODIFIED_SEQUENCE"])

print(df.columns)
return df
6 changes: 5 additions & 1 deletion spectrum_io/search_result/search_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def __init__(self, path: Union[str, Path]):

@abstractmethod
def read_result(self, tmt_labeled: str):
"""Read result."""
"""Read result.
:param tmt_labeled: tmt label as str
"""
raise NotImplementedError

def generate_internal(self, tmt_labeled: str, out_path: Optional[Union[str, Path]] = None) -> pd.DataFrame:
Expand Down
Loading

0 comments on commit 25dc1fd

Please sign in to comment.