Metadata-Version: 2.4
Name: jumplion
Version: 1.0.0
Summary: A software for DIA-MS quantification
Author-email: Yingxue Fu <yingxue.fu@stjude.org>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/yingxue-fu/jumplion
Project-URL: Issues, https://github.com/yingxue-fu/jumplion/issues
Keywords: proteomics,DIA,mass spectrometry,single-cell,quantification
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: C++
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: numba
Requires-Dist: pandas
Requires-Dist: polars
Requires-Dist: matplotlib
Requires-Dist: seaborn
Requires-Dist: pythonnet
Requires-Dist: timsrust_pyo3
Requires-Dist: pyteomics
Requires-Dist: biopython
Requires-Dist: pyarrow
Requires-Dist: tqdm
Requires-Dist: psutil
Requires-Dist: scipy
Requires-Dist: lxml
Provides-Extra: gui
Requires-Dist: dash; extra == "gui"
Requires-Dist: dash-bootstrap-components; extra == "gui"
Requires-Dist: dash-bootstrap-templates; extra == "gui"
Dynamic: license-file

<p align="center" style="margin-bottom: 0px !important;">
  <img src="https://raw.githubusercontent.com/yingxue-fu/jumplion/main/jumplion/gui/assets/logo.png" width="100" height="100">
</p>
<h1 align="center" style="margin-top: -7px; font-size: 24px">JUMPlion</h1>

<p align="center">
  <a href="https://pypi.org/project/jumplion/"><img alt="PyPI" src="https://img.shields.io/pypi/v/jumplion"></a>
  <a href="https://www.python.org/"><img alt="Python 3.12+" src="https://img.shields.io/badge/python-3.12%2B-blue"></a>
  <a href="LICENSE"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/license-Apache%202.0-green"></a>
</p>

**JUMPlion** is a software tool for improving quantitative coverage in single-cell proteomics generated by data-independent acquisition mass spectrometry (DIA-MS).

### Installation
JUMPlion can be installed via `pip` and is compatible with both Windows and Linux.
```bash
conda create -n jumplion python=3.12
conda activate jumplion
conda install mono # Required on Linux for reading Thermo .raw files; skip this step on Windows
# Installs a prebuilt wheel from PyPI (no compiler needed; Python 3.12/3.13, Windows and Linux)
pip install "jumplion[gui]"
```

Building from source (only if no wheel matches your platform) requires a C++17 compiler: Visual Studio Build Tools 2019 or newer on Windows, GCC 8 or newer on Linux:
```bash
pip install "jumplion[gui] @ git+https://github.com/yingxue-fu/jumplion.git"
```

### Usage
JUMPlion is designed to be used in command-line mode. See the [**Parameters**](#parameters) section below for a list of supported parameters and commands. For convenience, you can generate a parameter file in the current working directory, fill in the required inputs, and then run the program:
```bash
jumplion --gen-params jumplion.params
jumplion jumplion.params
```

The generated parameter file has a `[required]` section and an `[optional]` section. Fill in the required inputs; every optional parameter is listed with its default value. Lists such as `input_runs` take one path per line, directly below the `input_runs =` line, with no blank lines in between:
```ini
[required]
input_runs = 
D:/data/Run_1.raw
D:/data/Run_2.raw
D:/data/Run_3.raw

prec_ids = D:/data/report.parquet
spec_lib = D:/data/report-lib.parquet

[optional]
out_dir = jumplion_results
```
`out_dir` is optional. If it is left out, results are written to `jumplion_results` in the folder that contains the parameter file (or in the current directory when no parameter file is used). A relative `out_dir` is resolved against the folder that contains the parameter file. Any parameter can also be given on the command line, where it overrides the parameter file, for example `jumplion jumplion.params --mass-calibration 0`.

#### Quick start with the demo data
1. Download the demo inputs (see [**Demo**](#demo)).
2. Run `jumplion --gen-params jumplion.params`.
3. In `jumplion.params`, set `input_runs`, `prec_ids` and `spec_lib` to the demo files. Optionally, set `out_dir` to the folder for the results.
4. Run `jumplion jumplion.params`.
5. When it finishes, the quantification tables are in `<out_dir>/publication` (`jumplion_results/publication` by default) (see [**Outputs**](#outputs)).

### Results viewer
After JUMPlion analysis, intermediate results such as the extracted XICs and XIC quantities can be examined in the JUMPlion viewer GUI, which can be launched from the terminal:
```bash
jumplion-viewer
```
An HTTP address will appear in the terminal. Paste it into your browser to open the interface.

The viewer asks for the analysis output directory and a sample meta file (`.csv`). The meta file must contain a `Run` column listing the run names in the order they should be displayed; any additional columns (for example, `Group`) are carried along as sample annotations.   
Example:   

|Run|Group|
|---|---|
|Run_1|A|
|Run_2|A|
|Run_3|B|
|Run_4|B|    
 

### Inputs
**1. DIA-MS Files**  
Supported mass spectrometry file formats include:
* Bruker `.d` (diaPASEF)
* Thermo Fisher `.raw`
* `.mzML` files converted from `.raw`   

**2. Precursor-Level Identification Report**    
This file is a table of the identified precursors in each run, with their retention time (RT), ion mobility (IM, for timsTOF data), q-value and the quantities reported by the search engine. It must be a `.parquet` file and must contain the following columns:

| Column | Description |
|---|---|
| `Run` | Run name; must match the names of the input MS files (without extension) |
| `Precursor.Id` | Precursor identifier (modified sequence followed by charge, for example `AAAAAAALQAK2`) |
| `RT` | Retention time (min) |
| `IM` | Ion mobility; required for Bruker `.d` data only |
| `Q.Value` | Precursor-level q-value |
| `Precursor.Quantity` | Precursor quantity reported by the search engine |
| `Precursor.Normalised` | Normalised precursor quantity |
| `Protein.Group` | Protein group of the precursor |
| `PG.MaxLFQ` | Protein group quantity (MaxLFQ) reported by the search engine |

A DIA-NN report (for example, `report.parquet`) contains all of these columns and can be used directly. Identification results from other search engines must be converted to this format.

**3. Spectral library**  
The spectral library provides the information needed to extract XICs from raw data. It must be a DIA-NN-style `.parquet` library (for example, `report-lib.parquet`), with one row per product ion of each precursor. The following columns are used:   

| Column | Description |
|---|---|
| `Precursor.Id` | Precursor identifier; must match `Precursor.Id` in the identification report |
| `Modified.Sequence` | Modified peptide sequence |
| `Precursor.Mz` | Precursor m/z |
| `Precursor.Charge` | Precursor charge |
| `RT` | Library retention time |
| `IM` | Library ion mobility; required for Bruker `.d` data only |
| `Fragment.Mz` | Product ion m/z |
| `Relative.Intensity` | Product ion intensity in the library |
| `Fragment.Type` | Ion type (`b` or `y`) |
| `Fragment.Charge` | Product ion charge (assumed to be 1 if absent) |
| `Fragment.Series.Number` | Ion series number |
| `Protein.Group`, `Protein.Ids`, `Protein.Names`, `Genes` | Protein annotation of each precursor |

Decoy precursors (an `isDecoy`/`Decoy` column) are removed automatically.   

### Demo
To test run JUMPlion using demo data, you can download all required inputs from the following link:
https://drive.google.com/drive/folders/1Ew8SVq0riDzyl5rywLWcTfUmfcPSglld?usp=drive_link

The data are derived from the following published study:
Wang, J., Huang, Y., Lu, F., et al. Benchmarking informatics workflows for data-independent acquisition single-cell proteomics. Nature Communications 16, 10276 (2025).
https://doi.org/10.1038/s41467-025-65174-4

The expected runtime for the demo on a standard desktop computer is approximately 15 minutes.

### Outputs
All results are written to `out_dir`, which is organized into two folders:  
* **publication**: the final quantification results
  * `prec_matrix_jumplion.tsv`: precursor-level quantities re-quantified by JUMPlion (precursors × runs)
  * `prec_matrix_diann_jumplion.tsv` and `prec_matrix_diann_jumplion_norm.tsv`: precursor-level quantities combining the search engine's and JUMPlion's values, without and with normalization
  * `prot_matrix_jumplion.tsv`: protein-level quantities from JUMPlion
  * `prot_matrix_diann_jumplion.tsv` and `prot_matrix_diann_jumplion_rm1hw.tsv`: protein-level quantities combining the search engine's and JUMPlion's values, without and with removal of one-hit-wonder proteins
  * `prec_matrix_diann.tsv`, `prot_matrix_diann.tsv`: precursor and protein quantities taken from the identification report
  * `xic_quantification.parquet`: XIC-level quantification results
* **intermediate**: mass calibration and RT/IM prediction results, the extracted XIC data of each run (`xic_files/`), precursor quantities at each MS level (`prec_quant/`) and the precursor RT/IM table used by later steps. The results viewer reads this folder.

### Parameters
The table below lists all parameters and commands supported by JUMPlion. 
  
| Category | Parameter | Command | Description | Values |
|---|---|---|---|---|
| **Inputs** | input_runs | --input-runs | Paths to DIA-MS files. Supports `.raw`/`.mzML` files for Thermo instruments and diaPASEF `.d` files for timsTOF instruments. | |
|  | prec_ids | --prec-ids | Path to the precursor-level identification table. | |
|  | spec_lib | --spec-lib | Path to the spectral library (DIA-NN-style `.parquet` file). | |
| **Output** | out_dir | --out-dir | Directory where output files will be saved. A relative path is resolved against the folder of the parameter file (or the current directory on the command line). | default: `jumplion_results` |
| **Reuse existing results** | skip_id_processing | --skip-id-processing | Skip the ID result processing step and use previously saved filtered spectral library and precursor RT/IM table. | 0 = no, 1 = yes, default: 0 |
|  | use_saved_xic | --use-saved-xic | Use existing XIC files generated by a previous analysis to save time. | 0 = no, 1 = yes, default: 0 |
|  | use_xic_quant | --use-xic-quant | Use an existing XIC-level quantification report file. | 0 = no, 1 = yes, default: 0 |
| **ID results processing** | min_runs_quant | --min-runs-quant | Minimum number of runs in which a precursor must be identified to be quantified. | default: 3 |
|  | min_runs_model_frac | --min-runs-model-frac | Minimum fraction of runs in which a precursor must be identified to be used as an anchor for building the RT/IM prediction models (at least 3 runs are always required). | default: 0.5 |
|  | min_runs_cal_frac | --min-runs-cal-frac | Minimum fraction of runs in which a precursor must be identified (at the q-value cutoff below) to be used for mass calibration. | default: 0.8 |
|  | max_qvalue_cal | --max-qvalue-cal | Maximum q-value (FDR) for a precursor to be used for mass calibration. | default: 0.01 |
|  | max_mass_cal | --max-mass-cal | Maximum number of precursors used for mass calibration. | default: 5000 |
| **XIC extraction** | min_xic_points_half | --min-xic-points-half | Number of data points to extract on each side of the apex for an XIC. | default: 15 |
|  | mass_calibration | --mass-calibration | Whether to perform mass calibration. | 0 = no, 1 = yes, default: 1 |
|  | mass_cal_acc | --mass-cal-acc | Calibration mass accuracy (ppm). | default: 30.0 |
|  | fix_mass_acc | --fix-mass-acc | Whether to use fixed MS1/MS2 mass accuracy. | 0 = no, 1 = yes, default: 0 |
|  | mass_acc_ms2 | --mass-acc-ms2 | MS2 mass accuracy (ppm). | default: 15.0 |
|  | mass_acc_ms1 | --mass-acc-ms1 | MS1 mass accuracy (ppm). | default: 15.0 |
|  | individual_mass_acc | --individual-mass-acc | Whether to determine MS1/MS2 mass accuracy for each individual run. | 0 = no, 1 = yes, default: 0 |
|  | im_window_cal | --im-window-cal | IM window used for calibration. | default: 0.03 |
|  | fix_im_window | --fix-im-window | Whether to use a fixed IM window. | 0 = no, 1 = yes, default: 0 |
|  | im_window | --im-window | IM window. | default: 0.01 |
|  | individual_im_window | --individual-im-window | Whether to determine the IM window for each individual run. | 0 = no, 1 = yes, default: 0 |
|  | max_prec_num | --max-prec-num | Maximum number of precursor XICs (monoisotopic + isotopic) to extract. | default: 5 |
|  | min_prod_num | --min-prod-num | Minimum number of product ions required for a precursor to be quantified. | default: 3 |
|  | max_prod_num | --max-prod-num | Maximum number of product ions used for precursor quantification. | default: 12 |
| **XIC quantification** | optimal_xic_source | --optimal-xic-source | MS level used to define the optimal XIC. | `ms1_ms2` = MS1/MS2, `ms1` = MS1 only, `ms2` = MS2 only, default: `ms1_ms2` |
|  | intf_removal | --intf-removal | Whether to perform interference removal for an XIC. | 0 = off, 1 = on, default: 1 |
|  | intf_factor_ms1 | --intf-factor-ms1 | Interference filtering factor for MS1-level XICs. | default: 1.2 |
|  | intf_factor_ms2 | --intf-factor-ms2 | Interference filtering factor for MS2-level XICs. | default: 1.5 |
| **Precursor quantification** | use_raw_ms1 | --use-raw-ms1 | Whether to use raw MS1-level XIC quantities when summarizing to the precursor-level. | 0 = no, 1 = yes, default: 0 |
|  | use_raw_ms2 | --use-raw-ms2 | Whether to use raw MS2-level XIC quantities when summarizing to the precursor-level. | 0 = no, 1 = yes, default: 1 |
| **Precursor normalization** | normalization | --normalization | Whether to perform normalization at the precursor level. | 0 = off, 1 = on, default: 1 |
|  | norm_species | --norm-species | Species of peptides used for intensity normalization. | default: HUMAN |
|  | norm_method | --norm-method | Normalization method. | `median` or `mean`, default: `median` |
|  | trim_percentage | --trim-percentage | Percentage trimmed from each side for normalization. | default: 5 |
| **Protein quantification** | prec_quant_level | --prec-quant-level | Level of precursor quantification used for protein summarization. | `ms1_ms2` = MS1/MS2 integration, `ms1` = MS1 only, `ms2` = MS2 only, default: `ms1_ms2` |
|  | min_prec_count | --min-prec-count | Minimum number of precursors required for a protein to be retained in the final quantification table. | default: 2 |
|  | min_pep_count | --min-pep-count | Minimum number of peptides required for a protein to be retained in the final quantification table. | default: 1 |


### License and acknowledgments
JUMPlion is released under the [Apache License 2.0](LICENSE). It includes or builds on the following third-party components, which remain under their own licenses:
* **iq** (MaxLFQ): the MaxLFQ protein quantification is a C++ port of the algorithm in the R package [iq](https://github.com/tvpham/iq) by Thang V. Pham, distributed under the BSD 3-Clause License (see `jumplion/_iq_native/LICENSE.txt`).
* **Eigen**: a trimmed copy of the header-only linear algebra library [Eigen](https://eigen.tuxfamily.org), licensed under the Mozilla Public License 2.0 (see `jumplion/_iq_native/thirdparty/eigen/LICENSE.txt`), is bundled for building the native extension.
* **Thermo Fisher RawFileReader**: the Thermo `.raw` files are read with the Thermo Fisher RawFileReader assemblies bundled in `jumplion/ext/thermo_fisher`, which are subject to the Thermo license agreement in `THERMO_LICENSE.txt`.
* **AlphaRaw and AlphaTims**: the Thermo `.raw` and Bruker `.d` reader scripts (`jumplion/ext/alpharaw_thermo.py` and `jumplion/ext/alphatims_bruker.py`) are adapted from [AlphaRaw](https://github.com/MannLabs/alpharaw) and [AlphaTims](https://github.com/MannLabs/alphatims) by the Mann Labs, both licensed under the Apache License 2.0.
* **Bruker TDF-SDK**: Bruker timsTOF `.d` data (`.tdf` and `.tsf` files) are read through the `timsdata` library of Bruker's TDF-SDK, bundled in `jumplion/ext/bruker` (`timsdata.dll` and `timsdata.so`), which is subject to Bruker's license terms. The data are also read with [timsrust](https://github.com/MannLabs/timsrust) through `timsrust_pyo3`.
