Antigen-specific technical details
This page focuses on antigen-source-specific implementation details and design notes for the standard off-the-shelf human LENS workflow. For the documented defaults, see Off-the-shelf defaults. For the interactive workflow overview, see Workflow flowchart.
Somatic Nucleotide Variants (SNVs)
Somatic single-nucleotide variants (SNVs), or variants present within tumor tissue but absent from germline tissue, can be a source of tumor-specific immunogenic peptides.
This section describes:
How LENS generates a set of patient-specific predicted SNV-derived peptides from filtered VCFs.
Provides explanations for design decisions.
Lists shortcomings and caveats of the current approach (and their planned fixes).
General and technical notes.
Variant calling
In the standard human profile, somatic SNVs are called using two variant callers:
mutect2andstrelka2.mutect2raw VCFs are processed through the variant filtering workflow (raw VCFs -> LearnReadOrientationModel -> GetPileupSummaries -> CalculateContamination -> FilterMutectCalls).Germline variants are called using
deepvariant.
Variant filtering
Resulting somatic and germline VCFs are filtered using
bcftools.In the standard human profile,
mutect2andstrelka2both use the effective filterFILTER="PASS".strelka2uses its empirical scoring (EVS) module.mutect2uses FilterMutectCalls.deepvariantuses its internal variant qualifying strategy.
Note
To modify the variant filtering strategy, for example by adding hard
filters, use
params.lens$somatic$som_vars_to_filtd_som_vars$vcf_filtering_tool_parameters.
These filters are applied on a per-caller basis. For example:
params.lens$somatic$som_vars_to_filtd_som_vars$vcf_filtering_tool_parameters = "['mutect2': '-i \'FILTER=\"PASS\" && INFO/TLOD>6.3 && FORMAT/DP[0]>=10 && FORMAT/AD[0:1]>=3\'', 'strelka2': '-i \'FILTER=\"PASS\" && INFO/SomaticEVS>12 && FORMAT/DP[0]>=8\'']"
Variant combining
The standard human profile combines somatic variant calls with a union strategy
using jacquard. jacquard is called with parameters
--include_format_tags="GT,AF,AU,CU,GU,TU,TAR,TIR,FREQ,VAF,DP,AD".
Variant annotation
The unioned somatic VCF is annotated using snpEff.
Filtering variants for expression
A salmon quant.sf file (from the patient’s tumor RNA sequencing data),
the annotated unioned somatic VCF, and the standard profile setting
-p 50 --exclude-zeros are used to create a list of transcripts harboring
somatic SNVs (and InDels) that meet the configured expression threshold.
Phasing variants with read-backed phasing
Read-backed phasing is performed for tumor and normal tissues separately using
whatshap. The tumor phased VCF is created by phasing (using tumor DNA and
tumor RNA reads) somatic variants and germline variants. Germline phased VCF is
created by phasing (using normal DNA reads) germline variants.
Creating variant-specific VCFs
Variant-specific VCFs are generated from the tumor and germline phased VCFs.
LENS does this separately for tumor and germline VCFs, to build the variant context within the tumor around the variant of interest and the matching normal variant context at the same genomic position. Variant-specific VCFs include the somatic variant of interest as well as any variants that are either germline homozygous or germline heterozygous phased with the variant of interest.
Variant-specific VCF and haplotype logic
For each somatic variant of interest (VOI), LENS builds a variant-specific VCF for tumor and normal contexts using phased VCFs.
Current behavior (as implemented in lenstools_make_variant_specific_vcfs):
Always include the VOI itself.
Include homozygous alternate variants (
GT="AA") on the VOI chromosome.If the VOI has a usable numeric phase set (
PS), include additional variants with matchingPSon the VOI chromosome.
This preserves the local phased context around each VOI while retaining homozygous alterations that affect both haplotypes.
Creating variant-specific, transcript-specific sequences
Exonic sequences from expressed transcripts harboring somatic variants of
interest are extracted from the reference FASTA using the annotation GTF and
samtools faidx into a BED file. The BED file is provided to samtools
faidx to create a FASTA in which each entry is an exon sequence from an
expressed transcript harboring a somatic variant of interest. The exonic FASTA
file is combined with each variant-specific VCF to create the tumor and normal
sequences for each transcript.
for each variant in annotated, unioned VCF:
for each transcript listed in variant's annotation:
if transcript is listed as expressed:
apply all variants (focal somatic and neighboring germline) to transcript's exonic sequences using bcftools consensus
store resulting exonic sequences into variant-specific, transcript-specific, tissue-specific FASTA
Creating SNV-derived peptides
The unioned annotated VCF and transcript- and variant-specific exonic FASTAs
are combined to create SNV-derived peptides with
lenstools make-snv-peptides-context.
for each somatic SNV of interest:
for each expressed transcript harboring SNV:
concatenate exonic sequences from transcript to create full transcript
extract region of interest from transcript (based on snpEff information)
if tumor sequence:
translate and store peptide in *mt_aa.fa
store DNA coding sequence in *mt_nt.fa
if normal sequence:
translate and store peptide in *wt_aa.fa
Note
Peptides are tagged with checksums (calculated by variant position, transcript, ref allele, and alt allele) for downstream identification.
Calculating binding affinity and presentation score
The tumor sequences are processed by mhcflurry.
Peptide quantification using RNA reads
Each peptide’s DNA coding sequence (from lenstools
make-snv-peptides-context) is combined with the patient’s RNA sequencing
reads for peptide quantification. RNA reads that fully overlap the peptide’s
genomic origin (and are therefore capable of containing the full coding
sequence) are queried for the coding sequence. A count of reads containing the
coding sequence is included as the
rna_reads_covering_genomic_origin_with_peptide_cds value. A subset of these
reads will be primary alignments and may be a better representation of the
actual transcript abundance of the peptide’s coding sequence. The count of
primary alignments containing the coding sequence is the
primary_aln_rna_reads_covering_genomic_origin_with_peptide_cds value.
Shortcomings and caveats
The standard human profile uses a union of somatic callers rather than a caller-consensus requirement. This improves sensitivity but can retain caller-specific false positives if upstream filters are relaxed.
Expression filtering is transcript-level and quantification-driven. A transcript passing the expression threshold does not guarantee that the specific mutant allele is strongly expressed.
Read-backed phasing depends on the availability of informative tumor and normal reads. Variants without useful phase support may be evaluated with reduced haplotypic context.
Peptide generation depends on transcript models present in the supplied annotation and protein-reference resources. Variants whose relevant coding context is missing from those resources may not yield peptides.
Design decisions
The FASTAs generated by the lenstools make-snv-peptides-context step contain
headers with several pieces of metadata associated with the peptide. More
information regarding the contents and usage of the FASTA headers can be found
in the Technical section.
Notes
SNVs are described here in isolation (for example, not considering InDels), but many of the steps (for example, bedtools intersect and snpEff annotation) are performed on VCFs with all variant types (SNVs and InDels). Somatic missense SNVs are not handled in isolation until after SnpSift filtering.
Technical
MD5 checksums are used to create compact, reproducible peptide identifiers for
downstream pMHC characterization and agretopicity joins. The checksum is
performed on the string <CHR>:<POS>:<TRANSCRIPT_ID>:<REF>:<ALT>. Checksum
values are also applied to the reference peptide FASTA headers so peptides can
be matched for agretopicity calculations.
The mutant peptide FASTA header has been expanded to include a variety of
relevant metadata. These data are later included (after being matched to
binding-affinity data using the unique MD5 checksum) in the final peptide
metadata report. The mutant peptide FASTA headers include the following
information: MD5, VARIANT_POS, TRANSCRIPT, REF, ALT,
SNV_TYPE, PROTEIN_CONTEXT, and GENOMIC_CONTEXT.
An example of a mutant peptide FASTA header:
>MD5:be460b5e5095139a VARIANT_POS:chr14_69230557 TRANSCRIPT:ENST00000409242.5 REF:C ALT:[T] SNV_TYPE:missense PROTEIN_CONTEXT:TVLNFPLDKSLLLCCSNWDAETLTEDQ GENOMIC_CONTEXT:ACTGTTTTGAACTTTCCCCTTGACAAGTCCCTTCTACTTTGTTGCAGCAACTGGGATGCTGAGACTCTCACAGAGGACCAG
Somatic Insertion and Deletion Variants (InDels)
Somatic insertion/deletion variants (InDels), or variants present within tumor tissue but absent from germline tissue, can be a source of tumor-specific immunogenic peptides.
The standard human profile processes InDels through the same upstream somatic calling, annotation, expression filtering, and phasing framework used for SNVs. The InDel-specific divergence happens at peptide construction time.
InDel-specific sequence construction
For expressed somatic InDels, LENS first builds transcript-context FASTAs using the phased tumor and germline VCFs. It then extracts additional 3’ sequence context from the genomic reference for each affected transcript before peptide generation.
This extra 3’ context is used to support peptide generation for events such as frameshifts, where translation must continue beyond the immediate altered codon or codons.
Creating InDel-derived peptides
The standard human profile generates InDel-derived peptides with
lenstools make-indel-peptides-context. Inputs include:
the somatic VCF for the sample
transcript-specific FASTAs carrying tumor and normal variant context
the list of expressed transcripts harboring the InDel
transcript-specific 3’ sequence FASTAs
the canonical protein reference
The output is a mutant peptide FASTA and a matching nucleotide FASTA for downstream pMHC characterization and RNA-based peptide quantification.
Splice Variants
In the standard human profile, splice-derived candidate peptides are generated
from tumor RNA alignments using the msnaf configuration path in LENS.
This path is implemented through AltAnalyze preprocessing, mSNAF
inference, and sample-level peptide extraction.
Splice variant discovery
Tumor RNA BAMs are indexed and passed into an AltAnalyze-based preprocessing
path that converts alignments into junction-centric inputs. These junction
counts are then processed by msnaf using the configured SNAF reference
bundle.
The standard profile leaves caller-specific parameter overrides empty, so the
workflow uses its built-in defaults for splice filtering. In the current code
path, the effective default splice filter requires the event flags tracked by
the mSNAF output and applies a tumor-expression percentile threshold of
50%.
Creating splice-derived peptides
After mSNAF inference, LENS splits results back into sample-specific outputs
with split_snaf_by_sample and emits peptide FASTAs for downstream MHC
characterization. These peptide FASTAs are the standard-profile splice peptide
source used later in report generation.
Optional splice annotation
The standard human profile also enables regtools as a splice annotator.
When enabled, RegTools is run on the AltAnalyze full-count output together with
the configured GTF, reference genome, and anchor/window settings.
This produces:
junction BED files
coordinate tables
annotated junction tables
These annotations are used to add genomic context and optional cis-splice effect annotations to splice-derived report rows. They do not replace the mSNAF-based peptide-generation path.
Fusion Events
In the standard human profile, fusion discovery is performed with
starfusion using the CTAT reference bundle and the --examine_coding_effect
option.
Fusion calling
Processed tumor RNA FASTQs are provided directly to STAR-Fusion. The resulting fusion tables, including coding-effect output when available, are carried forward for peptide generation and reporting.
Creating fusion-specific coding sequences
Fusion peptide generation is performed in a separate downstream step after fusion calling. LENS combines:
the called fusion table
the genomic reference
the annotation GTF
phased germline VCFs
These inputs are used to construct fusion coding-sequence FASTAs and transcript exon FASTAs where transcript context can be resolved. If transcript exon FASTAs are unavailable for a given fusion, the workflow still continues using the fusion table alone.
Creating fusion-derived peptides
Fusion-derived peptides are generated with
lenstools make-fusion-peptides-context. The workflow extracts transcript IDs
from the fusion callset, subsets the GTF to the relevant transcripts, and then
builds peptide and nucleotide FASTAs from the fusion events and available exon
context.
Endogenous Retroviruses (ERVs)
ERV-derived peptides in the standard human profile are generated from tumor RNA expression, transcriptome-alignment coverage, and sample-specific consensus sequence reconstruction over ERV intervals.
Identifying expressed ERVs
The standard human profile uses the off-the-shelf normal-control quantification
reference pan_normal_and_mtec_exp.95th_perc.homo_sapiens.quant.sf when
calling expressed ERVs. Tumor transcript quantifications are compared against
that control reference with lenstools_filter_expressed_ervs.
After expression filtering, LENS performs an RNA-coverage filter using coverage
statistics from transcriptome-aligned tumor RNA BAMs. In the standard profile,
the default ERV coverage filter is --mean-depth 25.
Creating patient-specific ERV sequences
Covered ERVs are converted into BED intervals using the ERV annotation reference
Hsap38.txt. LENS then runs a lightweight consensus workflow over those BED
intervals using tumor RNA BAMs and the genomic reference.
This consensus step personalizes ERV coding sequence reconstruction in regions where standard small-variant workflows are not the primary source of sequence context.
Creating ERV-derived peptides
The resulting consensus FASTAs are combined with the filtered ERV list and the
ERV annotation reference and processed with lenstools make-erv-peptides.
LENS emits both peptide FASTAs and matching nucleotide FASTAs for downstream
characterization and report annotation.
Viruses
In the standard human profile, virus-derived peptides are generated from unaligned RNA reads that are remapped to virus-specific references and then filtered by expression and RNA coverage.
Filtering expressed viruses
Virus peptide generation uses two filters:
an expression filter based on viral CDS alignment counts
an RNA-coverage filter based on alignments to the viral CDS reference
The first step uses lenstools_filter_expressed_viruses to retain viruses
with measurable CDS support. The second uses
lenstools_filter_viruses_by_rna_coverage to require coverage across the
coding sequence. In the standard profile, the default viral coverage filter is
--coverage 75.
Creating virus-specific coding sequences
Covered viral CDS regions are converted into BED intervals and passed through a consensus-generation workflow using the viral BAMs and viral CDS reference. This creates sample-specific consensus FASTAs for the expressed viral coding regions.
Creating virus-derived peptides
These consensus FASTAs are processed with lenstools make-viral-peptides to
generate viral peptide FASTAs. The consensus nucleotide FASTAs are also retained
for downstream quantification and annotation.
Cancer-testis Antigens (CTAs)
Aberrantly expressed genes (for example, CTAs) can be a source of tumor-associated immunogenic peptides.
Determining expressed CTA and self-antigens
CTA and self-antigens are taken from the user-provided gene list. In the
standard human profile, the default list is
references/cta.pirlygenes.06APR2026.gene_list. Targetable CTA and
self-antigen peptides are generated using coding sequences from transcripts
that pass the standard profile expression filter -p 50 --exclude-zeros.
Generating patient-specific CTA coding sequences
LENS performs germline variant calling (default: DeepVariant) as part of its workflow. For CTA and self-antigen peptide generation, LENS then:
converts the expressed CTA/self transcript list into BED intervals
fetches the corresponding reference coding sequences
bgzips and indexes the available germline VCFs
applies
bcftools consensuswith-H Rwhere matching DNA-derived VCFs are available
If a sample lacks the corresponding DNA input needed for the consensus step, LENS falls back to the fetched reference FASTA for that transcript set instead of dropping the CTA candidate entirely.
Creating CTA/self-derived peptides
The resulting consensus or reference FASTAs are joined back to the expressed
CTA/self transcript list and processed with
lenstools make-self-antigen-peptides using the annotation GTF. The workflow
emits both peptide FASTAs and matching nucleotide FASTAs for downstream MHC
characterization and report annotation.