Learn R Programming

metaseqR (version 1.12.2)

read2count: SAM/BAM/BED file reader helper for the metaseqr pipeline

Description

This function is a helper for the metaseqr pipeline, for reading SAM/BAM or BED files when a read counts file is not available.

Usage

read2count(targets, annotation, file.type = targets$type,
        has.all.fields = FALSE, multic = FALSE)

Arguments

targets
a named list, the output of read.targets.
annotation
see the annotation argument in the main metaseqr function. The "annotation" parameter here is the result of the same parameter in the main function. See also get.annotation.
file.type
the type of raw input files. It can be "bed" for BED files or "sam", "bam" for SAM/BAM files. See the same argument in the main metaseqr function for the case of auto-guessing.
has.all.fields
a logical variable indicating if all annotation fields used by metaseqr are available (that is apart from the main chromosome, start, end, unique id and strand columns, if also present are the gene name and biotype columns). The default is FALSE.
multic
a logical value indicating the presence of multiple cores. Defaults to FALSE. Do not change it if you are not sure whether package parallel has been loaded or not.

Value

  • A data frame with counts for each sample, ready to be passed to the main metaseqr pipeline.

Examples

Run this code
my.targets <- read.targets("my_mm9_study_bam_files.txt")
gene.data <- get.annotation("mm9","gene")
r2c <- read2count(targets=my.targets,
    file.type=my.targets$type,annotation=gene.data)
gene.counts <- r2c$counts
libsize.list <- r2s$libsize

Run the code above in your browser using DataLab