From 8f5b8b5e61d949954d42621e85d9c747ac4d509b Mon Sep 17 00:00:00 2001 From: "Zeng, Wen-Feng" Date: Thu, 22 Dec 2022 20:46:30 +0100 Subject: [PATCH 1/4] md updates --- CONTRIBUTING.md | 9 ++++----- HISTORY.md | 8 ++++++++ README.md | 1 + nbs/README.md | 3 +++ 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 nbs/README.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 38fbde54..7b6017a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,10 @@ # How to contribute -## How to get started +## How to contribute to source code -Before anything else, please install the git hooks that run automatic scripts during each commit and merge to strip the notebooks of superfluous metadata (and avoid merge conflicts). After cloning the repository, run the following command inside it: -``` -nbdev_install_git_hooks -``` +* Folk this GitHub repository to your personal repository. +* Make changes/updates. +* Make a PR back to the this repository. ## Did you find a bug? diff --git a/HISTORY.md b/HISTORY.md index 42d68c13..cbe0f552 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,3 +3,11 @@ ### 0.0.1 * FEAT: Initial creation of AlphaBase. + +### 0.2.0 + +First official release. + +### 0.2.1 + +Using Sphinx and readthedocs for documentation. diff --git a/README.md b/README.md index dd274ebd..6f587a6e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ AlphaBase +[![Documentation Status](https://readthedocs.org/projects/alphabase/badge/?version=latest)](https://alphabase.readthedocs.io/en/latest/?badge=latest) AlphaBase provides all basic python functionalities for AlphaPept ecosystem from the [Mann Labs at the Max Planck Institute of diff --git a/nbs/README.md b/nbs/README.md new file mode 100644 index 00000000..7d292931 --- /dev/null +++ b/nbs/README.md @@ -0,0 +1,3 @@ +# Jupyter notebooks for AlphaBase + +Check [docs/nbs](../docs/nbs)" for more tutorial notebooks. \ No newline at end of file From 4c0955fb6170580f89fdeaabfde73ddee8d2a58a Mon Sep 17 00:00:00 2001 From: "Zeng, Wen-Feng" Date: Thu, 22 Dec 2022 21:29:50 +0100 Subject: [PATCH 2/4] update readme --- README.md | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6f587a6e..2782293d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,10 @@ -AlphaBase -================ - - - - - - - - - - - - +# AlphaBase + +![Pip installation](https://github.com/MannLabs/alphabase/workflows/Default%20installation%20and%20tests/badge.svg) +![PyPi releases](https://github.com/MannLabs/alphabase/workflows/Publish%20on%20PyPi%20and%20release%20on%20GitHub/badge.svg) +[![PyPI](https://img.shields.io/pypi/v/alphabase)](https://pypi.org/project/alphabase) +[![pip downloads](https://img.shields.io/pypi/dm/alphabase?color=blue&label=pip%20downloads)](https://pypi.org/project/alphabase) +![Python](https://img.shields.io/pypi/pyversions/alphabase) [![Documentation Status](https://readthedocs.org/projects/alphabase/badge/?version=latest)](https://alphabase.readthedocs.io/en/latest/?badge=latest) AlphaBase provides all basic python functionalities for AlphaPept From 174342454fb51ffda010e7a0be2031da36b252ca Mon Sep 17 00:00:00 2001 From: "Zeng, Wen-Feng" Date: Fri, 23 Dec 2022 23:48:09 +0100 Subject: [PATCH 3/4] add_a_new_modification() --- alphabase/constants/modification.py | 73 +++++++++++++++++++---------- docs/notebooks.rst | 2 +- nbs/README.md | 2 +- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/alphabase/constants/modification.py b/alphabase/constants/modification.py index 329a85d6..d99ed00b 100644 --- a/alphabase/constants/modification.py +++ b/alphabase/constants/modification.py @@ -11,6 +11,9 @@ from alphabase.constants._const import CONST_FILE_FOLDER MOD_DF:pd.DataFrame = pd.DataFrame() +""" +Main entry of modification infomation (DataFrame fotmat). +""" MOD_INFO_DICT:dict = {} #: Modification to formula str dict. {mod_name: formula str ('H(1)C(2)O(3)')} @@ -353,36 +356,54 @@ def calc_modloss_mass( else: return _calc_modloss(mod_losses[::-1])[-3:0:-1] +def add_a_new_modification( + mod_name:str, composition:str, + modloss_composition:str='' +): + """ + Add a new modification into :data:`MOD_DF`. + + Parameters + ---------- + mod_name : str + Mod name in alphabase format: mod@site, + e.g. Mod@S + composition : str + chemical composition of this mod, + e.g. "H(4)O(2)" + modloss_composition : str, optional + modloss compositions, e.g. "H(2)O(1)"), + by default '' + """ + MOD_DF.loc[mod_name,[ + 'mod_name','composition','modloss_composition', + 'classification','unimod_id' + ]] = [ + mod_name, composition, modloss_composition, + 'User-added', 0 + ] + MOD_DF.loc[mod_name,['mass','modloss']] = ( + calc_mass_from_formula(composition), + calc_mass_from_formula(modloss_composition) + ) + if MOD_DF.loc[mod_name, 'modloss'] > 0: + MOD_DF.loc[mod_name, 'modloss_importance'] = 1e6 + MOD_DF.fillna(0, inplace=True) + update_all_by_MOD_DF() + def add_new_modifications(new_mods:list): - """Add new modifications into MOD_DF + """Add multiple modifications into :data:`MOD_DF`, + it uses :meth:`add_a_new_modification()`. Parameters ---------- - new_mods : list - list of tuples. Tuple example: - + new_mods : list of tuples + Tuple example: + ( modname@site:str (e.g. Mod@S), - chemical compositions:str (e.g. "H(4)O(2)"), - [optional] modloss compositions:str (e.g. "H(2)O(1)"), + composition:str (e.g. "H(4)O(2)"), + [optional] modloss composition:str (e.g. "H(2)O(1)"), + ) """ for items in new_mods: - if len(items) == 2: - mod, comp = items - modloss_comp = '' - else: - mod, comp, modloss_comp = items - MOD_DF.loc[mod,[ - 'mod_name','composition','modloss_composition', - 'classification','unimod_id' - ]] = [ - mod, comp, modloss_comp, - 'User-added', 0 - ] - MOD_DF.loc[mod,['mass','modloss']] = ( - calc_mass_from_formula(comp), - calc_mass_from_formula(modloss_comp) - ) - if MOD_DF.loc[mod, 'modloss'] > 0: - MOD_DF.loc[mod, 'modloss_importance'] = 1e6 - MOD_DF.fillna(0, inplace=True) - update_all_by_MOD_DF() + add_a_new_modification(*items) diff --git a/docs/notebooks.rst b/docs/notebooks.rst index 0f034f68..a53071b7 100644 --- a/docs/notebooks.rst +++ b/docs/notebooks.rst @@ -1,5 +1,5 @@ Tutorials and Notebooks -==================== +======================== Tutorials and notebooks about how to use AlphaBase. diff --git a/nbs/README.md b/nbs/README.md index 7d292931..def5df56 100644 --- a/nbs/README.md +++ b/nbs/README.md @@ -1,3 +1,3 @@ # Jupyter notebooks for AlphaBase -Check [docs/nbs](../docs/nbs)" for more tutorial notebooks. \ No newline at end of file +Check [docs/nbs](../docs/nbs) for more tutorial notebooks. \ No newline at end of file From c1c4c4c2190408b0b88a2f79eb5dc2266c44e9f3 Mon Sep 17 00:00:00 2001 From: "Zeng, Wen-Feng" Date: Sat, 24 Dec 2022 00:21:00 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Bump=20version:=200.2.1=20=E2=86=92=200.2.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- alphabase/__init__.py | 2 +- docs/conf.py | 2 +- release/one_click_linux_gui/control | 2 +- release/one_click_linux_gui/create_installer_linux.sh | 2 +- release/one_click_macos_gui/Info.plist | 4 ++-- release/one_click_macos_gui/create_installer_macos.sh | 4 ++-- release/one_click_macos_gui/distribution.xml | 2 +- release/one_click_windows_gui/alphabase_innoinstaller.iss | 2 +- release/one_click_windows_gui/create_installer_windows.sh | 2 +- settings.ini | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 6291f8ab..ef42ddc7 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.2.1 +current_version = 0.2.2 commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+)(?P\d+))? diff --git a/alphabase/__init__.py b/alphabase/__init__.py index 312c40f0..817504f2 100644 --- a/alphabase/__init__.py +++ b/alphabase/__init__.py @@ -2,7 +2,7 @@ __project__ = "alphabase" -__version__ = "0.2.1" +__version__ = "0.2.2" __license__ = "Apache" __description__ = "An open-source Python package of the AlphaPept ecosystem" __author__ = "Mann Labs" diff --git a/docs/conf.py b/docs/conf.py index 4d82ff0a..d4c7b519 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,7 +23,7 @@ copyright = '2022, Mann Labs, MPIB' author = 'Mann Labs, MPIB' -release = "0.2.1" +release = "0.2.2" # -- General configuration --------------------------------------------------- diff --git a/release/one_click_linux_gui/control b/release/one_click_linux_gui/control index 041d98b7..2e746753 100644 --- a/release/one_click_linux_gui/control +++ b/release/one_click_linux_gui/control @@ -1,5 +1,5 @@ Package: AlphaBase -Version: 0.2.1 +Version: 0.2.2 Architecture: all Maintainer: Mann Labs Description: AlphaBase diff --git a/release/one_click_linux_gui/create_installer_linux.sh b/release/one_click_linux_gui/create_installer_linux.sh index 4adc2e57..99b0517c 100644 --- a/release/one_click_linux_gui/create_installer_linux.sh +++ b/release/one_click_linux_gui/create_installer_linux.sh @@ -17,7 +17,7 @@ python setup.py sdist bdist_wheel # Setting up the local package cd release/one_click_linux_gui # Make sure you include the required extra packages and always use the stable or very-stable options! -pip install "../../dist/alphabase-0.2.1-py3-none-any.whl[stable]" +pip install "../../dist/alphabase-0.2.2-py3-none-any.whl[stable]" # Creating the stand-alone pyinstaller folder pip install pyinstaller diff --git a/release/one_click_macos_gui/Info.plist b/release/one_click_macos_gui/Info.plist index 02167502..45f574f0 100644 --- a/release/one_click_macos_gui/Info.plist +++ b/release/one_click_macos_gui/Info.plist @@ -9,9 +9,9 @@ CFBundleIconFile alpha_logo.icns CFBundleIdentifier - alphabase.0.2.1 + alphabase.0.2.2 CFBundleShortVersionString - 0.2.1 + 0.2.2 CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/release/one_click_macos_gui/create_installer_macos.sh b/release/one_click_macos_gui/create_installer_macos.sh index d91f4c8f..4d993d54 100644 --- a/release/one_click_macos_gui/create_installer_macos.sh +++ b/release/one_click_macos_gui/create_installer_macos.sh @@ -20,7 +20,7 @@ python setup.py sdist bdist_wheel # Setting up the local package cd release/one_click_macos_gui -pip install "../../dist/alphabase-0.2.1-py3-none-any.whl[stable]" +pip install "../../dist/alphabase-0.2.2-py3-none-any.whl[stable]" # Creating the stand-alone pyinstaller folder pip install pyinstaller @@ -40,5 +40,5 @@ cp ../../LICENSE.txt Resources/LICENSE.txt cp ../logos/alpha_logo.png Resources/alpha_logo.png chmod 777 scripts/* -pkgbuild --root dist/alphabase --identifier de.mpg.biochem.alphabase.app --version 0.2.1 --install-location /Applications/AlphaBase.app --scripts scripts AlphaBase.pkg +pkgbuild --root dist/alphabase --identifier de.mpg.biochem.alphabase.app --version 0.2.2 --install-location /Applications/AlphaBase.app --scripts scripts AlphaBase.pkg productbuild --distribution distribution.xml --resources Resources --package-path AlphaBase.pkg dist/alphabase_gui_installer_macos.pkg diff --git a/release/one_click_macos_gui/distribution.xml b/release/one_click_macos_gui/distribution.xml index da2a19cb..c3501843 100644 --- a/release/one_click_macos_gui/distribution.xml +++ b/release/one_click_macos_gui/distribution.xml @@ -1,6 +1,6 @@ - AlphaBase 0.2.1 + AlphaBase 0.2.2 diff --git a/release/one_click_windows_gui/alphabase_innoinstaller.iss b/release/one_click_windows_gui/alphabase_innoinstaller.iss index fcc24f3e..c886d6bf 100644 --- a/release/one_click_windows_gui/alphabase_innoinstaller.iss +++ b/release/one_click_windows_gui/alphabase_innoinstaller.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "AlphaBase" -#define MyAppVersion "0.2.1" +#define MyAppVersion "0.2.2" #define MyAppPublisher "Max Planck Institute of Biochemistry and the University of Copenhagen, Mann Labs" #define MyAppURL "https://github.com/MannLabs/alphabase" #define MyAppExeName "alphabase_gui.exe" diff --git a/release/one_click_windows_gui/create_installer_windows.sh b/release/one_click_windows_gui/create_installer_windows.sh index 4fae8de6..dffc445b 100644 --- a/release/one_click_windows_gui/create_installer_windows.sh +++ b/release/one_click_windows_gui/create_installer_windows.sh @@ -17,7 +17,7 @@ python setup.py sdist bdist_wheel # Setting up the local package cd release/one_click_windows_gui # Make sure you include the required extra packages and always use the stable or very-stable options! -pip install "../../dist/alphabase-0.2.1-py3-none-any.whl[stable]" +pip install "../../dist/alphabase-0.2.2-py3-none-any.whl[stable]" # Creating the stand-alone pyinstaller folder pip install pyinstaller diff --git a/settings.ini b/settings.ini index cc0ee73c..3d921205 100644 --- a/settings.ini +++ b/settings.ini @@ -4,7 +4,7 @@ ### Python library ### repo = alphabase lib_name = alphabase -version = 0.2.1 +version = 0.2.2 min_python = 3.7 license = apache2