Skip to content

Commit

Permalink
Merge branch 'development' into feature/ptm_model_support
Browse files Browse the repository at this point in the history
  • Loading branch information
picciama committed Apr 16, 2024
2 parents 25a3d84 + 3aa6f8a commit 67fdc4c
Show file tree
Hide file tree
Showing 20 changed files with 1,115 additions and 750 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: Victor Giurcoiu
email: victor.giurcoiu@tum.de
project_name: spectrum_fundamentals
project_short_description: Fundamentals public repo
version: 0.5.0
version: 0.5.1
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.5.0 🌈" # <<COOKIETEMPLE_FORCE_BUMP>>
tag-template: 0.5.0 # <<COOKIETEMPLE_FORCE_BUMP>>
name-template: "0.5.1 🌈" # <<COOKIETEMPLE_FORCE_BUMP>>
tag-template: 0.5.1 # <<COOKIETEMPLE_FORCE_BUMP>>
exclude-labels:
- "skip-changelog"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
uses: actions/checkout@v2.3.3

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v3.1.1
uses: crazy-max/ghaction-github-labeler@v5.0.0
with:
skip-delete: true
4 changes: 2 additions & 2 deletions .github/workflows/main_master_branch_protection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
# NOTE - this may not work if the PR is coming from a fork, due to limitations in GitHub actions secrets
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@v1
uses: mshick/add-pr-comment@v2
with:
message: |
Hi @${{ github.event.pull_request.user.login }},
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
# NOTE - this may not work if the PR is coming from a fork, due to limitations in GitHub actions secrets
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@v1
uses: mshick/add-pr-comment@v2
with:
message: |
Hi @${{ github.event.pull_request.user.login }},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
print("::set-output name=result::{}".format(result))
- name: Restore pre-commit cache
uses: actions/cache@v2.1.7
uses: actions/cache@v4.0.2
if: matrix.session == 'pre-commit'
with:
path: ~/.cache/pre-commit
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.5.0
current_version = 0.5.1

[bumpversion_files_whitelisted]
init_file = spectrum_fundamentals/__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 @@ -54,9 +54,9 @@
# the built documents.
#
# The short X.Y version.
version = "0.5.0"
version = "0.5.1"
# The full version, including alpha/beta/rc tags.
release = "0.5.0"
release = "0.5.1"

# 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
@@ -1,4 +1,5 @@
"""Nox sessions."""

import os
import shlex
import shutil
Expand Down
1,532 changes: 882 additions & 650 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "spectrum_fundamentals"
version = "0.5.0" # <<COOKIETEMPLE_FORCE_BUMP>>
version = "0.5.1" # <<COOKIETEMPLE_FORCE_BUMP>>
description = "Fundamental functions, annotation pipeline and constants for oktoberfest"
authors = ["Wilhelmlab at Technical University of Munich"]
license = "MIT"
Expand Down
37 changes: 29 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
click>=8.0.0
rich>=10.3.0
PyYAML>=5.4.1
numpy>=1.24.1
pandas>=1.3.0
scikit-learn>=1.0
joblib>=1.0.1
moepy>=1.1.4
click==8.1.7 ; python_full_version >= "3.8.0" and python_full_version < "3.11.0"
colorama==0.4.6 ; python_full_version >= "3.8.0" 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"
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"
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"
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"
pygments==2.17.2 ; 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"
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"
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"
threadpoolctl==3.4.0 ; python_version >= "3.8" and python_full_version < "3.11.0"
tqdm==4.66.2 ; python_full_version >= "3.8.0" 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"
3 changes: 2 additions & 1 deletion spectrum_fundamentals/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Initialize fundamentals."""

__author__ = "Mario Picciani"
__email__ = "mario.picciani@tum.de"
__version__ = "0.5.0"
__version__ = "0.5.1"

import logging
import logging.handlers
Expand Down
2 changes: 1 addition & 1 deletion spectrum_fundamentals/__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.5.0", message=click.style("spectrum_fundamentals Version: 0.5.0"))
@click.version_option(version="0.5.1", message=click.style("spectrum_fundamentals Version: 0.5.1"))
def main() -> None:
"""spectrum_fundamentals."""

Expand Down
2 changes: 1 addition & 1 deletion spectrum_fundamentals/charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def indices_to_one_hot(labels: Union[int, List[int], np.ndarray], classes: Optio
f"Type of labels not understood. Only int, List[int] and np.ndarray are supported. Given: {type(labels)}."
)

max_label = labels.max()
max_label = int(labels.max())
if classes is None:
classes = max_label
if max_label > classes:
Expand Down
99 changes: 54 additions & 45 deletions spectrum_fundamentals/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@
"n[214]": "[UNIMOD:214]-",
}

#######################
# Xisearch constants #
#######################

XISEARCH_VAR_MODS = {
"ox": "[UNIMOD:35]",
"cm": "[UNIMOD:4]",
"dsso": "[UNIMOD:1896]",
"dsbu": "[UNIMOD:1884]",
}

####################
# MASS CALCULATION #
####################
Expand Down Expand Up @@ -162,51 +173,49 @@
"[UNIMOD:730]": 304.205360, # iTRAQ8
"[UNIMOD:259]": 8.014199, # SILAC Lysine
"[UNIMOD:267]": 10.008269, # SILAC Arginine

"[]":0.0,
"[UNIMOD:1]" :42.010565, #Acetylation
"[UNIMOD:122]" :27.994915, #Formylation
"[UNIMOD:1289]" :70.041865, #Butyrylation
"[UNIMOD:1363]" :68.026215, #Crotonylation
"[UNIMOD:1848]" :114.031694, #Glutarylation
"[UNIMOD:1914]" :-32.008456, #Oxidation and then loss of oxidized M side chain
"[UNIMOD:2]" :-0.984016, #Amidation
"[UNIMOD:21]" :79.966331, #Phosphorylation
"[UNIMOD:213]" :541.06111, #ADP-ribosylation
"[UNIMOD:23]" :-18.010565, #Water Loss
"[UNIMOD:24]" :71.037114, #Propionamidation
"[UNIMOD:354]" :44.985078, #Nitrosylation
"[UNIMOD:28]" :-17.026549, #Glu to PyroGlu
"[UNIMOD:280]" :28.0313, #Ethylation
"[UNIMOD:299]" :43.989829, #Carboxylation
"[UNIMOD:3]" :226.077598, #Biotinylation
"[UNIMOD:34]" :14.01565, #Methylation
"[UNIMOD:345]" :47.984744, #Trioxidation
"[UNIMOD:35]" :15.994915, #Hydroxylation
"[UNIMOD:35]" :15.994915, #Oxidation
"[UNIMOD:351]" :3.994915, #Oxidation to Kynurenine
"[UNIMOD:36]" :28.0313, #Dimethylation
"[UNIMOD:360]" :-30.010565, #Pyrrolidinone
"[UNIMOD:368]" :-33.987721, #Dehydroalanine
"[UNIMOD:37]" :42.04695, #Trimethylation
"[UNIMOD:385]" :-17.026549, #Ammonia loss
"[UNIMOD:392]" :29.974179, #Quinone
"[UNIMOD:4]" :57.021464, #Carbamidomethyl
"[UNIMOD:40]" :79.956815, #Sulfonation
"[UNIMOD:401]" :-2.01565, #Didehydro
"[UNIMOD:425]" :31.989829, #Dioxidation
"[UNIMOD:43]" :203.079373, #HexNAc
"[UNIMOD:44]" :204.187801, #Farnesylation
"[UNIMOD:447]" :-15.994915, #Reduction
"[UNIMOD:46]" :229.014009, #Pyridoxal phosphate
"[UNIMOD:47]" :238.229666, #Palmitoylation
"[UNIMOD:5]" :43.005814, #Carbamyl
"[UNIMOD:58]" :56.026215, #Propionylation
"[UNIMOD:6]" :58.005479, #Carboxymethylation
"[UNIMOD:64]" :100.016044, #Succinylation
"[UNIMOD:7]" :0.984016, #Deamidation
"[UNIMOD:747]" :86.000394, #Malonylation

"[]": 0.0,
"[UNIMOD:1]": 42.010565, # Acetylation
"[UNIMOD:122]": 27.994915, # Formylation
"[UNIMOD:1289]": 70.041865, # Butyrylation
"[UNIMOD:1363]": 68.026215, # Crotonylation
"[UNIMOD:1848]": 114.031694, # Glutarylation
"[UNIMOD:1914]": -32.008456, # Oxidation and then loss of oxidized M side chain
"[UNIMOD:2]": -0.984016, # Amidation
"[UNIMOD:21]": 79.966331, # Phosphorylation
"[UNIMOD:213]": 541.06111, # ADP-ribosylation
"[UNIMOD:23]": -18.010565, # Water Loss
"[UNIMOD:24]": 71.037114, # Propionamidation
"[UNIMOD:354]": 44.985078, # Nitrosylation
"[UNIMOD:28]": -17.026549, # Glu to PyroGlu
"[UNIMOD:280]": 28.0313, # Ethylation
"[UNIMOD:299]": 43.989829, # Carboxylation
"[UNIMOD:3]": 226.077598, # Biotinylation
"[UNIMOD:34]": 14.01565, # Methylation
"[UNIMOD:345]": 47.984744, # Trioxidation
"[UNIMOD:35]": 15.994915, # Hydroxylation
"[UNIMOD:35]": 15.994915, # Oxidation
"[UNIMOD:351]": 3.994915, # Oxidation to Kynurenine
"[UNIMOD:36]": 28.0313, # Dimethylation
"[UNIMOD:360]": -30.010565, # Pyrrolidinone
"[UNIMOD:368]": -33.987721, # Dehydroalanine
"[UNIMOD:37]": 42.04695, # Trimethylation
"[UNIMOD:385]": -17.026549, # Ammonia loss
"[UNIMOD:392]": 29.974179, # Quinone
"[UNIMOD:4]": 57.021464, # Carbamidomethyl
"[UNIMOD:40]": 79.956815, # Sulfonation
"[UNIMOD:401]": -2.01565, # Didehydro
"[UNIMOD:425]": 31.989829, # Dioxidation
"[UNIMOD:43]": 203.079373, # HexNAc
"[UNIMOD:44]": 204.187801, # Farnesylation
"[UNIMOD:447]": -15.994915, # Reduction
"[UNIMOD:46]": 229.014009, # Pyridoxal phosphate
"[UNIMOD:47]": 238.229666, # Palmitoylation
"[UNIMOD:5]": 43.005814, # Carbamyl
"[UNIMOD:58]": 56.026215, # Propionylation
"[UNIMOD:6]": 58.005479, # Carboxymethylation
"[UNIMOD:64]": 100.016044, # Succinylation
"[UNIMOD:7]": 0.984016, # Deamidation
"[UNIMOD:747]": 86.000394, # Malonylation
#
}
MOD_MASSES_SAGE = {
Expand Down
4 changes: 1 addition & 3 deletions spectrum_fundamentals/metrics/fragments_ratio.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FragmentsRatio(Metric):

@staticmethod
def count_with_ion_mask(
boolean_array: scipy.sparse.csr_matrix, ion_mask: Optional[Union[np.ndarray, scipy.sparse.csr_matrix]] = None
boolean_array: scipy.sparse.csr_matrix, ion_mask: Optional[Union[np.ndarray, scipy.sparse.spmatrix]] = None
) -> np.ndarray:
"""
Count the number of ions.
Expand All @@ -43,8 +43,6 @@ def count_with_ion_mask(
:return: number of observed/predicted peaks not masked by ion_mask
"""
if ion_mask is None:
ion_mask = []
if len(ion_mask) == 0:
ion_mask = scipy.sparse.csr_matrix(np.ones((174, 1)))
else:
ion_mask = scipy.sparse.csr_matrix(ion_mask).T
Expand Down
Loading

0 comments on commit 67fdc4c

Please sign in to comment.