LucXor is a Python implementation of the LuciPHOr2 algorithm for accurate post-translational modification (PTM) localization with probabilistic scoring and false localization rate (FLR) estimation. It provides a comprehensive two-stage workflow for confident PTM site assignment with statistical validation.
LucXor implements a sophisticated two-stage approach:
| Parameter | Default | Description |
|---|---|---|
fragment_method |
“CID” | Fragmentation method (CID or HCD) |
fragment_mass_tolerance |
0.5 | Fragment mass tolerance |
fragment_error_units |
“Da” | Tolerance units (Da or ppm) |
min_mz |
150.0 | Minimum m/z value to consider |
target_modifications |
[“Phospho (S)”, “Phospho (T)”, “Phospho (Y)”] | Target modifications |
neutral_losses |
[“sty -H3PO4 -97.97690”] | Neutral loss definitions |
decoy_mass |
79.966331 | Mass for decoy generation |
max_charge_state |
5 | Maximum charge state |
max_peptide_length |
40 | Maximum peptide length |
max_num_perm |
16384 | Maximum permutations |
modeling_score_threshold |
0.95 | Minimum score for modeling |
min_num_psms_model |
50 | Minimum PSMs for modeling |
threads |
4 | Number of threads |
rt_tolerance |
0.01 | Retention time tolerance |
class FLRCalculator:
"""
Calculates false localization rates using decoy distributions.
"""
def __init__(self, min_delta_score=0.1, min_psms_per_charge=50):
self.min_delta_score = min_delta_score
self.min_psms_per_charge = min_psms_per_charge
def calculate_flr_estimates(self, psms):
"""Calculate FLR estimates from decoy distributions."""
# Implementation details...
def assign_flr_to_psms(self, psms):
"""Assign FLR values to PSMs based on estimates."""
# Implementation details...
class CoreProcessor:
"""
Main processor for scoring PSMs and calculating FLR.
"""
def process_all_psms(self):
"""Process all PSMs using two-stage workflow."""
# Stage 1: Calculate FLR estimates
self._process_psms_stage1()
# Stage 2: Assign FLR values
self._process_psms_stage2()
class PSM:
"""
Peptide Spectrum Match with localization scoring.
"""
def process(self, config_dict):
"""Process PSM with real and decoy permutations."""
# Implementation details...
def process_stage2(self, config_dict):
"""Process PSM with only real permutations."""
# Implementation details...
# Basic usage
onsite lucxor -in spectra.mzML -id identifications.idXML -out results.idXML
# With custom parameters
onsite lucxor -in spectra.mzML -id identifications.idXML -out results.idXML \
--fragment-method HCD \
--fragment-mass-tolerance 0.5 \
--fragment-error-units Da \
--threads 8 \
--debug
from onsite.lucxor.cli import PyLuciPHOr2
from onsite.lucxor.psm import PSM
from onsite.lucxor.peptide import Peptide
from onsite.lucxor.models import CIDModel, HCDModel
from onsite.lucxor.spectrum import Spectrum
from onsite.lucxor.flr import FLRCalculator
# Initialize the main processor
processor = PyLuciPHOr2()
# The processor will parse command line arguments automatically
# For programmatic use, you can also use the core components directly
from onsite.lucxor.core import CoreProcessor
from onsite.lucxor.config import LucXorConfig
from onsite.lucxor.psm import PSM
from onsite.lucxor.spectrum import Spectrum
# Custom configuration
config = LucXorConfig()
config.fragment_method = "HCD"
config.fragment_mass_tolerance = 0.5
config.fragment_error_units = "Da"
config.threads = 4
# Initialize processor
processor = CoreProcessor(config)
# Process PSMs
psm_list = [PSM(...)] # Your PSM objects
spectrum_map = {...} # Your spectrum mapping
results = processor.process_all_psms(psm_list, spectrum_map)
The tool generates an idXML file containing:
SpectrumID,Peptide,ModifiedPeptide,Score,DeltaScore,GlobalFLR,LocalFLR,IsDecoy
1,PEPTIDE,PEPTIDE(Phospho),0.95,0.85,0.05,0.02,0
2,PEPTIDE,PEPTIDE(Phospho),0.90,0.80,0.10,0.05,0
max_peptide_length or use fewer threadsFermin, D., Walmsley, S. J., Gingras, A. C., Choi, H., & Nesvizhskii, A. I. (2013). LuciPHOr: algorithm for phosphorylation site localization with false localization rate estimation using modified target-decoy approach. Molecular & Cellular Proteomics, 12(11), 3409-3419.
DOI: 10.1074/mcp.M113.028928
Fermin, D., Avtonomov, D., Choi, H., & Nesvizhskii, A. I. (2015). LuciPHOr2: site localization of generic post-translational modifications from tandem mass spectrometry data. Bioinformatics, 31(7), 1141-1143.
DOI: 10.1093/bioinformatics/btu788
| Feature | AScore | PhosphoRS | LucXor |
|---|---|---|---|
| Statistical Framework | Binomial | Binomial | FLR-based |
| Site-Determining Ions | Yes | Yes | Yes |
| FLR Estimation | No | No | Yes |
| Two-Stage Processing | No | No | Yes |
| Decoy Support | Optional | Optional | Required |
| Multi-threading | Yes | Limited | Yes |
| Memory Usage | Low | Medium | High |
| Accuracy | High | High | Very High |