countFinalRegions: countFinalRegions

View source: R/countMatrixFunctions.R

countFinalRegionsR Documentation

countFinalRegions

Description

count reads falling within the final regions.

Usage

countFinalRegions(
  regionsGRanges,
  readsFilePath = NULL,
  fileType = c("bam", "bed"),
  minCarriers = 2,
  genomeName = NULL,
  onlyStdChrs = FALSE,
  carrierscolname = "k-carriers",
  ignStrandSO = TRUE,
  modeSO = "Union",
  saveFlag = FALSE,
  savePath = "finalRegions",
  verbose = TRUE
)

Arguments

regionsGRanges

a GRanges objects representing the peaks to compute the coverage, with a "k-carriers" mcols. (tipically generated by finalRegions function).

readsFilePath

the filepath of bam or bed files necessary to compute the coverage.

fileType

the file type of the input files.

minCarriers

minimum number of carriers (samples).

genomeName

code name of the genome of reads files (i.e. "mm9").

onlyStdChrs

a flag indicating if to keep only the standard chromosomes

carrierscolname

character describing the name of the column within the carriers number (default is "k-carriers").

ignStrandSO

a flag indicating if to ignore the reads strand. (see GenomicAlignments::summarizeOverlaps).

modeSO

the mode to use, default is "Union". (see GenomicAlignments::summarizeOverlaps).

saveFlag

a flag indicating if to save the results.

savePath

the path where to store the results.

verbose

verbose output.

Value

A SummarizedExperiment object containing as assays the read counts matrix with regions as rows and samples as columns, and as rowRanges the GRanges object representing the peaks used as rows in the matrix.

Examples

filename <- system.file("extdata/regions/regions.rds", package="DEScan2")
regionsGR <- readRDS(file=filename)
reads.path <- system.file("extdata/bam", package="DEScan2")
finalRegionsSE <- countFinalRegions(regionsGRanges=regionsGR,
    readsFilePath=reads.path, fileType="bam", minCarriers=1,
    genomeName="mm9", onlyStdChrs=TRUE, ignStrandSO=TRUE, saveFlag=FALSE,
    verbose=TRUE)
library("SummarizedExperiment")
assay(finalRegionsSE) ## matrix of counts
rowRanges(finalRegionsSE) ## the GRanges of the input regions

drighelli/DEScan2 documentation built on March 21, 2023, 3:06 p.m.