Distribution of the number of alignments per read from RSEM .cnt files
Source: R/rsem_mapping_qc.R
rsem_alignment_profile.RdAfter its first three lines, an RSEM .cnt file lists how many reads have
0, 1, 2, ... alignments (the last line, Inf, counts the reads that were
filtered for having too many). rsem_mapping_qc() gives one row per sample;
this function returns the whole distribution, which shows how concentrated
multi-mapping is, where the mean (alignments_per_read) does not.
Value
A data frame with one row per sample and number of alignments:
sample_id, n_alignments (Inf for the filtered reads), n_reads and
fraction of all reads (N_tot) in the file. A warning says when the
reads in the histogram do not add up to N_tot of the first line.
Examples
f <- tempfile(fileext = ".cnt")
writeLines(c("100 850 50 1000", "800 50 120", "1500 2", "0 100", "1 700", "2 150", "Inf 50"), f)
rsem_alignment_profile(dirname(f), metadata = NULL)
#> rsem_alignment_profile: 1 samples, 4 rows
#> sample_id n_alignments n_reads fraction
#> 1 file182d2f7be1dc 0 100 0.10
#> 2 file182d2f7be1dc 1 700 0.70
#> 3 file182d2f7be1dc 2 150 0.15
#> 4 file182d2f7be1dc Inf 50 0.05