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 #63

Merged
merged 4 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.1
current_version = 0.2.2
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand Down
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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?

Expand Down
8 changes: 8 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
AlphaBase
================

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

<a href="https://github.com/MannLabs/alphabase/workflows/Default%20installation%20and%20tests/badge.svg" alt="Pip Installation">
<img src="https://github.com/MannLabs/alphabase/workflows/Default%20installation%20and%20tests/badge.svg" /></a>
<a href="https://github.com/MannLabs/alphabase/workflows/Publish%20on%20PyPi%20and%20release%20on%20GitHub/badge.svg" alt="GUI and PyPi releases">
<img src="https://github.com/MannLabs/alphabase/workflows/Publish%20on%20PyPi%20and%20release%20on%20GitHub/badge.svg"/></a>
<a href="https://pypi.org/project/alphabase" alt="pypi">
<img src="https://img.shields.io/pypi/v/alphabase" /></a>
<a href="https://pypi.org/project/alphabase" alt="release">
<img src="https://img.shields.io/pypi/dm/alphabase?color=blue&label=pip%20downloads"/></a>
<img src="https://img.shields.io/pypi/pyversions/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
ecosystem from the [Mann Labs at the Max Planck Institute of
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.1"
__version__ = "0.2.2"
__license__ = "Apache"
__description__ = "An open-source Python package of the AlphaPept ecosystem"
__author__ = "Mann Labs"
Expand Down
73 changes: 47 additions & 26 deletions alphabase/constants/modification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)')}
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
copyright = '2022, Mann Labs, MPIB'
author = 'Mann Labs, MPIB'

release = "0.2.1"
release = "0.2.2"

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Tutorials and Notebooks
====================
========================

Tutorials and notebooks about how to use AlphaBase.

Expand Down
3 changes: 3 additions & 0 deletions nbs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Jupyter notebooks for AlphaBase

Check [docs/nbs](../docs/nbs) for more tutorial notebooks.
2 changes: 1 addition & 1 deletion release/one_click_linux_gui/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: AlphaBase
Version: 0.2.1
Version: 0.2.2
Architecture: all
Maintainer: Mann Labs <opensource@alphapept.com>
Description: AlphaBase
Expand Down
2 changes: 1 addition & 1 deletion release/one_click_linux_gui/create_installer_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions release/one_click_macos_gui/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<key>CFBundleIconFile</key>
<string>alpha_logo.icns</string>
<key>CFBundleIdentifier</key>
<string>alphabase.0.2.1</string>
<string>alphabase.0.2.2</string>
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<string>0.2.2</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
4 changes: 2 additions & 2 deletions release/one_click_macos_gui/create_installer_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion release/one_click_macos_gui/distribution.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-script minSpecVersion="1.000000">
<title>AlphaBase 0.2.1</title>
<title>AlphaBase 0.2.2</title>
<background mime-type="image/png" file="alpha_logo.png" scaling="proportional"/>
<welcome file="welcome.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />
Expand Down
2 changes: 1 addition & 1 deletion release/one_click_windows_gui/alphabase_innoinstaller.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion release/one_click_windows_gui/create_installer_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down