GSNAP(1)

πŸ’– gsnap β€” Genomic Short-read Nucleotide Alignment Program πŸ’–

okay bestie, welcome to gsnap(1) from the User Commands section πŸŽ€ β€” this is the Genomic Short-read Nucleotide Alignment Program and she is booked and busy. grab a snack, this page is long, and this is only part 1 🫢


✨ NAME ✨

gsnap β€” Genomic Short-read Nucleotide Alignment Program. that's it, that's the name, no notes πŸ’…


🌸 SYNOPSIS 🌸

gsnap [OPTIONS...] <FASTA file>, or cat <FASTA file> | gmap [OPTIONS...]

like, either you hand her a FASTA file directly, or you pipe it in. both valid, both iconic ✨ (yes the piped version says gmap, that's literally what the manpage says, don't come for me)


πŸ‘‘ OPTIONS πŸ‘‘


🧬 Input options (must include -d) 🧬

okay so for the input options you must include -d. no -d, no alignment, periodt.

  • -D, --dir=directory β€” the Genome directory. the default (as specified by --with-gmapdb to the configure program) is /var/cache/gmap.
  • -d, --db=STRING β€” the Genome database.
  • --two-pass β€” Two-pass mode πŸ¦‹. the sequences get processed first to identify splice sites and introns, and then they're aligned using this splicing information. two passes, twice the drama.
  • --use-localdb=INT β€” whether to use the local suffix arrays, which help with finding extensions to the ends of alignments in the presence of splicing or indels. 0=no, 1=yes if available (default). so the default is yes if available, lowkey polite of her.

🌈 Transcriptome-guided options (optional) 🌈

these are optional, so no pressure, but if you want them she's ready

  • -C, --transcriptdir=directory β€” Transcriptome directory. the default is the value for --dir above.
  • -c, --transcriptdb=STRING β€” Transcriptome database.
  • --transcriptome-mode=STRING β€” Options: assist, only, annotate (default). lemme break it down:
    • assist means try transcriptome alignment first, but then use genomic alignment if nothing is found.
    • only means try transcriptome alignment only.
    • annotate means try only genomic alignment, and use the transcriptome only for annotation β€” this is the fastest option ⚑. in the other two options, annotation is also performed.

πŸ”₯ Computation options πŸ”₯

  • -k, --kmer=INT β€” kmer size to use in genome database (allowed values: 16 or less). if you don't specify it, the program will find the highest available kmer size in the genome database. she'll figure it out herself, main character energy.
  • --sampling=INT β€” Sampling to use in genome database. if not specified, the program will find the smallest available sampling value in the genome database within the selected k-mer size.
  • --align-fraction=FLOAT β€” process only the given fraction of reads, selected at random. if --align-fraction and --part are both given, --align-fraction takes precedence πŸ‘‘.
  • -q, --part=INT/INT β€” process only the i-th out of every n sequences, e.g. 0/100 or 99/100 (useful for distributing jobs to a computer farm 🚜).
  • --input-buffer-size=INT β€” size of input buffer (program reads this many sequences at a time for efficiency) (default 10000).
  • --barcode-length=INT β€” amount of barcode to remove from start of every read before alignment (default 0).
  • --endtrim-length=INT β€” amount of trim to remove from the end of every read before alignment (default 0).
  • --orientation=STRING β€” orientation of paired-end reads. allowed values: FR (fwd-rev, or typical Illumina; default), RF (rev-fwd, for circularized inserts), or FF (fwd-fwd, same strand), or 10X (single-cell where read 1 has barcode information; read 2 is rev).
  • --10x-whitelist=FILE β€” whitelist of 10X Genomics GEM bead barcodes, needed to perform correction of cellular barcodes. this file can be obtained at cellranger-x.y.z/lib/python/cellranger/barcodes (for Cell Ranger version >= 4), or cellranger-x.y.z/lib/cellranger-cs/x.y.z/lib/python/cellranger/barcodes (<= 3).
  • --10x-well-position=INT β€” position of well information in the accession, when separated by colons. if set to 0, then no well information will be printed in the CB field (default: 4).
  • --fastq-id-start=INT β€” starting position of identifier in FASTQ header, space-delimited (>= 1).
  • --fastq-id-end=INT β€” ending position of identifier in FASTQ header, space-delimited (>= 1).

πŸ“ Examples πŸ“

  • @HWUSI-EAS100R:6:73:941:1973#0/1 β€” start=1, end=1 (default) => identifier is HWUSI-EAS100R:6:73:941:1973#0
  • @SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=36 β€” start=1, end=1 => identifier is SRR001666.1; start=2, end=2 => identifier is 071112_SLXA-EAS1_s_7:5:1:817:345; start=1, end=2 => identifier is SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345

back to the options, we're not done bestie:

  • --force-single-end β€” when multiple FASTQ files are provided on the command line, GSNAP assumes they are matching paired-end files. this flag treats each file as single-end. no assumptions, just vibes πŸ’…
  • --filter-chastity=STRING β€” skips reads marked by the Illumina chastity program. expecting a string after the accession having a 'Y' after the first colon, like this:
@accession 1:Y:0:CTTGTA

where the 'Y' signifies filtering by chastity. Values: off (default), either, both. for 'either', a 'Y' on either end of a paired-end read will be filtered. for 'both', a 'Y' is required on both ends of a paired-end read (or on the only end of a single-end read).

  • --allow-pe-name-mismatch β€” allows accession names of reads to mismatch in paired-end files. let them be different, it's fine 😌
  • --interleaved β€” input is in interleaved format (one read per line, tab-delimited
  • --gunzip β€” uncompress gzipped input files.
  • --bunzip2 β€” uncompress bzip2-compressed input files.

πŸ”₯ Computation options πŸ”₯ (yes, again β€” she said it twice, it's a whole thing)

  • -B, --batch=INT β€” Batch mode (default = 5). here's the whole breakdown, no cap:
Mode  Hash offsets  Hash positions  Genome          Local hash offsets  Local hash positions  Localdb
0     allocate      mmap            mmap            allocate            mmap                  mmap
1     allocate      mmap & preload  mmap            allocate            mmap & preload        mmap
2     allocate      mmap & preload  mmap & preload  allocate            mmap & preload        mmap
3     allocate      allocate        mmap & preload  allocate            allocate              mmap
4     allocate      allocate        allocate        allocate            allocate              mmap
5     allocate      allocate        allocate        allocate            allocate              allocate

(default) is 5. and a little note from her to you 🫢: for a single sequence, all data structures use mmap. a batch level of 5 means the same as 4, and is kept only for backward compatibility.

  • --use-shared-memory=INT β€” if 1, then allocated memory is shared among all processes on this node. if 0 (default), then each process has private allocated memory.
  • --preload-shared-memory β€” load files indicated by --batch mode into shared memory for use by other GMAP/GSNAP processes on this node, and then exit. ignore any input files. she's just prepping, not aligning, ok?
  • --unload-shared-memory β€” unload files indicated by --batch mode into shared memory, or allow them to be unloaded when existing GMAP/GSNAP processes on this node are finished with them. ignore any input files.
  • -m, --max-mismatches=FLOAT β€” maximum number of mismatches allowed (if not specified, then GSNAP tries to find the best possible match in the genome). if specified between 0.0 and 1.0, then treated as a fraction of each read length. otherwise, treated as an integral number of mismatches (including indel and splicing penalties). Default is 0.3.
  • --query-unk-mismatch=INT β€” whether to count unknown (N) characters in the query as a mismatch (0=no (default), 1=yes).
  • --genome-unk-mismatch=INT β€” whether to count unknown (N) characters in the genome as a mismatch (0=no, 1=yes). if --use-mask is specified, default is no, otherwise yes.
  • --maxsearch=INT β€” maximum number of alignments to find (default 1000). should be larger than --npaths, which is the number to report. keeping this number large will allow for random selection among multiple alignments. reducing this number can speed up the program ⚑.
  • --indel-endlength=INT β€” minimum length at end required for indel alignments (default 4).
  • --max-insertions=INT β€” maximum number of insertions allowed (default 6).
  • --max-deletions=INT β€” maximum number of deletions allowed (default 9).
  • -M, --suboptimal-levels=INT β€” report suboptimal hits beyond best hit (default 0). all hits with best score plus suboptimal-levels are reported. (Note: Not currently implemented β€” yeah bestie, it's not even live yet, don't @ me πŸ™ˆ)
  • -a, --adapter-strip=STRING β€” method for removing adapters from reads. currently allowed values: off, paired. Default is "off". to turn on, specify "paired", which removes adapters from paired-end reads if they appear to be present.
  • -e, --use-mask=STRING β€” use genome containing masks (e.g. for non-exons) for scoring preference.
  • -V, --snpsdir=STRING β€” directory for SNPs index files (created using snpindex) (default is location of genome index files specified using -D and -d).
  • -v, --use-snps=STRING β€” use database containing known SNPs (in <STRING>.iit, built previously using snpindex) for tolerance to SNPs.
  • --cmetdir=STRING β€” directory for methylcytosine index files (created using cmetindex) (default is location of genome index files specified using -D, -V, and -d).
  • --atoidir=STRING β€” directory for A-to-I RNA editing index files (created using atoiindex) (default is location of genome index files specified using -D, -V, and -d).
  • --mode=STRING β€” alignment mode: standard (default), cmet-stranded, cmet-nonstranded, atoi-stranded, atoi-nonstranded, ttoc-stranded, or ttoc-nonstranded. non-standard modes require you to have previously run the cmetindex or atoiindex programs (which also cover the ttoc modes) on the genome. so like, prep work first, bestie, no shortcuts πŸ’…
  • -t, --nthreads=INT β€” number of worker threads. more threads, more power, iykyk.

🧬 Splicing options for DNA-Seq 🧬

  • --find-dna-chimeras=INT β€” look for distant splicing involving poor splice sites (0=no, 1=yes). if not specified, then default is to be on unless only known splicing is desired (--use-splicing is specified and --novelsplicing is off).

🌸 Splicing options for RNA-Seq 🌸

  • -N, --novelsplicing=INT β€” look for novel splicing (0=no (default), 1=yes).
  • --splicingdir=STRING β€” directory for splicing involving known sites or known introns, as specified by the -s or --use-splicing flag (default is directory computed from -D and -d flags). Note: can just give full pathname to the -s flag instead. your call, both work ✨
  • -s, --use-splicing=STRING β€” look for splicing involving known sites or known introns (in <STRING>.iit), at short or long distances. see README instructions for the distinction between known sites and known introns πŸ“–

okay that's part 1 bestie, more is coming so don't go anywhere πŸ’–
  • --splices-noeval β€” don't evaluate splices for probability or intron length, bestie β€” just depend on the sequence alignment. it's giving "trust the alignment" energy. πŸ’…
  • --splices-dump=FILE β€” write splice junction info to FILE, same format as for STAR plus MaxEnt probabilities for the two intron positions. note that in this dump file, the annotation column is reserved strictly for known introns, not novel introns that passed some criterion from a first pass. ✨
  • --splices-exclude-known β€” in the file for --splices-dump, exclude all known introns. no cap. 🚫
  • -w, --localsplicedist=INT β€” definition of local novel splicing event (default 200000). the way that's a big number... 🧬
  • --merge-distant-samechr β€” report distant splices on the same chromosome as a single splice, if possible. will produce a single SAM line instead of two SAM lines, which is also done for translocations, inversions, and scramble events. slay. πŸ”—

✨ Options for paired-end reads ✨

  • --pairmax-dna=INT β€” max total genomic length for DNA-Seq paired reads, or other reads without splicing (default 2000). used if -N or -s is not specified. this value is also used for circular chromosomes when splicing in linear chromosomes is allowed. πŸ’…
  • --pairmax-rna=INT β€” max total genomic length for RNA-Seq paired reads, or other reads that could have a splice (default 200000). used if -N or -s is specified. should probably match the value for -w, --localsplicedist. fr fr. πŸ’–
  • --resolve-inner=INT β€” whether to resolve soft-clipping on the insides of paired-end reads (default 1). πŸ€”
  • --pairexpect=INT β€” expected paired-end length, used for resolving soft-clipping on the insides of paired-end reads, and for pairing DNA-seq reads (default 200). πŸ“
  • --pairdev=INT β€” allowable deviation from expected paired-end length, used for resolving soft-clipping on the insides of paired-end reads (default 100). πŸ“
  • --pass1-min-support=INT β€” threshold read support for learning an intron during pass 1 of --two-pass mode (default 20). πŸ”₯

✨ Options for quality scores ✨

  • --quality-protocol=STRING β€” protocol for input quality scores. allowed values: illumina (ASCII 64-126) (equivalent to -J 64 -j -31), sanger (ASCII 33-126) (equivalent to -J 33 -j 0). πŸŽ€

default is sanger (no quality print shift).

SAM output files should have quality scores in sanger protocol.

or you can customize this behavior with these flags:

  • -J, --quality-zero-score=INT β€” FASTQ quality scores are zero at this ASCII value (default is 33 for sanger protocol; for Illumina, select 64). πŸ”’
  • -j, --quality-print-shift=INT β€” shift FASTQ quality scores by this amount in output (default is 0 for sanger protocol; to change Illumina input to Sanger output, select -31). πŸ”€

✨ Output options ✨

  • -n, --npaths=INT β€” maximum number of paths to print (default 100). πŸ›€οΈ
  • -Q, --quiet-if-excessive β€” if more than maximum number of paths are found, then nothing is printed. 🀫
  • -O, --ordered β€” print output in same order as input (relevant only if there is more than one worker thread). πŸ”„
  • --show-refdiff β€” for GSNAP output in SNP-tolerant alignment, shows all differences relative to the reference genome as lower case (otherwise, it shows all differences relative to both the reference and alternate genome). πŸ”
  • --clip-overlap β€” for paired-end reads whose alignments overlap, clip the overlapping region. βœ‚οΈ
  • --merge-overlap β€” for paired-end reads whose alignments overlap, merge the two ends into a single end (beta implementation). πŸ§ͺ
  • --print-snps β€” print detailed information about SNPs in reads (works only if -v also selected) (not fully implemented yet). 🧬
  • --failsonly β€” print only failed alignments, those with no results. πŸ’”
  • --nofails β€” exclude printing of failed alignments. 🚫
  • --only-concordant β€” print only concordant alignments (concordant_uniq, concordant_mult, concordant_circular). 🀝
  • --omit-concordant-uniq β€” do not print any concordant_uniq alignments. πŸ™…
  • --omit-concordant-mult β€” do not print any concordant_mult alignments. πŸ™…
  • --omit-softclipped β€” do not allow any alignments with soft clips. 🚫
  • --only-tr-consistent β€” print only alignments with consistent transcripts (XX field present, identical if paired-end). πŸ“œ
  • -A, --format=STRING β€” another format type, other than default. currently implemented: sam, m8 (BLAST tabular format). πŸ“„
  • --split-output=STRING β€” basename for multiple-file output, separately for nomapping, halfmapping_uniq, halfmapping_mult, unpaired_uniq, unpaired_mult, paired_uniq, paired_mult, concordant_uniq, and concordant_mult results. πŸ“‚
  • -o, --output-file=STRING β€” file name for a single stream of output results. πŸ“
  • --failed-input=STRING β€” print completely failed alignments as input FASTA or FASTQ format, to the given file, appending .1 or .2, for paired-end data. if the --split-output flag is also given, this file is generated in addition to the output in the .nomapping file. πŸ’Ύ
  • --append-output β€” when --split-output or --failed-input is given, this flag will append output to the existing files. otherwise, the default is to create new files. βž•
  • --order-among-best=STRING β€” among alignments tied with the best score, order those alignments in this order. allowed values: genomic, random (default). 🎲
  • --output-buffer-size=INT β€” buffer size, in queries, for output thread (default 1000). when the number of results to be printed exceeds this size, worker threads wait until the backlog is cleared. 🚦

✨ Options for SAM output ✨

  • --no-sam-headers β€” do not print headers beginning with @. 🚫
  • --add-paired-nomappers β€” add nomapper lines as needed to make all paired-end results alternate between first end and second end. πŸ”„
  • --paired-flag-means-concordant=INT β€” whether the paired bit in the SAM flags means concordant only (1) or paired plus concordant (0, default). πŸ€”
  • --sam-headers-batch=INT β€” print headers only for this batch, as specified by -q. πŸ“¦
  • --sam-hardclip-use-S β€” use S instead of H for hardclips. πŸ”„
  • --sam-use-0M=INT β€” if 1 (default), then insert 0M in CIGAR between adjacent indels and introns. if 0, do not allow 0M. Picard disallows 0M, but other tools may require it. ⚠️
  • --sam-extended-cigar β€” use extended CIGAR format (using X and = symbols instead of M, to indicate matches and mismatches, respectively). πŸ”€
  • --sam-multiple-primaries β€” allows multiple alignments to be marked as primary if they have equally good mapping scores. πŸ‘‘
  • --sam-sparse-secondaries β€” for secondary alignments (in multiple mappings), uses * for SEQ and QUAL fields, to give smaller file sizes. However, the output will give warnings in Picard to give warnings and may not work with downstream tools. ⚠️
⚠️ heads up: this will give warnings in Picard and may not work with downstream tools. proceed with caution, bestie.
  • --force-xs-dir β€” for RNA-Seq alignments, disallows XS:A:? when the sense direction is unclear, and replaces this value arbitrarily with XS:A:+. May be useful for some programs, such as Cufflinks, that cannot handle XS:A:?. However, if you use this flag, the reported value of XS:A:+ in these cases will not be meaningful. ⚠️
⚠️ note: if you use this flag, the reported XS:A:+ value in these cases will not be meaningful. no cap.
  • --md-report-snps β€” in MD string, when known SNPs are given by the -v flag, prints difference nucleotides when they differ from reference but match a known alternate allele. 🧬
  • --no-soft-clips β€” does not allow soft clips at ends. mismatches will be counted over the entire query. 🚫
  • --extend-soft-clips β€” extends alignments through soft clipped regions. CIGAR string and coordinates will be revised, but mismatches and the MD string will reflect the clipped CIGAR. πŸ“
  • --action-if-cigar-error β€” action to take if there is a disagreement between CIGAR length and sequence length. allowed values: ignore, warning (default), noprint, abort. note that the noprint option does not print the CIGAR string at all if there is an error, so it may break a SAM parser. 🚨
⚠️ the noprint option does not print the CIGAR string at all if there is an error, so it may break a SAM parser. you've been warned.
  • --read-group-id=STRING β€” value to put into read-group id (RG-ID) field. 🏷️
  • --read-group-name=STRING β€” value to put into read-group name (RG-SM) field. 🏷️
  • --read-group-library=STRING β€” value to put into read-group library (RG-LB) field. 🏷️
  • --read-group-platform=STRING β€” value to put into read-group library (RG-PL) field. 🏷️

✨ Help options ✨

  • --check β€” check compiler assumptions. βœ…
  • --version β€” show version. πŸ“…
  • --help β€” show this help message. ❓

Other tools of GMAP suite are located in /usr/lib/gmap. πŸ“


πŸ’– that's the whole GSNAP(1) manual, bestie! this page comes from gsnap 2025-07-31+ds-1, dated October 2025. stay slay and may your alignments always be concordant! πŸ’…βœ¨

πŸ“¦ where this page comes from