Mass Spec Query Language
The Mass Spec Query Language (MassQL) is a domain specific language meant to be a succinct way to express a query in a mass spectrometry centric fashion. It is inspired by SQL, but it attempts to bake in assumptions of mass spectrometry to make querying much more natural for mass spectrometry users. Broadly we attempt to design it according to several principles:
- Expressiveness - Capture complex mass spectrometry patterns that the community would like to look for
- Precision - Exactly prescribe how to find data without ambiguity
- Scalable - Easily facilitating the querying of one spectrum all the way up to entire repositories of data
- Relatively Natural - MassQL should be relatively easy to read and write and even use to communicate ideas about mass spectrometry, you know like a language.
Repository Structure
This is the repository to define the language and reference implementation. This contains several parts
- Language Grammar
- Reference Implementation Python API
- Command line Utility to execute
- NextFlow Workflow For Large Scale Analysis
- ProteoSAFe workflow
- Dash interactive exploration
Developers/Contact
Mingxun Wang is the main creator and developer of MassQL. Contact me for contributing or using it!
Language Specification/Documentation
Checkout specifics for the language, examples, and design patterns at the documentation.
Python API
We currently test massql in python 3.9, but are figuring out other versions if they work or not.
To install massql
pip install massql
Here is the most basic operation you can do
from massql import msql_engine
results_df = msql_engine.process_query(input_query, input_filename)
If you want to push in a data frame you already have, you can specify it
from massql import msql_engine
from massql import msql_fileloading
# Loading Data
ms1_df, ms2_df = msql_fileloading.load_data(input_filename)
# Executing Query
results_df = msql_engine.process_query(input_query, input_filename, ms1_df=ms1_df, ms2_df=ms2_df)
Command Line Tool
You can use the command line tool massql to query things or put things into a pipeline.
A few examples of what you can do
massql test.mzML "QUERY scaninfo(MS2DATA)" --output_file results.tsv
Web API
API Version
/api
Parsing query into intermediate JSON string
/parse?query=<query string>
Visualization of Query
Visualization image of MS1 spectra
/visualize/ms1
Visualization image of MS2 spectra
/visualize/ms2
Testing
To run tests, you'll need to first fetch some fixtures that are not bundled with the git repo:
cd tests && sh ./get_data.sh
You will also want to install the extra requirements for the test suite:
pip install -r requirements_test.txt
License
MIT License
Metadata
Release files for massql 2026.3.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| massql-2026.3.14.tar.gz | 48.5 kB | Without provenance | Details for massql-2026.3.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| massql-2026.3.14-py3-none-any.whl | Python 3 | none | any | Details for massql-2026.3.14-py3-none-any.whl |
Total release size: 89.0 kB
Release files / massql-2026.3.14.tar.gz
| Download URL | massql-2026.3.14.tar.gz |
|---|---|
| Size | 48.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e148e388813ed81bd243781edf842752fdfa9c58c52daab22820be683af22b0
|
|
BLAKE2b-256 checksum How to use checksums |
cab53b1c00ac4647fb21a9836acac67a0b9ff04314cd939ddcc85eac06f7c2e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / massql-2026.3.14-py3-none-any.whl
| Download URL | massql-2026.3.14-py3-none-any.whl |
|---|---|
| Size | 40.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd56976c66603788e944871f73ccf168e90a4760730016c17c0762a4a97da232
|
|
BLAKE2b-256 checksum How to use checksums |
b48f96e201e211ab389360429d40323ab0eab448f92ed4f1ec634ee0d682ddf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for massql 2026.3.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.