Skip to content

Concepts

The ideas tinymapper is built on, and the words this documentation uses for them.

A run

A run is one command: the reads of one sample, mapped and processed by one mode, into one output directory. It runs the programs one after the other, logs each command, and stops at the first that fails. It never overwrites another run's outputs: each run draws a hash, six letters and digits, which every BAM file, track, peak file or contact map it writes carries. Two runs of a sample, with other options, can share an output directory; the sample's statistics and report are then the newest run's.

The sample, and path prefixes

--sample, --input, --genome and --calibration are path prefixes: the path of the files without their endings. --sample ~/reads/JS001 finds ~/reads/JS001_R1.fq.gz and ~/reads/JS001_R2.fq.gz (Reads); --genome ~/genomes/W303/W303 finds ~/genomes/W303/W303.fa and its indexes. The prefix's base name, JS001, is the sample's name: it names the run's folders, its log, its statistics and its report.

Modes

A mode is a kind of library, with its programs and its outputs:

Mode Maps with Makes
ChIP-seq bwa-mem2 tracks, peaks; with an input, the ratio to it; with a spike-in, a calibrated track
RNA-seq STAR unstranded and stranded tracks
ATAC-seq bwa-mem2 a track, peaks
MNase-seq bwa-mem2 tracks of the nucleosomes' coverage and positions
Hi-C hicstuff (bwa, or bowtie2) contact maps, pairs, a track
shotgun bwa-mem2 a track

Filtering and duplicates

A run keeps the reads that map well, and leaves out the duplicates:

  • Filtering: of paired-end reads, those whose two reads map, as a proper pair, with a mapping quality of 10 or more (--filter); of single-end reads, those that map with a mapping quality of 10 or more.
  • Duplicates: reads that map where another does, at the same position and, for pairs, with the same mate: copies of one fragment, made by PCR. samtools marks them; they are removed from paired-end BAMs, flagged in single-end and RNA-seq BAMs, and the tracks leave them out either way. --duplicates keeps them.

The kept reads are those that remain: the tracks, the peaks and the contact maps are made from them, and the report gives their share.

Tracks

A track is the coverage of the genome by the kept reads, as a bigWig file. tinymapper normalises them in counts per million mapped reads (CPM), so that samples of different depths compare. Pairs cover their whole fragment; single-end reads are extended to --extend-reads.

Spike-in calibration

A ChIP-seq sample can be calibrated against a spike-in: chromatin of another species, added in a known amount before the immunoprecipitation. The reads on the spike-in's genome measure how much the immunoprecipitation pulled down, which CPM normalisation hides. The occupancy ratio (ORI) compares the sample's reads on the two genomes to the input's, and scales the calibrated track.

The log and the report

Each run writes a log, logs/<sample>.tinymapper_<YYYYMMDDHHMMSS>.log, whose header records its options and its hash, then every command it ran (Logs). At its end, it writes its report: its numbers, in <sample>.report.txt, its row of MultiQC's table, in <sample>.report_mqc.yaml, and a page, <sample>.report.html (The report of a run).