Metadata-Version: 2.4
Name: gapms
Version: 1.4.1
Summary: Gene model assessment and peptide-guided annotation refinement
Author-email: Qussai Abbas <qussai.abbas@tum.de>
License-Expression: MIT
Project-URL: Homepage, https://github.com/qussai96/GAP-MS
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD_PARTY.md
Requires-Dist: peplocus==0.7.0
Requires-Dist: pandas>=1.5
Requires-Dist: scipy>=1.10
Requires-Dist: scikit-learn>=1.2
Requires-Dist: matplotlib>=3.6
Requires-Dist: xgboost-cpu<4,>=2.1.4; platform_system == "Linux"
Requires-Dist: xgboost<4,>=2.1.4; platform_system != "Linux"
Dynamic: license-file

# GAP-MS

GAP-MS uses mass-spectrometry peptides to assess gene predictions, combine
annotations and identify peptide-supported changes for review.

## Install

Python 3.10 or newer:

```bash
pip install gapms
```

For runs with a BAM file, also install the RNA reconstruction tools:

```bash
conda install -c conda-forge -c bioconda stringtie transdecoder=5.5.0
```

TransDecoder 7, which keeps `TransDecoder.LongOrfs`/`TransDecoder.Predict` in its
`util/` folder, is also found automatically.

Or use the Apptainer image, which includes the RNA reconstruction tools:

```bash
apptainer pull gapms.sif oras://docker.io/qussaiab96/gapms:latest
apptainer run gapms.sif -a assembly.fa -p peptides.tsv -g genes.gtf
```

See [container instructions](docs/CONTAINERS.md) for Docker Hub.

## Run

- **Assembly + peptides:**
map peptides to the six-frame genome translation.
  `gapms -a assembly.fa -p peptides.tsv`
- **Add BAM:**
include RNA-supported splice paths and reconstruct peptide-supported ORF candidates.
  `gapms -a assembly.fa -p peptides.tsv -b sorted.bam`
- **Add annotation:**
map across annotated exons, score gene models and propose supported changes.
  `gapms -a assembly.fa -p peptides.tsv -g genes.gtf`
- **Annotation + BAM:**
combine gene-model assessment with RNA-supported reconstruction.
  `gapms -a assembly.fa -p peptides.tsv -g genes.gtf -b sorted.bam`
- **Multiple annotations:**
automatically build a peptide-guided consensus. BAM is optional here too.
  `gapms -a assembly.fa -p peptides.tsv -g helixer.gtf -g another.gff3`

GTF, GFF2 and GFF3 are accepted, plain or gzipped, e.g. from NCBI, Ensembl, GENCODE,
BRAKER/AUGUSTUS, GALBA, GeneMark, Helixer, Tiberius, ANNEVO, MAKER and EVM. The stop
codon may be inside the CDS, in `stop_codon` rows or not annotated at all: GAPMS always
includes it in the CDS, also in its outputs. Transcripts that cannot be used (unknown
contig, coordinates outside the contig, no strand) are skipped, not fatal;
`diagnostics/reports/annotation_input_report.tsv` lists them. Models with an internal
stop codon or overlapping CDS (ribosomal slippage) still explain peptides but are not
consensus candidates; annotated selenocysteines are read as U.

BAM files must be coordinate-sorted and use the assembly's sequence names. With several annotations and a BAM, an index is needed:
GAPMS builds one in its work folder when the BAM can be hard-linked there, and
otherwise stops at once asking for `samtools index`. FragPipe, Casanovo and plain peptide lists are supported.
Use `-o results` to choose an output directory (default: `./GAPMS_output`) and
`-t 16` to change the default of **8 threads**.

Analysis uses **trypsin-compatible exact matches** by default; add `--non-tryptic`
for other enzymes. Peptides of at least **6 residues** are searched (`--min-length`).
Isoleucine and leucine are treated as equivalent. All-match and
tryptic-match BED tracks are always retained. Optional one-edit rescue is separate
from the exact evidence used to support gene models. See `gapms --help-all`.

## Results

Start with **report.html**; **report.log** records the run. Main outputs include
`peptides.bed`, `peptides.tryptic.bed`, `peptides.igv.bed`,
`unmapped_peptides.tsv`, and, when gene models are available,
`all_proteins_scores.tsv` and `supported_genes.gtf`. Multiple annotations also
produce `consensus.gff3` and `consensus_proteins.faa`.

`review/candidates.tsv` lists one row per proposed feature (alternative start, stop
or splice, terminal extension, novel ORF) with a `confidence` and reason codes;
the `review/*.gff3` files contain the supported proposals only. They require review
and are not automatically applied. A peptide supports a change only if no supplied
annotation explains it at that locus and it has a single genomic locus over all
exact matches (isoforms of one gene count once). Peptide length is reported, not
filtered: the run summary gives decoy-estimated false-discovery rates by peptide
length to judge chance matches of short peptides. Without an input annotation, RNA-derived
ORFs are candidates whose novelty cannot be assessed. ORFs are sought on the sense strand
of stranded transcripts and on both strands of unstranded ones. Peptide support does not
validate every boundary of a gene model.

## Cite

[GAP-MS manuscript](https://www.biorxiv.org/content/10.64898/2026.03.17.712294v3)
