MEGADEPTH(1)

πŸ‘‘ MEGADEPTH(1) πŸ‘‘

okay so bestie, pull up a chair, because megadepth is one of those tools that looks scary and is actually just a very good friend. it lives in the User Commands part of the manual, and it's about to be your whole personality. no cap. πŸ’…


🌸 NAME 🌸

megadepth β€” quantification of genome coverage by DNA/RNA seqencing 🧬✨


πŸ’– DESCRIPTION πŸ’–

so this is megadepth 1.2.0, and it's a BAM and BigWig utility. that's the whole vibe. πŸ¦‹

πŸŽ€ Usage:

megadepth <bam|bw|-> [options]

like. that's it. you hand it a BAM or a BigWig (or a -), you add options, it does the thing. main character energy fr fr.


✨ OPTIONS ✨

🌈 the basics (everyone's faves)

  • -h --help β€” shows this screen. your emotional support flag. 🫢
  • --version β€” shows the version. that's it, that's the flag.
  • --threads β€” the number of threads to do BAM decompression OR to compute sums over multiple BigWigs in parallel. if it's the second one you want, then a TXT file listing the paths to the BigWigs to process in parallel should be passed in as the main input file instead of a single BigWig file (EXPERIMENTAL). πŸ‘€
  • --prefix β€” the string used to prefix all your output files. yes bestie, name your babies. 🍼
  • --no-auc-stdout β€” forces all AUC(s) to be written to <prefix>.auc.tsv instead of STDOUT.
  • --no-annotation-stdout β€” forces summarized annotation regions to be written to <prefix>.annotation.tsv instead of STDOUT.
  • --no-coverage-stdout β€” forces covered regions to be written to <prefix>.coverage.tsv instead of STDOUT.
  • --keep-order β€” outputs annotation coverage in the order chromosomes appear in the BAM/BigWig file. the default is to output annotation coverage in the order chromosomes appear in the annotation BED file. this only applies if --annotation is used for either BAM or BigWig input. πŸ”€

πŸ¦‹ BigWig Input πŸ¦‹

extracts regions and their counts from a BigWig, outputting BED format, if a BigWig file is detected as input (this is exclusive of the other BAM modes, so no mixing, bestie):

extracts all reads from the passed-in BigWig and outputs as BED format. this will also report the AUC over the annotated regions to STDOUT. and if only the name of the BigWig file is passed in with no other args, it will *only* report total AUC to STDOUT. iconic behaviour honestly. 🌟

  • --annotation <bed> β€” only outputs the regions in this BED, applying the argument you gave to --op to them.
  • --op <sum[default], mean, min, max> β€” the statistic to run on the intervals provided by --annotation. sum is the default, no cap.
  • --sums-only β€” discards the coordinates from the output of the summarized regions. just the numbers, ma'am. πŸ’…
  • --distance (2200[default]) β€” the number of base pairs between the end of the last annotation and the start of a new one to consider in the same BigWig query window (a form of binning) for performance. this is literally what determines how many times the BigWig index gets queried.
  • --unsorted (off[default]) β€” there's a performance improvement *if* the BED file passed to --annotation is 1) sorted by sort -k1,1 -k2,2n. the default is to assume it's sorted and check for unsorted positions; if unsorted positions are found, it'll fall back to the slower version. so it's giving "we'll find out" energy. πŸ•΅οΈ
  • --bwbuffer <1GB[default]> β€” the size of the buffer for reading BigWig files. critical to use a large value (~1GB) for remote BigWigs. the default setting should be fine for most uses, but raise it if things are very slow on a remote BigWig. πŸŒβž‘οΈπŸš€

🧬 BAM Input 🧬

extracts basic junction information from the BAM, including co-occurrence. and if only the name of the BAM file is passed in with no other args, it will *only* report total AUC to STDOUT.

  • --fasta β€” path to the reference FASTA file if a CRAM file is passed as the input file (ignored otherwise). if you don't pass it, references will be downloaded using the CRAM header. πŸ”
  • --junctions β€” extracts co-occurring jx coordinates, strand, and anchor length, per read. writes to a TSV file <prefix>.jxs.tsv.
  • --all-junctions β€” extracts all jx coordinates, strand, and anchor length, per read, for any jx. writes to a TSV file <prefix>.all_jxs.tsv.
  • --longreads β€” modifies certain buffer sizes to accommodate longer reads such as PB/Oxford. long queen behaviour. πŸ‘‘
  • --filter-in β€” integer bitmask; any bits of which alignments need to have in order to be kept (similar to samtools view -f).
  • --filter-out β€” integer bitmask; any bits of which alignments need to have in order to be skipped (similar to samtools view -F).
  • --add-chr-prefix β€” adds the "chr" prefix to relevant chromosomes for BAMs w/o it; pass "human" or "mouse". only works for human/mouse references (default: off).

🌈 Non-reference summaries 🌈

  • --alts β€” print differing-from-ref per-base coverages. writes to a CSV file <prefix>.alts.tsv.
  • --include-softclip β€” print a record to the alts CSV for soft-clipped bases. writes total counts to a separate TSV file <prefix>.softclip.tsv.
  • --only-polya β€” if --include-softclip is on, only print softclips which are mostly A's or T's. πŸ…°οΈπŸ†ƒ
  • --include-n β€” print mismatch records when the mismatched read base is N.
  • --print-qual β€” print quality values for mismatched bases.
  • --delta β€” print the POS field as +/- delta from the previous one.
  • --require-mdz β€” quit with an error unless the MD:Z field exists everywhere it's expected. > bestie this one is strict. it will not vibe with missing MD:Z. it exits. periodt. πŸ’€
  • --head β€” print sequence names and lengths in the SAM/BAM header.

πŸŽ€ Coverage and quantification πŸŽ€

  • --coverage β€” print per-base coverage (slow but totally worth it). the original said it, and honestly? correct.
  • --auc β€” print per-base area-under-coverage. it'll generate it for the genome and for the annotation if --annotation is also passed in. defaults to STDOUT, unless other params are passed in as well, and then it writes to a TSV file <prefix>.auc.tsv.
  • --bigwig β€” output coverage as BigWig file(s). writes to <prefix>.bw (and also <prefix>.unique.bw when --min-unique-qual is specified). requires libBigWig. πŸ“¦
  • --annotation <BED|window_size> β€” path to a BED file containing the list of regions to sum coverage over (tab-delimited: chrm,start,end). or this can specify a contiguous region size in bp. (yep, this flag shows up in two sections β€” it's that girl.)
  • --op <sum[default], mean> β€” the statistic to run on the intervals provided by --annotation. default is sum. (also a repeat visitor, and here the menu is shorter: just sum and mean.)
  • --no-index β€” if using --annotation, skip the use of the BAM index (BAI) for pulling out regions. setting this can be faster if you're doing windows across the whole genome. this will be turned on automatically if a window size is passed to --annotation.
  • --min-unique-qual <int> β€” output a second bigWig consisting only of alignments with at least this mapping quality. --bigwig must be specified. also produces a second set of annotation sums based on this coverage if --annotation is enabled.
  • --double-count β€” allow overlapping ends of a PE read to count twice toward coverage. yes, twice. it said what it said. πŸ‘―
  • --num-bases β€” report the total sum of bases in the alignments processed (the ones that pass filters).
  • --gzip β€” turns on gzipping of coverage output (no effect if --bigwig is passed), and this will also enable --no-coverage-stdout. πŸ—œοΈ

πŸ“ Other outputs πŸ“

  • --read-ends β€” print counts of read starts/ends; if --min-unique-qual is set, then only the alignments that pass that filter will be counted here. writes to 2 TSV files: <prefix>.starts.tsv, <prefix>.ends.tsv.
  • --frag-dist β€” print the fragment length distribution across the genome. writes to a TSV file <prefix>.frags.tsv.
  • --echo-sam β€” print a SAM record for each aligned read.
  • --ends β€” report the end coordinate for each read (useful for debugging). πŸ›
  • --test-polya β€” lower the Poly-A filter minimums for testing (only useful for debugging/testing). > bestie this is a testing-only flag. it is not for production. do not make it your main character. πŸ™ˆ

and that's the whole page!! πŸ’œ this was megadepth 1.2.0, from July 2022, and it lives in section 1 of the manual β€” go forth and quantify, bestie, you're gonna slay πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from