QTLtools-ase(1)

๐Ÿ“– QTLtools-ase(1) ยท Bioinformatics tools ๐Ÿงฌ ยท part 1 of 2 ๐Ÿ’–


โœจ NAME โœจ

okay bestie, the whole tool is QTLtools ase ๐Ÿงฌ, and it's the thing that measures allele specific expression (ASE) straight from RNA-seq data ๐Ÿ’…โœจ


๐Ÿงฌ SYNOPSIS ๐Ÿงฌ

here's how you call it, no cap ๐Ÿ’–

QTLtools ase --bam [sample.bam|sample.sam|sample.cram] --vcf
[in.vcf|in.bcf|in.vcf.gz] --sample sample_name_in_vcf --mapq  integer
--out output_file_prefix [OPTIONS]

๐Ÿ’… DESCRIPTION ๐Ÿ’…

okay so this mode measures ASE from RNA-seq for transcribed heterozygous SNPs ๐Ÿงฌ, following the method in <https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3918453/>. the vibe in short: for each of the 12 REF/ALT pairs, it works out a reference allele mapping bias separately, as long as there are at least --sites REF/ALT sites with a minimum of --cov-bias reads overlapping ๐Ÿ“Š. pairs that don't pass that check get their bias calculated from all sites instead ๐Ÿซถ.

the reference allele mapping bias is basically the number of reads across lots of sites that carried the reference allele for that pair, divided by the total number of reads overlapping ๐Ÿ’œ. then --subsample decides which percentile of the highest covered sites gets subsampled ๐ŸŒˆ. this is necessary so the bias isn't estimated mostly from super high coverage sites, but from sites covering the whole genome ๐ŸŒธ.

last bit: each site's ASE p-value is a two-tailed binomial test ๐Ÿงš. it checks whether the observed reference allele reads are significantly different from random, given the total reads and the probability of seeing a reference allele (which is the reference allele mapping bias for that pair) โœจ.

the defaults should slay for most RNAseq experiments ๐Ÿ’…๐Ÿ‘‘. but bestie, listen:

NOT advisable ๐Ÿ™ˆ: lowering --baseq below 10, lowering --cov and --cov-bias below 8, or setting --subsample to 1.
NOT recommended ๐Ÿ’€: using --keep-bans-for-bias, --keep-discordant-for-bias, --filter-duplicates, --ignore-orientation, or --legacy-options. also refrain from --auto-flip ๐Ÿ™…โ€โ™€๏ธ, and instead just create correct VCF/BCF files.

we highly recommend a BCF file over a VCF for the performance boost ๐Ÿ”ฅ. also use --fasta to provide the genome sequence you used, --blacklist to filter out low mappability regions ๐Ÿšซ, and --gtf to annotate the SNPs ๐Ÿท๏ธ. if you're working with unfiltered imputed genotypes, consider --imp-qual and --geno-prob ๐ŸŽ€. for troubleshooting, --filtered will list why certain variants got filtered out of the analysis ๐Ÿ”. if you're I/O bound, try --group-by for better performance ๐Ÿš€. and if your blacklist file has lots of overlapping or contiguous regions, --merge-on-the-fly can decrease memory usage ๐Ÿง ๐Ÿ’–.


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • --vcf, -v [in.vcf|in.bcf|in.vcf.gz] โ€” genotypes in VCF/BCF format, sorted by chromosome and then position ๐Ÿงฌ. it can hold multiple samples. REQUIRED, and a BCF is RECOMMENDED for performance ๐Ÿ’–.
  • --bam, -b [in.bam|in.sam|in.cram] โ€” sequence data in BAM/SAM/CRAM format, sorted by chromosome and then position ๐Ÿ“š. one sample per BAM file. REQUIRED.
  • --ind, -i sample_name โ€” the sample name in the VCF that matches your BAM file ๐Ÿซถ. REQUIRED.
  • --out, -o output โ€” the output prefix โœจ. this generates output.ase and output.ref_bias files. or if you give output.gz or output.bz2, you get output.ase.gz etc. REQUIRED.
  • --mapq, -q integer โ€” the minimum mapping quality a read or read pair needs to be considered ๐ŸŽฏ. set this to only include uniquely mapped reads. REQUIRED.
  • --fasta, -f genome_sequence.fa โ€” the genome sequence in FASTA format ๐Ÿงฌ. make sure it's the sequence for the correct genome build. RECOMMENDED.
  • --blacklist, -B poor_mappability_regions.bed โ€” poor mappability regions in BED format ๐Ÿšซ. ASE estimates will be unreliable in regions with low mappability. RECOMMENDED.
  • --merge-on-the-fly, -t โ€” merges the blacklisted regions on the fly ๐Ÿง . this can reduce memory usage if there are many overlapping or contiguous regions in the blacklist.
  • --gtf, -g gene_annotation.gtf โ€” gene annotations in GTF format ๐Ÿท๏ธ. you can grab these from <https://www.gencodegenes.org/>. RECOMMENDED.
  • --filtered, -l filename โ€” the file where filtered variants get written ๐Ÿ”. RECOMMENDED for troubleshooting, especially if you use --suppress-warnings.
  • --reg, -r chr:start-end โ€” the genomic region to process ๐Ÿ—บ๏ธ. e.g. chr4:12334456-16334456, or chr5.
  • --fix-chr, -F โ€” tries to match chromosome names to the BAM file by adding or removing chr ๐Ÿช„. this doesn't apply to --{include,exclude}-positions options. those should use the chromosome names from the VCF.
  • --fix-id, -R โ€” converts missing VCF variant IDs to chr_pos_refalt ๐Ÿ’….
  • --auto-flip, -x โ€” attempts to fix reference allele mismatches ๐Ÿ™ˆ. it requires a fasta file for the reference sequence, given with --fasta. NOT RECOMMENDED.
  • --print-stats, -P โ€” prints out stats for the filtered reads at ASE sites ๐Ÿ“Š. this will be slower, and if there are sites with more reads than --max-depth, it can potentially give different results.
  • --suppress-warnings, -k โ€” suppresses the warnings about individual variants ๐Ÿคซ.
  • --illumina13, -j โ€” the base quality is in the Illumina-1.3+ encoding ๐Ÿงช.
  • --group-by, -G integer โ€” groups variants separated by this much into batches ๐Ÿ“ฆ. this lets you skip streaming the whole BAM file, and may improve running time ๐Ÿš€.
  • --max-depth, -d integer โ€” pileup max-depth, DEFAULT=1000000 ๐ŸŒŠ. set it to a more reasonable value if you experience memory or performance issues. it's set high by default since RNA-seq can have very high coverage sites. set to 0 for max.
  • --baseq, -Q integer โ€” minimum phred quality for a base to be considered, DEFAULT=10 ๐Ÿ’–.
  • --pvalue, -p float โ€” binomial p-value threshold for ASE output, DEFAULT=1.0 ๐ŸŽฏ.
  • --cov, -c integer โ€” minimum coverage for a genotype to be considered in ASE analysis, DEFAULT=16 ๐Ÿ“ˆ.
  • --cov-bias, -C integer โ€” minimum coverage for a genotype to be considered in reference allele mapping bias analysis, DEFAULT=10 ๐Ÿ“‰.
  • --sites, -s integer โ€” minimum number of sites to calculate a reference allele mapping bias from for a specific REF/ALT pair, DEFAULT=200 ๐Ÿงฉ. pairs with fewer than this many sites will have their bias calculated from all sites instead.
  • --imp-qual-id, -I string โ€” the VCF INFO field ID of the imputation score in the VCF, DEFAULT=INFO ๐Ÿท๏ธ.
  • --geno-prob-id, -L string โ€” the VCF FORMAT field ID of the genotype posterior probabilities for RR/RA/AA in the VCF, DEFAULT=GP ๐ŸŽ€.
  • --imp-qual, -W float โ€” minimum imputation score for a variant to be considered, DEFAULT=0.0 โœจ.
  • --geno-prob, -V float โ€” minimum posterior probability for a genotype to be considered, DEFAULT=0.0 ๐ŸŒˆ.

๐Ÿ“ฆ OUTPUT FILES โœจ

Okay bestie, so QTLtools ase spits out a couple of files and I am about to walk you through every single column ๐Ÿค“๐Ÿ’–

๐Ÿ“„ .ase

This is the main ASE results file, so it's the one you'll be staring at ๐Ÿ‘€ It has the columns below. Heads up: anything after the 23rd column only shows up if you pass --print-stats ๐Ÿซถ

  • 1 INDIVIDUAL โ€” the sample ID ๐Ÿ™‹โ€โ™€๏ธ
  • 2 RSID โ€” the SNP ID, pulled straight from the VCF file ๐Ÿงฌ
  • 3 CHR โ€” the chromosome the SNP lives on
  • 4 POS โ€” the SNP's position
  • 5 ALLELES โ€” the alleles the SNP carries
  • 6 BOTH_ALLELES_SEEN โ€” whether or not both of the SNP's alleles actually got spotted in the RNAseq reads
  • 7 MIN_ALLELE_RATIO โ€” the minor allele ratio across the RNAseq reads
  • 8 REF_COUNT โ€” how many reference alleles show up in the reads
  • 9 NONREF_COUNT โ€” how many alternative alleles show up in the reads
  • 10 TOTAL_COUNT โ€” how many reads overlap the SNP
  • 11 WEIGHTED_REF_COUNT โ€” REF_COUNT, adjusted for reference mapping bias โš–๏ธ
  • 12 WEIGHTED_NONREF_COUNT โ€” NONREF_COUNT, adjusted for reference mapping bias โš–๏ธ
  • 13 WRC_MINUS_WNC โ€” WEIGHTED_REF_COUNT minus WEIGHTED_NONREF_COUNT
  • 14 ALLELES_SEEN โ€” the alleles observed in the RNAseq reads
  • 15 REF_ALLELE โ€” the reference allele
  • 16 ALT_ALLELE โ€” the alternative allele
  • 17 OTHER_COUNT โ€” how many discordant reads there are, meaning reads that are neither REF nor ALT
  • 18 EXPECTED_DISCORDANT โ€” the expected number of discordant alleles. It's calculated by adding up all the base error probabilities at the RNAseq read positions that overlap the SNP ๐Ÿงฎ
  • 19 DISCORDANT_PVAL โ€” the p-value for the observed number of discordant reads being higher than expected. You can Bonferroni-correct these p-values and drop the significant ones from downstream analyses ๐Ÿงน
  • 20 REF_RATIO โ€” reference allele mapping bias
  • 21 PVALUE โ€” the ASE p-value ๐Ÿ”ฅ
  • 22 CONCERN โ€” any concerns that could make this SNP unusable get coded here. Check the OUTPUT FILE CODES section below to decode them ๐Ÿšฉ
  • 23 EXON_INFO โ€” exons overlapping this SNP get listed here if a GTF file is provided. Each exon name is made by joining the gene ID, transcript ID, exon position, and gene name with a colon, and the names are separated by semicolons ๐Ÿงฉ
  • 24 SECONDARY โ€” the number of secondary alignments that got filtered out
  • 25 SUPPLEMENTARY โ€” if --filter-supp is provided, the number of supplementary alignments that got filtered out
  • 26 FAIL_MAPQ โ€” the number of alignments filtered out for low mapping quality
  • 27 FAILQC โ€” if --keep-failed-qc is not provided, the number of filtered reads that failed QC according to the sequencer
  • 28 DUPLICATE โ€” if --filter-duplicates is provided, the number of filtered reads the aligner labeled as duplicates
  • 29 MATE_UNMAPPED โ€” if --keep-orphan-reads is not provided, the number of reads filtered because one mate was unmapped
  • 30 WRONG_ORIENTATION โ€” if --ignore-orientation is not provided, the number of reads filtered for being in the wrong orientation
  • 31 NOT_PROPER_PAIR โ€” if --check-proper-pairing is provided, the number of filtered reads the aligner didn't mark as properly paired
  • 32 SKIPPED โ€” the number of alignments filtered out because they had no actual bases overlapping the SNP
  • 33 FAIL_BASEQ โ€” the number of filtered reads where the base overlapping the SNP had a base quality below --baseq ๐Ÿ“‰
  • 34 INDEL โ€” if --filter-indel-reads is provided, the number of filtered reads that contained indels
  • 35 DEPTH โ€” the number of alignments overlapping the SNP position

๐Ÿงช .ref_bias

This one details the reference allele mapping bias results. It has these columns:

  • 1 INDIVIDUAL โ€” the sample ID
  • 2 ALLELES โ€” the reference/alternative allele pair
  • 3 REF_ALL โ€” total reference alleles observed across all sites
  • 4 NONREF_ALL โ€” total alternative alleles observed across all sites
  • 5 SITES โ€” number of sites for this REF/ALT pair that pass the thresholds
  • 6 SUBSAMPLED_SITES โ€” number of sites that got subsampled down to SUBSAMPLED_TO because their coverage was too high ๐Ÿซง
  • 7 SUBSAMPLED_TO โ€” the coverage that SUBSAMPLED_SITES were subsampled to
  • 8 PERC โ€” reference allele mapping bias
  • 9 SOURCE โ€” whether the reference allele mapping bias was calculated from allele-specific sites or from all sites

๐Ÿšซ --filtered filename

This file is the tea on every variant that got left out of the analysis and why ๐Ÿต The first column is the coded omission reason, then comes the variant ID. The codes are all explained in the next section.


๐Ÿ—๏ธ OUTPUT FILE CODES

๐Ÿšฉ .ase file codes for the CONCERN column

Real talk: you probably want to exclude SNPs with RM, NRA, MDTA, or MDTR concerns from your analyses, because these likely have wrong genotypes ๐Ÿ˜ญ SNPs with other concerns may be OK ๐Ÿคทโ€โ™€๏ธ

  • RM โ€” the reference allele in the VCF mismatches the reference sequence. Requires --fasta
  • DP โ€” multiple variants observed at the same position in the VCF file
  • NRA โ€” no reference or alternative allele observed in the RNAseq reads
  • MDTA โ€” more discordant (not reference or alternative) alleles than alternative alleles in the RNAseq reads
  • MDTR โ€” more discordant (not reference or alternative) alleles than reference alleles in the RNAseq reads
  • BANS โ€” both alleles of the SNP were not observed in the RNAseq reads
  • LMAR โ€” among the RNAseq reads, the minor allele ratio was less than 2%
  • PD โ€” pileup depth (--max-depth) was potentially exceeded around this SNP. This may stop some overlapping reads from being counted, so we recommend rerunning with a higher --max-depth ๐Ÿ“ˆ

๐Ÿงน --filtered file codes

  • VMA โ€” multi-allelic variant
  • VU โ€” variant position or ID is excluded by the user
  • VCNIB โ€” variant chromosome is not in the BAM file
  • VB โ€” variant is in a blacklisted region
  • VI โ€” variant is an indel
  • VMRA โ€” variant is missing either the reference or the alternative allele
  • VNIF โ€” variant is not in the reference genome. Only if --fasta was provided
  • VS โ€” reference and alternative alleles were swapped (not excluded). Only if --auto-flip and --fasta were provided ๐Ÿ”„
  • VF โ€” reference and alternative alleles' strand was flipped (not excluded). Only if --auto-flip and --fasta were provided
  • VWR โ€” reference allele does not match the reference sequence. Only if --auto-flip and --fasta were provided
  • VBI โ€” variant failed the imputation quality filter
  • VMGT โ€” variant with a missing GT field, or variant is not diploid
  • VMG โ€” missing genotype
  • VH โ€” homozygous variant
  • VBG โ€” variant failed the genotype probability filter
  • VD โ€” duplicate variant position
  • VMI โ€” variant with a missing ID (not excluded). It gets renamed if --fix-id is provided ๐Ÿท๏ธ
  • VDK โ€” heterozygous variant has another variant at the same position (not excluded)
  • BC โ€” variant didn't have enough coverage for reference allele mapping bias calculations
  • BBANS โ€” both alleles were not observed for reference allele mapping bias calculations
  • BMDTRA โ€” variant had more discordant alleles than reference or alternative alleles, so it was excluded from reference allele mapping bias calculations
  • AC โ€” variant didn't have enough coverage for ASE calculations
  • ABANS โ€” both alleles were not observed for ASE calculations

๐ŸŽ€ EXAMPLES

ASE analysis of a sample mapped with STAR ๐ŸŒŸ:

QTLtools ase --vcf multi_sample.bcf --bam sample1.bam --ind sample1 --mapq 255 --out sample1 --filtered sample1.filtered.gz --gtf gencode.v19.annotation.gtf.gz --blacklist poor_mappability_regions.bed --fasta hg19.fa --fix-chr --fix-id

๐Ÿ”— SEE ALSO

QTLtools(1) ๐Ÿ’…

QTLtools website: https://qtltools.github.io/qtltools ๐ŸŒ

๐Ÿ› BUGS

Found a bug? Submit it here: 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), Olivier Delaneau (olivier.delaneau@gmail.com) ๐Ÿซถ


And that's the whole page, bestie! โœจ This one is from QTLtools v1.3, dated 06 May 2020, and it's the QTLtools-ase(1) page. ๐Ÿฆ‹ Go forth and run some ASE analysis, you absolutely slay ๐Ÿ’…๐ŸŒธ