QTLtools-quan(1)
π QTLtools-quan(1) π
Bioinformatics tools, bestie. Here's the manual for the quan mode π
β¨ NAME β¨
QTLtools quan is how you quantify gene and exon expression from RNA-seq π§¬
π§ SYNOPSIS π§
QTLtools quan --bam [in.sam|in.bam|in.cram] --gtf gene_annotation.gtf
--out-prefix output [OPTIONS]
π DESCRIPTION π
okay so this mode is literally about counting how much each gene and exon is expressed π It uses the reads in your --bam file and checks them against the annotations in your --gtf file. The whole vibe is counting how many reads overlap the exons in that GTF.
Here's the glow-up part β¨ First, all the exons of a gene get turned into meta-exons. Any exons that overlap each other get merged into one big exon that covers all of them. Iconic π
Now, what counts as a match? Any overlap at all π A read doesn't have to sit fully between an exon's start and end positions to count toward that exon. Just touching it is enough.
Split reads (reads that align to more than one exon) are lowkey a little different π¦ Each exon the read overlaps gets a share based on the fraction of that read sitting on that exon. So a split read gives less than one full count to each exon it touches. Not a full count for each one, just a piece.
Reads that align to multiple exons, like overlapping exons from different genes, count toward the quantification of every exon they overlap π
Paired-end reads are their own thing π If your --bam file has paired-end reads and the two mates overlap each other (meaning the insert size is < 0), then each of those reads only contributes less than a single count toward the quantifications. The exception is if you pass --no-merge, which stops overlapping mates from being merged.
Here's a diagram of two genes with overlapping exons, plus one paired-end read where both mates are split reads that overlap each other. It shows how the quantification works π
x x
/ \ / \
+---------+ +---------+ +---------+
| Exon1|1 | | Exon1|2 | | Exon1|3 | Gene1
+---------+ +---------+ +---------+
x
/ \
+------------+ +-------------+
| Exon2|1 | | Exon2|2 | Gene2
+------------+ +-------------+
x
/ \
+------------+ +----+ RNAseq Read Mate1
|--a-||-b-||c| |-d--||--e-|
x
/ \
+------+ +----------+ RNAseq Read Mate2
Left Mate1 = ((b * 0.5) + a) / (a + b + d)
Right Mate1 = (d * 0.5)/(a + b + d)
Left Mate2 = (b * 0.5)/(b + d + e)
Right Mate2 = ((d * 0.5) + e)/(b + d + e)
Exon1|2 = Left Mate1 + Left Mate2
Exon1|3 = Right Mate1 + Right Mate2
Exon2|1 = Left Mate1 + Left Mate2
Exon2|2 = Right Mate2 + Right Mate2
Gene1 = Exon1|2 + Exon1|3
Gene2 = Exon2|1 + Exon2|2
β οΈ bestie, listen up π The quan mode in version 1.2 and above is not compatible with quantifications from earlier versions. That's because of bug fixes and small tweaks to how we quantify. DO NOT MIX QUANTIFICATIONS GENERATED BY EARLIER VERSIONS OF QTLTOOLS WITH QUANTIFICATIONS FROM VERSION 1.2 AND ABOVE, because it will create a bias in your dataset π
π OPTIONS π
--gtf gene_annotation.gtfβ the gene annotations in GTF format π You can grab them fromhttps://www.gencodegenes.org/. REQUIRED.--bam [in.bam|in.sam|in.cram]β your sequence data in BAM/SAM/CRAM format, sorted by chromosome and then position. Each BAM file should be one sample. REQUIRED.--out-prefix outputβ the output prefix πΈ REQUIRED.--sample sample_nameβ the sample name for the BAM file. If you don't give one, the sample name becomes the BAM file path π--rpkmβ outputs RPKM values π«Ά--tpmβ outputs TPM values π«Ά--xxhashβ instead of making the unique hash for your options from the GTF file name, it uses the hash of the GTF file itself π§--no-hashβ skips the hash that signifies the options used in the quantification, so it doesn't go in the output file names. NOT RECOMMENDED. π--gene-types gene_type ...β only quantifies these gene types π This needs agene_typeattribute in the GTF. It'll also usetranscript_typeif that's there.--filter-mapping-quality integerβ the minimum mapping quality a read or read pair needs before it gets considered. Set this high if you only want uniquely mapped reads π¦DEFAULT=10.--filter-mismatch integer|floatβ the max mismatches allowed in a read. If the value is between 0 and 1, it's treated as a fraction of the read length. This needs anNMattribute in the BAM file β¨DEFAULT=OFF.--filter-mismatch-total integer|floatβ the max total mismatches allowed across a paired read. If the value is between 0 and 1, it's treated as a fraction of the combined read length. This also needs anNMattribute in the BAM file π--filter-min-exon integerβ the minimum exon length to be quantified π Exons smaller than this won't show up in the exon quantifications, but they still count toward the gene quantifications.DEFAULT=0.
β¨ OUTPUT FILES β¨
Okay so bestie, unless you pass --no-hash, every output file gets a hash baked in that matches the exact combo of options you used π. Why does this matter? Because you do NOT want to merge quantifications from samples that were quantified differently. That would quietly bias your whole dataset and it is literally the worst π So the hash keeps everyone in their lane π«Ά
.gene.count.bed .exon.count.bed .gene.rpkm.bed .exon.rpkm.bed .gene.tpm.bed .exon.tpm.bed πΈ
These are the main quantification results files, and they all have the same seven columns β¨
- Column 1 β
chrβ the phenotype's chromosome πΊοΈ - Column 2 β
startβ the phenotype's start position (0-based) π - Column 3 β
endβ the phenotype's end position (1-based) π¦ - Column 4 β
gene|exonβ the gene or exon ID π§ - Column 5 β
info|geneIDβ info about the gene, or the gene ID of the exon. Gene info is separated by semicolons, and the keys areL=(gene length),T=(gene type),R=(gene positions), andN=(gene name) π - Column 6 β
strandβ the phenotype's strand π - Column 7 β
sample_nameβ the sample name from the BAM file π
.stats π
This one details all the stats for the quantification. Here are the rows, in order, and yes there are seventeen of them π
- Row 1 β
filtered_secondary_alignments_(does_not_count_towards_total_reads)β the number of secondary alignments. These do NOT count towards the total reads, so don't panic π - Row 2 β
total_readsβ the number of reads in the BAM file π - Row 3 β
filtered_unmappedβ the number of unmapped reads π» - Row 4 β
filtered_failqcβ the number of reads carrying the failed QC tag β - Row 5 β
filtered_duplicateβ the number of duplicate reads π― - Row 6 β
filtered_mapQ_less_than_Xβ the number of reads below the mapping quality thresholdXπ - Row 7 β
filtered_notpairedβ the number of pairs that were either not in the correct orientation or not properly paired π ββοΈ - Row 8 β
filtered_mismatches_greater_than_X_Yβ the number of reads that failed the mismatches-per-read filter (X) and the mismatches-total filter (Y) π« - Row 9 β
filtered_unmatched_mate_pairsβ the number of reads where a paired read had a missing mate π - Row 10 β
total_goodβ the number of reads that passed ALL the filters π - Row 11 β
total_exonicβ the number of reads that aligned to exons AND passed all filters 𧬠- Row 12 β
total_exonic_multi_countingβ the number of reads that aligned to exons when we count reads that align to multiple exons multiple times π - Row 13 β
total_merged_readsβ the number of reads where the mate pairs were overlapping and got merged π« - Row 14 β
total_exonic_multi_counting_after_merge_(used_for_rpkm)β the number of reads that aligned to exons when we merge overlapping mate pairs. This is the one used for RPKM π₯ - Row 15 β
good_over_totalβ the number of good reads over the total number of reads β - Row 16 β
exonic_over_totalβ the number of exonic reads over the total number of reads β - Row 17 β
exonic_over_goodβ the number of exonic reads over the number of good reads β
β¨ EXAMPLE β¨
Bestie, here's a look at a real vibe. This one quantifies a sample mapped with GEM, outputs TPM and RPKM values, and takes the hash of the GTF file π§
QTLtools quan --bam HG00381.chr22.bam --gtf
gencode.v19.annotation.chr22.gtf.gz --out-prefix HG00381 --sample
HG00381 --rpkm --tpm --xxhash --filter-mismatch-total 8 --filter-
mapping-quality 150
β¨ SEE ALSO β¨
Go check out QTLtools(1) for more β¨
QTLtools website: <https://qtltools.github.io/qtltools> π
β¨ BUGS β¨
Found something broken? Slide into the DMs of the devs at <https://github.com/qtltools/qtltools> π
β¨ CITATION β¨
Delaneau, O., Ongen, H., Brown, A. et al. A complete tool set for molecular QTL discovery and analysis. Nat Commun 8, 15452 (2017). <https://doi.org/10.1038/ncomms15452> π
β¨ AUTHORS β¨
Halit Ongen (halitongen@gmail.com) and Olivier Delaneau (olivier.delaneau@gmail.com) ππ«Ά
Okay bestie that's the whole tea βπ QTLtools-v1.3, last updated 06 May 2020, QTLtools-quan(1) forever. Stay iconic π¦β¨
π¦ where this page comes from
- debian bookworm: qtltools 1.3.1+dfsg-4 Β· GPL-3.0-or-later
- debian trixie: qtltools 1.3.1+dfsg-4+b3 Β· GPL-3.0-or-later
- ubuntu jammy: qtltools 1.3.1+dfsg-2build2 Β· GPL-3.0-or-later
- ubuntu noble: qtltools 1.3.1+dfsg-4build3 Β· GPL-3.0-or-later
- ubuntu questing: qtltools 1.3.1+dfsg-4build6
- ubuntu resolute: qtltools 1.3.1+dfsg-4build7 Β· GPL-3.0-or-later
- ubuntu stonking: qtltools 1.3.1+dfsg-6 Β· GPL-3.0-or-later
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms