Skip to main content

AlphaBase

Pip installation PyPi releases Documentation Status PyPI pip downloads Python

AlphaBase provides all basic python functionalities for AlphaPept ecosystem from the Mann Labs at the Max Planck Institute of Biochemistry and the University of Copenhagen. To enable all hyperlinks in this document, please view it at GitHub. For documentation, please see readthedocs.


About

The infrastructure package of AlphaX ecosystem for MS proteomics. It was first published with AlphaPeptDeep, see Citations.

Packages built upon AlphaBase


Citations

Wen-Feng Zeng, Xie-Xuan Zhou, Sander Willems, Constantin Ammar, Maria Wahle, Isabell Bludau, Eugenia Voytik, Maximillian T. Strauss & Matthias Mann. AlphaPeptDeep: a modular deep learning framework to predict peptide properties for proteomics. Nat Commun 13, 7238 (2022). https://doi.org/10.1038/s41467-022-34904-3


License

AlphaBase was developed by the Mann Labs at the Max Planck Institute of Biochemistry and the University of Copenhagen and is freely available with an Apache License. External Python packages (available in the requirements folder) have their own licenses, which can be consulted on their respective websites.


Installation

AlphaBase can be installed and used on all major operating systems (Windows, macOS and Linux). There are two different types of installation possible:

  • Pip installer: Choose this installation if you want to use AlphaBase as a Python package in an existing Python 3.8 environment (e.g. a Jupyter notebook).
  • Developer installer: Choose this installation if you are familiar with conda and Python. This installation allows access to all available features of AlphaBase and even allows to modify its source code directly. Generally, the developer version of AlphaBase outperforms the precompiled versions which makes this the installation of choice for high-throughput experiments.

Pip

AlphaBase can be installed in an existing Python 3.8 environment with a single bash command. This bash command can also be run directly from within a Jupyter notebook by prepending it with a !:

pip install alphabase

Installing AlphaBase like this avoids conflicts when integrating it in other tools, as this does not enforce strict versioning of dependencies. However, if new versions of dependencies are released, they are not guaranteed to be fully compatible with AlphaBase. While this should only occur in rare cases where dependencies are not backwards compatible, you can always force AlphaBase to use dependency versions which are known to be compatible with:

pip install "alphabase[stable]"

NOTE: You might need to run pip install -U pip before installing AlphaBase like this. Also note the double quotes ".

You need to install the hdf extra option of the package to be able to read alphapept protein group matrices in hdf format.

For those who are really adventurous, it is also possible to directly install any branch (e.g. @main) with any extras (e.g. #egg=alphabase[stable,development]) from GitHub with e.g.

pip install "git+https://github.com/MannLabs/alphabase.git@main#egg=alphabase[stable,development]"

Developer

AlphaBase can also be installed in editable (i.e. developer) mode with a few bash commands. This allows to fully customize the software and even modify the source code to your specific needs. When an editable Python package is installed, its source code is stored in a transparent location of your choice. While optional, it is advised to first (create and) navigate to e.g. a general software folder:

mkdir ~/folder/where/to/install/software
cd ~/folder/where/to/install/software

The following commands assume you do not perform any additional cd commands anymore.

Next, download the AlphaBase repository from GitHub either directly or with a git command. This creates a new AlphaBase subfolder in your current directory.

git clone https://github.com/MannLabs/alphabase.git

For any Python package, it is highly recommended to use a separate conda virtual environment, as otherwise dependency conflicts can occur with already existing packages.

conda create --name alphabase python=3.9 -y
conda activate alphabase

Finally, AlphaBase and all its dependencies need to be installed. To take advantage of all features and allow development (with the -e flag), this is best done by also installing the development dependencies instead of only the core dependencies:

pip install -e "./alphabase[development]"

By default this installs loose dependencies (no explicit versioning), although it is also possible to use stable dependencies (e.g. pip install -e "./alphabase[stable,development]").

By using the editable flag -e, all modifications to the AlphaBase source code folder are directly reflected when running AlphaBase. Note that the AlphaBase folder cannot be moved and/or renamed if an editable version is installed. In case of confusion, you can always retrieve the location of any Python module with e.g. the command import module followed by module.__file__.


Usage

TODO


Troubleshooting

In case of issues, check out the following:

  • Issues: Try a few different search terms to find out if a similar problem has been encountered before
  • Discussions: Check if your problem or feature requests has been discussed before.

How to contribute

If you like this software, you can give us a star to boost our visibility! All direct contributions are also welcome. Feel free to post a new issue or clone the repository and create a pull request with a new branch. For an even more interactive participation, check out the discussions and the the Contributors License Agreement.

Notes for developers

1. Code Structure

While AlphaBase offers an object-oriented interface, algorithms for manipulating data should be implemented in a functional way and called from class methods. This allows the functions to be reused without instatiating a class.

2. DataFrame Handling

  • Return DataFrames in the same order as they were passed
  • Minimize in-place modifications of DataFrames. Mention them explicitly in the docstring
  • Implement low-level functions that operate on numpy arrays and return arrays. Use higher-level functions to assign array results to DataFrames

3. Data Assumptions

Avoid making assumptions about:

  • Precursor ordering by nAA
  • Fragment indices ordering (e.g., frag_start_idx)
  • Continuity of frag_start_idx where frag_start_idx[i+1] == frag_stop_idx[i]
  • All fragments being assigned to a precursor

Assumptions are only permitted for low-level or optimized functions and should be documented in the docstring.

3. Optimization Strategy

When performance optimization is needed:

  1. Implement the general solution first
  2. Add optimized versions for special cases for refined precursor df or order nAA
  3. Check conditions at runtime to use optimized versions when applicable

4. Code Quality

5. pre-commit hooks

It is highly recommended to use the provided pre-commit hooks, as the CI pipeline enforces all checks therein to pass in order to merge a branch.

The hooks need to be installed once by

pre-commit install

You can run the checks yourself using:

pre-commit run --all-files

6. Tagging of Pull Requests

In order to have release notes automatically generated, pull requests need to be tagged with labels. The following labels are used (should be safe-explanatory): breaking-change, bug, enhancement.

7. Release a new version

This package uses a shared release process defined in the alphashared repository. Please see the instructions there.


Changelog

For a full overview of the changes made in each version see CHANGELOG.md (until version 1.1.0) and the github release notes (from >1.1.0).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alphabase-1.9.1.tar.gz (276.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alphabase-1.9.1-py3-none-any.whl (298.9 kB view details)

Uploaded Python 3

File details

Details for the file alphabase-1.9.1.tar.gz.

File metadata

  • Download URL: alphabase-1.9.1.tar.gz
  • Upload date:
  • Size: 276.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for alphabase-1.9.1.tar.gz
Algorithm Hash digest
SHA256 60aeb2c98de3781fd38075161b120430cbd901d6bf0755dc59cdcc8711f0e85d
MD5 8f2687766ebc155497616836b3b88d3f
BLAKE2b-256 f761ca9a585ff102487453b2ea00c5bdfd5fc66ee0195020e0c4aca6f36c7b0f

See more details on using hashes here.

File details

Details for the file alphabase-1.9.1-py3-none-any.whl.

File metadata

  • Download URL: alphabase-1.9.1-py3-none-any.whl
  • Upload date:
  • Size: 298.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for alphabase-1.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b8e824bafa586455beaf38bb03ba3b4350ae9c9d80cf97758e293b8c4ae907d
MD5 579fcf565c80bd75f1d8382bb805f1e6
BLAKE2b-256 1be3d88746e3d7c09d9b2ef5812dd54f8776c0a5955b03767c5ebdbbef82fb1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page