Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #59

Merged
merged 66 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
76e02ff
added loess regression module
GeorgWa Sep 27, 2022
3d768d9
add nbdev export, nbdev_prepare
GeorgWa Sep 27, 2022
a5ee67a
fixed extrapolation bug
GeorgWa Sep 27, 2022
77449a8
updated docstrings
GeorgWa Sep 27, 2022
157aaa3
close #42 improved edge case handling and testing
GeorgWa Sep 28, 2022
07035b7
Merge pull request #41 from MannLabs/loess_regression
jalew188 Sep 29, 2022
2f91919
sklearn in req
jalew188 Oct 4, 2022
a262165
percolator
jalew188 Oct 10, 2022
d4fa4b3
percolator
jalew188 Oct 10, 2022
5f06b3c
updated weight function
GeorgWa Oct 12, 2022
b653eca
FE:update_features
jalew188 Oct 12, 2022
34e3296
Merge pull request #44 from MannLabs/loess_weight_fix
jalew188 Oct 12, 2022
b0e9101
add min_precursor_num_to_run_mp
jalew188 Oct 12, 2022
93aa2fa
move translate.py from AlphaPeptDeep
jalew188 Oct 13, 2022
388b875
Merge branch 'translate_tsv' into development
jalew188 Oct 13, 2022
0c3e662
docs from scoring
jalew188 Oct 13, 2022
6fc8e64
add modification mapping
jalew188 Oct 19, 2022
5833dfb
rename precursor isotopes
jalew188 Oct 21, 2022
534d8ae
added fragment handling functionality
GeorgWa Nov 4, 2022
48eeee3
rescore
jalew188 Nov 4, 2022
33227ab
add util function to fragments
GeorgWa Nov 29, 2022
c34c32d
Merge pull request #51 from MannLabs/scoring
jalew188 Dec 7, 2022
c62b49f
minor _quarto.yml
jalew188 Dec 7, 2022
227e7a8
GeorgW Diann decoy fix
jalew188 Dec 7, 2022
0d35efd
Merge pull request #47 from MannLabs/dev_gw
jalew188 Dec 8, 2022
036d269
lib_reader
jalew188 Dec 8, 2022
3152b1a
Merge branch 'development' of https://github.com/MannLabs/alphabase i…
jalew188 Dec 8, 2022
4de6336
Merge branch 'development' into flat_lib
jalew188 Dec 8, 2022
9132091
flatten fragments
jalew188 Dec 8, 2022
13b98e5
Use ASCII code for flat frag type
jalew188 Dec 9, 2022
d5362b1
FlatSpecLib for AlphaDIA
jalew188 Dec 9, 2022
fd1df87
charge=int8
jalew188 Dec 9, 2022
38539a7
add some docs
jalew188 Dec 9, 2022
46db6ab
custom columns when flatten
jalew188 Dec 9, 2022
2c6cbe3
nbdev_clean
jalew188 Dec 11, 2022
dfb4693
Merge pull request #54 from MannLabs/GeorgW_decoy_fix
jalew188 Dec 12, 2022
405e59f
tsv lib reader: noloss=''
jalew188 Dec 12, 2022
f369b74
Merge branch 'flat_lib' of https://github.com/MannLabs/alphabase into…
jalew188 Dec 12, 2022
b069066
Merge pull request #53 from MannLabs/flat_lib
jalew188 Dec 14, 2022
c8e83dc
rename all from nbdev to sphinx
jalew188 Dec 14, 2022
e3e7ba8
done for sphix, TODO more docs
jalew188 Dec 15, 2022
180e3a6
added fragment annotation to SpecLibBase
GeorgWa Dec 15, 2022
81f452c
FIX: circular reference to SpecLibBase
GeorgWa Dec 16, 2022
8d20948
add sphinx_doc folder
jalew188 Dec 16, 2022
5372055
test readthedocs
jalew188 Dec 16, 2022
9bebcb6
test readthedocs
jalew188 Dec 16, 2022
a8365b7
sphinx_docs->docs
jalew188 Dec 16, 2022
5db4332
test readthedocs
jalew188 Dec 16, 2022
55bdf61
address sphinx format issues
jalew188 Dec 16, 2022
ad50f7e
renaming dirs
jalew188 Dec 19, 2022
175b97f
move all nbdev to sphinx
jalew188 Dec 21, 2022
5bd3bc3
Bump version: 0.2.0 → 0.2.1
jalew188 Dec 21, 2022
a0c0c9f
merge sphinx-doc
GeorgWa Dec 21, 2022
31394f5
moved functions to .py
GeorgWa Dec 21, 2022
dcdb27a
more example nbs
jalew188 Dec 21, 2022
c311dbe
Merge pull request #57 from MannLabs/reannotate-fragments
jalew188 Dec 21, 2022
6d968ac
nbdev_clean for PR #57
jalew188 Dec 21, 2022
087dbf1
Merge pull request #56 from MannLabs/sphinx_doc
jalew188 Dec 22, 2022
c9dca18
add nbdev_test to github actions
jalew188 Dec 22, 2022
e23f9c3
nbdev -U to nbdev2 on github
jalew188 Dec 22, 2022
2a7bd8d
nbdev_test
jalew188 Dec 22, 2022
a790432
add regex as reguirements
jalew188 Dec 22, 2022
62bdc7d
DONE: nbdev_test as unit_tests
jalew188 Dec 22, 2022
946a213
rm msf pepxml nbs tests
jalew188 Dec 22, 2022
f8cbdfc
refine test nbs
jalew188 Dec 22, 2022
e6bb2f5
Merge pull request #58 from MannLabs/unit_tests
jalew188 Dec 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.0
current_version = 0.2.1
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand All @@ -15,6 +15,8 @@ serialize =

[bumpversion:file:./settings.ini]

[bumpversion:file:./docs/conf.py]

[bumpversion:file:./release/one_click_linux_gui/control]

[bumpversion:file:./release/one_click_linux_gui/create_installer_linux.sh]
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/pip_installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ jobs:
- name: Unittests
shell: bash -l {0}
run: |
cd tests
. ./run_tests.sh
conda activate alphabase
nbdev_test
conda deactivate
loose_installation:
name: Test loose pip installation on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -56,5 +57,6 @@ jobs:
- name: Unittests
shell: bash -l {0}
run: |
cd tests
. ./run_tests.sh
conda activate alphabase
nbdev_test
conda deactivate
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/build/

# PyBuilder
target/
Expand Down Expand Up @@ -138,7 +139,7 @@ alphabase/logs

# nbdev2
*.gitattributes
*_docs*
_docs*
# *_quarto.yml
# *sidebar.yml
*_proc*
Expand Down
27 changes: 27 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF
formats: all

conda:
environment: misc/conda_dev_env.yaml

# # Optionally set the version of Python and requirements required to build your docs
# python:
# version: 3.8
# install:
# - requirements: requirements/requirements.txt
# - method: pip
# path: .
# extra_requirements:
# - plotting
# - development
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,13 @@ please see [GitHub Pages](https://mannlabs.github.io/alphabase/)

## About

An open-source Python package of the AlphaPept ecosystem from the [Mann
Labs at the Max Planck Institute of
Biochemistry](https://www.biochem.mpg.de/mann) and the [University of
Copenhagen](https://www.cpr.ku.dk/research/proteomics/mann/). It
provides basic functionalities for AlphaPept ecosystem.
The infrastructure package of AlphaX ecosystem for MS proteomics.

------------------------------------------------------------------------

## License

AlphaBase was developed by the [Mann Labs at the Max Planck Institute of
Biochemistry](https://www.biochem.mpg.de/mann) and the [University of
Copenhagen](https://www.cpr.ku.dk/research/proteomics/mann/) and is
AlphaBase was developed by the [Mann Labs at the Max Planck Institute of Biochemistry](https://www.biochem.mpg.de/mann) and the [University of Copenhagen](https://www.cpr.ku.dk/research/proteomics/mann/) and is
freely available with an [Apache License](LICENSE.txt). External Python
packages (available in the [requirements](requirements) folder) have
their own licenses, which can be consulted on their respective websites.
Expand Down
2 changes: 1 addition & 1 deletion alphabase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


__project__ = "alphabase"
__version__ = "0.2.0"
__version__ = "0.2.1"
__license__ = "Apache"
__description__ = "An open-source Python package of the AlphaPept ecosystem"
__author__ = "Mann Labs"
Expand Down
484 changes: 3 additions & 481 deletions alphabase/_modidx.py

Large diffs are not rendered by default.

22 changes: 6 additions & 16 deletions alphabase/constants/aa.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbdev_nbs/constants/aa.ipynb.

# %% auto 0
__all__ = ['AA_CHEM', 'AA_ASCII_MASS', 'AA_DF', 'AA_formula', 'reset_AA_mass', 'reset_AA_df', 'calc_sequence_mass',
'calc_AA_masses_for_same_len_seqs', 'calc_sequence_masses_for_same_len_seqs',
'calc_AA_masses_for_var_len_seqs']

# %% ../../nbdev_nbs/constants/aa.ipynb 2
import os
import pandas as pd
import numpy as np

from typing import Union, Tuple

from ..yaml_utils import load_yaml
from alphabase.yaml_utils import load_yaml

from alphabase.constants.element import (
calc_mass_from_formula,
MASS_H2O, parse_formula,
)

from ._const import CONST_FILE_FOLDER
from alphabase.constants._const import CONST_FILE_FOLDER

# %% ../../nbdev_nbs/constants/aa.ipynb 3
# We use all 128 ASCII code to represent amino acids for flexible extensions in the future.
# The amino acid masses are stored in 128-lengh array :py:data:`AA_ASCII_MASS`.
# If an ASCII code is not in `AA_CHEM`, the mass will be set as a large value to disable MS search.
AA_CHEM:dict = load_yaml(
os.path.join(CONST_FILE_FOLDER, 'amino_acid.yaml')
)

# %% ../../nbdev_nbs/constants/aa.ipynb 5
def reset_AA_mass()->np.ndarray:
"""AA mass in np.array with shape (128,)"""
AA_ASCII_MASS = np.ones(128)*1e8
Expand All @@ -53,14 +46,13 @@ def reset_AA_df():
#: 128-len AA dataframe
AA_DF:pd.DataFrame = reset_AA_df()

#: AA to formula dict of dict. For example: {'K': {'C': n, 'O': m, ...}}
# AA to formula dict of dict. For example: {'K': {'C': n, 'O': m, ...}}
AA_formula:dict = {}
for aa, formula, mass in AA_DF.values:
AA_formula[aa] = dict(
parse_formula(formula)
)

# %% ../../nbdev_nbs/constants/aa.ipynb 8
def calc_sequence_mass(
sequence: str
)->np.ndarray:
Expand All @@ -77,7 +69,6 @@ def calc_sequence_mass(
'''
return AA_ASCII_MASS[np.array(sequence,'c').view(np.int8)]

# %% ../../nbdev_nbs/constants/aa.ipynb 10
def calc_AA_masses_for_same_len_seqs(
sequence_array: np.ndarray
)->np.ndarray:
Expand Down Expand Up @@ -132,7 +123,6 @@ def calc_sequence_masses_for_same_len_seqs(
)+MASS_H2O


# %% ../../nbdev_nbs/constants/aa.ipynb 19
def calc_AA_masses_for_var_len_seqs(
sequence_array: np.ndarray
)->np.ndarray:
Expand Down
2 changes: 1 addition & 1 deletion alphabase/constants/atom.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .element import *
from alphabase.constants.element import *
3 changes: 2 additions & 1 deletion alphabase/constants/const_files/protease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ thermolysin: '[^DE](?=[AFILMV])'
thrombin: '((?<=G)R(?=G))|((?<=[AFGILTVM][AFGILTVWA]P)R(?=[^DE][^DE]))'
trypsin_full: '([KR](?=[^P]))|((?<=W)K(?=P))|((?<=M)R(?=P))'
trypsin_exception: '((?<=[CD])K(?=D))|((?<=C)K(?=[HY]))|((?<=C)R(?=K))|((?<=R)R(?=[HR]))'
trypsin: '([KR](?=[^P]))'
trypsin_not_p: '([KR](?=[^P]))'
trypsin: '([KR])'
trypsin/p: '([KR])'
non-specific: '()'
no-cleave: '_'
17 changes: 3 additions & 14 deletions alphabase/constants/const_files/psm_reader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ alphapept:
maxquant:
reader_type: maxquant
rt_unit: minute
mod_sep: '()'
underscore_for_ncterm: True
fixed_C57: True
column_mapping:
'sequence': 'Sequence'
Expand All @@ -46,37 +44,32 @@ maxquant:
'proteins': 'Proteins'
'genes': ['Gene Names','Gene names']
'decoy': 'Reverse'
'intensity': 'Intensity'
modification_mapping:
'Acetyl@Protein N-term':
- '_(Acetyl (Protein N-term))'
- '_(ac)'
- '_(UniMod:1)'
'Carbamidomethyl@C':
- 'C(Carbamidomethyl (C))'
- 'C(UniMod:4)'
'Oxidation@M':
- 'M(Oxidation (M))'
- 'M(ox)'
- 'M(UniMod:35)'
'Phospho@S':
- 'S(Phospho (S))'
- 'S(Phospho (ST))'
- 'S(Phospho (STY))'
- 'S(ph)'
- 'S(UniMod:21)'
- 'pS'
'Phospho@T':
- 'T(Phospho (T))'
- 'T(Phospho (ST))'
- 'T(Phospho (STY))'
- 'T(ph)'
- 'T(UniMod:21)'
- 'pT'
'Phospho@Y':
- 'Y(Phospho (Y))'
- 'Y(Phospho (STY))'
- 'Y(ph)'
- 'Y(UniMod:21)'
- 'pY'
'Deamidated@N': ['N(Deamidation (NQ))','N(de)']
'Deamidated@Q': ['Q(Deamidation (NQ))','Q(de)']
Expand Down Expand Up @@ -144,8 +137,6 @@ msfragger_pepxml:
diann:
reader_type: diann
rt_unit: minute
mod_sep: '()'
underscore_for_ncterm: False
fixed_C57: False
csv_sep: "\t"
column_mapping:
Expand All @@ -160,12 +151,11 @@ diann:
'genes': 'Genes'
'scan_num': 'MS2.Scan'
'score': 'CScore'
'fdr': 'Q.Value'
modification_mapping: 'maxquant'
spectronaut_report:
reader_type: spectronaut_report
rt_unit: minute
mod_sep: '[]'
underscore_for_ncterm: True
fixed_C57: False
csv_sep: ','
column_mapping:
Expand All @@ -175,11 +165,10 @@ spectronaut_report:
'genes': 'PG.Genes'
'uniprot_ids': 'PG.UniProtIds'
'charge': 'charge'
modification_mapping: 'maxquant'
spectronaut:
reader_type: spectronaut
rt_unit: irt
mod_sep: '[]'
underscore_for_ncterm: True
fixed_C57: False
csv_sep: "\t"
mod_seq_columns:
Expand Down
16 changes: 2 additions & 14 deletions alphabase/constants/element.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbdev_nbs/constants/element.ipynb.

# %% auto 0
__all__ = ['common_const_dict', 'MASS_PROTON', 'MASS_ISOTOPE', 'MAX_ISOTOPE_LEN', 'EMPTY_DIST', 'CHEM_INFO_DICT',
'CHEM_MONO_MASS', 'CHEM_ISOTOPE_DIST', 'CHEM_MONO_IDX', 'MASS_H2O', 'MASS_NH3', 'truncate_isotope',
'reset_elements', 'load_elem_yaml', 'parse_formula', 'calc_mass_from_formula']

# %% ../../nbdev_nbs/constants/element.ipynb 2
import os
import numpy as np
import numba

from ..yaml_utils import load_yaml
from alphabase.yaml_utils import load_yaml

from ._const import CONST_FILE_FOLDER
from alphabase.constants._const import CONST_FILE_FOLDER

# %% ../../nbdev_nbs/constants/element.ipynb 3
common_const_dict:dict = load_yaml(
os.path.join(CONST_FILE_FOLDER, 'common_constants.yaml')
)

MASS_PROTON:float = common_const_dict['MASS_PROTON']
MASS_ISOTOPE:float = common_const_dict['MASS_ISOTOPE']

# %% ../../nbdev_nbs/constants/element.ipynb 5
MAX_ISOTOPE_LEN = common_const_dict['MAX_ISOTOPE_LEN']
EMPTY_DIST = np.zeros(MAX_ISOTOPE_LEN)
EMPTY_DIST[0] = 1
Expand Down Expand Up @@ -75,7 +65,6 @@ def truncate_isotope(
trunc_start = len(isotopes)-MAX_ISOTOPE_LEN-1
return mono_idx-trunc_start-1, trunc_start+1, trunc_end

# %% ../../nbdev_nbs/constants/element.ipynb 7
#: chemical element information in dict defined by `nist_element.yaml`
CHEM_INFO_DICT = {}

Expand Down Expand Up @@ -164,7 +153,6 @@ def load_elem_yaml(yaml_file:str):
)
)

# %% ../../nbdev_nbs/constants/element.ipynb 9
def parse_formula(
formula:str
)->list:
Expand Down
10 changes: 0 additions & 10 deletions alphabase/constants/isotope.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbdev_nbs/constants/isotope.ipynb.

# %% auto 0
__all__ = ['abundance_convolution', 'one_element_dist', 'formula_dist', 'IsotopeDistribution']

# %% ../../nbdev_nbs/constants/isotope.ipynb 3
import numba
import numpy as np
import typing
Expand All @@ -14,7 +8,6 @@
truncate_isotope, parse_formula
)

# %% ../../nbdev_nbs/constants/isotope.ipynb 4
@numba.njit
def abundance_convolution(
d1:np.ndarray,
Expand Down Expand Up @@ -55,7 +48,6 @@ def abundance_convolution(
mono_idx, start, end = truncate_isotope(ret, mono_idx)
return ret[start:end], mono_idx

# %% ../../nbdev_nbs/constants/isotope.ipynb 6
@numba.njit
def one_element_dist(
elem: str,
Expand Down Expand Up @@ -125,7 +117,6 @@ def formula_dist(
calc_dist, mono_idx = abundance_convolution(calc_dist, mono_idx, _dist, _mono)
return calc_dist, mono_idx

# %% ../../nbdev_nbs/constants/isotope.ipynb 23
def _calc_one_elem_cum_dist(
element_cum_dist:np.ndarray,
element_cum_mono:np.ndarray
Expand Down Expand Up @@ -154,7 +145,6 @@ def _calc_one_elem_cum_dist(
element_cum_mono[1]
)

# %% ../../nbdev_nbs/constants/isotope.ipynb 24
class IsotopeDistribution:
def __init__(self,
max_elem_num_dict:dict = {
Expand Down
Loading