Loads the idxstats file, and counts the total number of mapped reads generated by bam_sort_index_stats.

get_total_reads(
  idxstats_file,
  select_chr = TRUE,
  chrs = paste0("chr", c(1:22))
)

Arguments

idxstats_file

idxstats file.

select_chr

Logical. If TRUE, counts reads in chromosomes specified in ‘chrs’. Otherwise, uses all chromosomes in idxstats_file.

chrs

Chromosomes to be included (default: chr1, ..., chr22).

Value

The total number of mapped reads.

Examples

if (FALSE) {
total_mapped_reads <- get_total_reads('sample.bam.idxstats.txt')
}