Skip to main content

fragannot

fragannot is a simple command-line tool in python that annotates fragments ions in MS2 mass spectra. This tools returns a JSON file with fragment annotation from a spectra file (in .mgf format) and a corresponding identification file in .mzid format.

Install

1-Clone the repository 2-Run the script "publish_local.sh" ( can be found in /publish )

This will package and install fragannot

Usage

the tool is ran a terminal as follow:

$ fragannot -i identification.mzid -s spectra.mzid

-i : path to spectra identification file in .mzid format -s : path to spectra file in .mgf format (need to add .mzml)


Python CLI Template

This is a template project for creating a Python CLI app intended for distribution to PyPI (so that you can pip install it later). It currently uses Python 3.8 and has been developed/tested on Ubuntu.

  • 📦 Easily create a Python app that is distributed to PyPI and can be installed by anyone with pip install.
  • :computer: ​The package is configured with a script, so you can run it directly from a terminal once installed.
  • ✅ Added sample tests with pytest so you can keep your package well tested!
  • :100: Automatic version increment.

Configuration

To configure the project, modify publish/config.json:

vi publish/config.json

Here is the default sample configuration:

{
  "author": "Pixegami",
  "package_name_override": "pixegami-my-app",
  "email": "pixegami@gmail.com",
  "description": "A template Python CLI app.",
  "url": "https://github.com/pixegami/python-cli-template",
  "python_version": "3.8",
  "version": "0.0.8",
  "scripts": ["run-my-app = my_app:main"]
}

This will be the information that is published to PyPI. Your scripts array allows you to specify which commands will be available once you install this package.

For example, this configuration will let you execute run-my-app as a command directly from terminal, which will call the main() function in the my_app package.

The package_name_override will be what we attempt to publish the package as, so make sure it is unique on PyPI.

Publish Locally

This will build the package, and install it directly into your current Python environment.

cd publish
sh ./publish_local.sh

Once installed, you should be able to test the script.

run-my-app
# Executing 'main()' from my app!
# Hello World

run-my-app --version
# Executing 'main()' from my app!
# 0.0.7

Publish to PyPI

First, you will need to create an account on PyPI. Then you need to export your PyPI credentials in the environment variables of your terminal.

I like to do this by just adding the following exports to the ~/.bashrc (or whichever file, depending on the terminal you are using).

export PYPI_REPO_USER="YOUR_USERNAME"
export PYPI_REPO_PASS="YOUR_PASSWORD"

The publish script will use these environment variables to upload your package to PyPI. Next, you can run the script:

cd publish
sh ./publish_remote.sh

This will build it into a package like so: https://pypi.org/project/pixegami-my-app/. Now you can install it directly with pip install.

Testing

To run the tests, you need to install pytest, which is already in the developer_requirements.txt.

pip install pytest

From the project root, you can run this to test and print all output:

python -m pytest -s

Or to test a specific file or function:

# Test file tests/test_my_app.py
python -m pytest -s tests/test_my_app.py

# Test function test_app_main() in tests/test_my_app.py
python -m pytest -s tests/test_my_app.py::test_app_main

Versioning

Every time you publish the package (either locally or remote), the version field in publish/config.json will go up (specifically, the last digit). So 1.2.3 will become 1.2.4, etc. It will keep going up.

The major and minor versions (the first two digits) can only be changed manually. Change it directly in the file when you need to.

Related Reading

  • Packaging Python projects: A guide explaining how to package Python projects using setup.py and setuptools (we use this here).
  • argparse: I use this to "understand" CLI arguments and sub-commands.
  • pytest: Testing framework for this project.

Release files for fragannot 0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fragannot 0.13
File Size Uploaded
fragannot-0.13.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fragannot 0.13
File Interpreter ABI Platform
fragannot-0.13-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / fragannot-0.13.tar.gz

Download URL fragannot-0.13.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
49b415e92faf07bde526abf543737a5f8bf9f4fc3b5da693c68f2bde2518f80d
BLAKE2b-256 checksum
How to use checksums
5757adedb7b6bcfce3860518ca5b7f71df143d81130517a99a1336e5219f93aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release files / fragannot-0.13-py3-none-any.whl

Download URL fragannot-0.13-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1eebfc88b12cb1296b50e762ca5dcbf5a5b38dc0326f3c997197e1f76bf883e
BLAKE2b-256 checksum
How to use checksums
bab52eed555cf29f57691609e4dcfa8f58eb3f5ca59e8a9193a824bdc9a4309b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.13 This release

2 release files

0.11

2 release files

0.10

2 release files

0.9

2 release files

0.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page