Graphical Abstract
End-to-end harmonization from heterogeneous multi-pipeline outputs to clean non-redundant protein search databases, 8–15mer MHC target lists, and complete provenance/exclusion audit ledgers.
Multi-Pipeline Normalization
Native adapters for Isovar, Topiary, Vaxrank, Exacto, pVACtools, LENS, nf-core/epitopeprediction, nextNEOpi, and SNAF — plus RNA depth/VAF filtering and VEP alt-isoform collapsing.
Patient Germline & WT Marking
Checks canonical GRCh38 WT proteomes and patient-specific germline VCFs, germline SVs (Manta/Severus), and normal FASTAs via varcode. Marks matches by default (--germline-action mark, --wt-action mark) so germline leakage is visible rather than silently hidden.
Uniform mhctools Rescoring
Delegates parallel scoring to mhctools (NetMHCpan42, MHCflurry, MixMHCpred, BigMHC_EL, CapHLA_EL) with on-disk caching and allele-consistent union/intersection cutoffs.
Strict Audit Trails
Nothing is silently dropped: MHC/paralog noise, superseded unphased single-SNVs, germline self matches, zero-peptide proteins, filtered classes, and exact/substring/alt-isoform mappings are logged in audit/ alongside SHA256SUMS.txt.
Supported Pipelines & What Each One Does
Each neoantigen pipeline starts from different inputs, makes different phasing and RNA-expression assumptions, and covers different antigen classes. tsamerge ingests their native outputs directly so you can combine complementary strengths and audit every difference.
| Pipeline | Inputs | Core Engine & Antigen Scope | Native Outputs & CLI Flags |
|---|---|---|---|
| Isovar | Somatic VCF + tumor RNA BAM (+ optional orfdata ncORF catalog) |
RNA read-backed assembly & phasing: phases cis co-somatic & germline edits directly from RNA reads; translates expressed SNVs, cis-MNVs, indels, frameshifts, mitochondrial (Table 2), and ncORFs. | FASTA + .proteins.tsv, native CSV, isovar-protein-hypotheses JSON/TSV--isovar, --isovar-tsv, --isovar-csv, --isovar-hypotheses |
| Topiary | Somatic VCF (+ optional expression table) + HLA alleles | DNA-only varcode translation + mhctools: translates coding SNVs, indels, and frameshifts directly from reference Ensembl transcripts (plus optional CTA/tissue/FASTA sources). | ProteinFragment TSV (preserving exact target_intervals)--topiary-fragments |
| Vaxrank | Somatic VCF + tumor RNA BAM + HLA alleles | Personalized vaccine ranking built on Isovar + mhctools: assembles RNA-expressed mutant proteins, filters reference self-hits, ranks 25-aa vaccine windows by expression × MHC binding & manufacturability. | Ranked vaccine_peptides.csv--vaxrank-csv |
| Exacto | Tumor/normal WGS + long/short-read RNA-seq (end-to-end) | Proteoform-first reconstruction: integrates somatic DNA (S*) and full-length RNA transcripts across SNVs, cis-MNVs, indels, frameshifts, gene fusions, novel splices, and novel ORFs. |
*_proteoform_list.tsv & FASTA (with S*-DNA somatic segment filtering)--exacto, --exacto-tsv |
| pVACtools (pVACseq / pVACfuse / pVACsplice) |
VEP-annotated somatic VCF (Wildtype/Frameshift plugins), fusion calls, or splice junctions + HLA alleles |
VEP-driven isoform translation & multi-predictor scoring: covers SNVs, indels, frameshifts, proximal-phased variants (pVACseq), fusions (pVACfuse), and aberrant splicing (pVACsplice); optional RNA depth/VAF filter. | MT.* FASTAs + *.all_epitopes.tsv (with VEP alt-isoform collapsing)--pvacseq, --pvacseq-epitopes-tsv, --pvacfuse, --pvacsplice |
| LENS | Tumor/normal WGS + tumor RNA-seq (end-to-end RAFT/Nextflow workflow) | Broad multi-source TSA discovery: runs integrated calling across SNVs, indels/frameshifts, STAR-Fusion chimeras, novel splice junctions, CTAs, viral antigens, and ERVs. | *.lens.base_report.tsv--lens |
| nf-core/epitopeprediction | Somatic VCF (or protein FASTA / peptide TSV) + HLA alleles | Nextflow DNA-variant epitope workflow: predicts MHC binders from coding SNVs, indels, and frameshifts via epytope (v3.1) or offline VEP + pVACtools with optional germline context (v3.2+). |
Per-sample epitope prediction TSV--nfcore-epitopeprediction |
| nextNEOpi | Raw tumor/normal DNA + tumor RNA FASTQs/BAMs (end-to-end Nextflow) | Full end-to-end neoantigen & immunogenicity workflow: performs alignment, consensus variant calling, HLA typing, clonality, phasing, and MHC Class I/II epitope prediction. | Candidate epitope TSV/CSV--nextneopi |
| SNAF | Tumor RNA-seq splice junctions + normal tissue reference (GTEx) | Splicing neoantigen framework: identifies tumor-specific aberrant splicing junctions and translates T-cell neoepitopes absent from normal tissues. | T_candidates.txt / TSV--snaf |
| Any Custom Pipeline | Any mutant protein or peptide FASTA | Generic adapter: brings in custom proteogenomics, Ribo-seq, or in-house pipelines under any chosen pipeline name and antigen class. | FASTA--fasta PIPELINE:PATH[:CLASS] |
Antigen Taxonomy & Class-Aware WT Subtraction
Control exactly which antigen classes enter your search space without accidentally erasing canonical cancer-testis antigens during human proteome subtraction.
| Coarse Group | Fine-Grained Classes | Canonical WT Subtraction | Behavior |
|---|---|---|---|
mutant |
missense_snv, cis_mnv_phased, inframe_indel, frameshift, gene_fusion, novel_splice, mitochondrial, noncanonical_orf |
Yes | Extracts only peptides spanning ≥ 1 mutated residue, deletion, or fusion junction that are absent from the canonical human WT proteome (optional --il-indistinguishable for MS). |
cta |
cta (canonical self-restricted), cta_alt_isoform |
cta: No · cta_alt_isoform: Yes |
Preserves canonical expression-restricted self CTA peptides; aligns novel CTA isoforms to highlight isoform-specific junctions. |
viral |
viral |
Yes | Marks all foreign residues uppercase while subtracting accidental matches to the human WT proteome. |
erv |
erv |
Yes | Retains endogenous retroelement ORF peptides absent from canonical human reference proteins. |
Built-in presets: all-tsa, mutant-only, canonical-mutant,
mutant-plus-viral, mutant-plus-cta-viral, non-mutant-only.
Combine freely with --include-group, --include-class,
--exclude-group, and --exclude-class.
Usage Guide
1. Install
git clone https://github.com/pirl-unc/tsamerge.git
cd tsamerge
pip install -e ".[all]" # includes pyensembl, mhctools, mhcflurry
2. End-to-End 4-Way Mutant Merge + mhctools Rescoring
Use a single --ensembl-release 115 when all pipelines share one GRCh38 annotation, or pass
multiple releases (--ensembl-release 87 107 115 or 87,107,115) when harmonizing
pipelines run on different Ensembl snapshots.
tsamerge merge \
--sample-id COLO829 \
--isovar COLO829.fasta --isovar-tsv COLO829.proteins.tsv \
--exacto-tsv COLO829_antigen_prediction_proteoform_list.tsv \
--pvacseq COLO829.full_proteins.fasta \
--pvacseq-epitopes-tsv COLO829.MHC_I.all_epitopes.tsv \
--pvacseq-min-rna-depth 1 --pvacseq-min-rna-vaf 0.0001 \
--lens COLO829.lens.base_report.tsv \
--preset mutant-only \
--ensembl-release 87 107 115 --wt-action filter \
--germline-vcf patient_germline.vcf.gz --germline-sv-vcf diploidSV.vcf.gz \
--germline-action mark --germline-cache-fasta germline_self_cache.fasta \
--min-peptide-length 8 --max-peptide-length 15 \
--il-indistinguishable \
--alleles HLA-A*01:01 HLA-B*08:01 HLA-B*40:02 HLA-C*03:04 HLA-C*07:06 \
--predictor NetMHCpan42 MHCflurry \
--score-cache COLO829_scores_cache.tsv \
--selection-mode union --netmhcpan-rank-cutoff 2.0 --mhcflurry-pct-cutoff 2.0 \
--collapse-alt-isoforms --filter-proteins-with-peptides \
--output-dir COLO829_bundle
3. Include CTAs & Viral Antigens
tsamerge merge \
--sample-id SAMPLE1 \
--isovar mutants.fasta --isovar viral.fasta --isovar cta.fasta \
--lens lens_report.tsv \
--preset mutant-plus-cta-viral \
--ensembl-release 115 \
--alleles HLA-A*02:01 HLA-B*07:02 \
--predictor NetMHCpan42 MHCflurry \
--output-dir SAMPLE1_all_tsa
4. Standalone Peptide Rescoring
tsamerge score \
--peptides candidates.fasta \
--alleles HLA-A*01:01 HLA-C*03:04 \
--predictor NetMHCpan42 MHCflurry \
--output-tsv scored_peptides.tsv
Anchor-Filtered Residue Marking (wt_lower_mut_UPPER)
Unconstrained edit-distance alignment produces spurious 1–3 aa coincidences and artificial |
deletion gaps on frameshift and novel-splice tails. tsamerge requires genuine homologous
≥ 6-aa collinear WT anchor blocks, cleanly marking unanchored diverged sequence as all-UPPERCASE.
| Event Type | Unconstrained Edit Alignment | tsamerge (wt_lower_mut_UPPER) |
Annotation |
|---|---|---|---|
| Missense SNV (SF3B1) | aalaeaatL |
aalaeaatL |
mut_pos=9, n_mut=1, wt=AALAEAATP |
| Novel Splice (ALDOA) | AAp|nTpGpap|ssG|l (spurious) |
AAPNTPGPAPSSGL |
mut_pos=1-14, n_mut=14, wt=none_novel_splice |
| Frameshift (CDKN2A) | aellllhgG|aQ|l (spurious) |
aellllhgGAQL |
mut_pos=9-12, n_mut=4 |
| Fusion Tail (EIF3K--CYP39A1) | rrrDFSVEENFF |
rrrDFSVEENFF |
mut_pos=4-12, n_mut=9 |
Python API
from tsamerge import (
AntigenFilter,
MHCflurryScorer,
MHCToolsScorer,
NetMHCpanScorer,
ReferenceProteome,
SelectionCriteria,
align_protein_to_wt,
collapse_alt_isoforms,
export_multi_sample_bundle,
extract_target_peptides,
flag_artifacts,
load_exacto_proteoform_tsv,
load_isovar_fasta,
load_lens_report,
load_pvacseq_fasta,
merge_sources,
score_and_filter_peptides,
summarize_proteins_from_peptides,
)
# Combine any mhctools scorers (NetMHCpan42, MHCflurry, MixMHCpred, BigMHC_EL, ...)
kept, excluded, raw = score_and_filter_peptides(
peptides,
alleles=["HLA-A*01:01", "HLA-B*08:01", "HLA-C*03:04"],
scorers=[
NetMHCpanScorer(),
MHCflurryScorer(use_flanks=False),
MHCToolsScorer.from_name("MixMHCpred"),
],
criteria=SelectionCriteria(mode="union", max_netmhcpan_rank_el_pct=2.0, max_mhcflurry_presentation_pct=2.0),
score_cache="scores_cache.tsv",
)