SEconstructFromCPM: Function to accept count data matrix and produce Z-scores,...

Description Usage Arguments Details Author(s) Examples

View source: R/src_SEconstructFromCPM.R

Description

The function accepts a standard numeric count matrix or data frame. Will then optionally filter these counts either for overlap with a provided GRanges object (Type = "ranged") or for overlap with a list of gene or region names (Type = "unranged"). Function can optionally filter for certain samples or average samples by groups depending on the GroupIndicator which could e.g. be "_rep", so WT_rep1, WT_rep2, KO_rep1, KO_rep2 => WT and KO were the groups here. Eventually will return the averaged counts (or optionally Z-scores) as individual assays in a (R)SE object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
SEconstructFromCPM(
  InputData,
  Type,
  Reference.Regions = NULL,
  Reference.Genes = NULL,
  GroupIndicator = NULL,
  GroupFilter = NULL,
  SampleFilter = NULL,
  transform.log2 = FALSE,
  AverageByGroup = FALSE,
  Zscore = TRUE
)

Arguments

InputData

a matrix or dataframe with the count data to be plotted

Type

"ranged" for GRanges input or "unranged" when a "Gene" column is present to be used as rowData

Reference.Regions

GRanges object to use for overlap filtering

Reference.Genes

Gene (or any name) list to filter for overlaps

GroupIndicator

the suffix that indicates replicates, e.g. "_rep"

GroupFilter

a list of group names to be retained

SampleFilter

a list of samples to be retained

transform.log2

logical, whether to transform counts to log2+1

AverageByGroup

logical, whether to average samples by group

Zscore

logical, whether to calculate Z score and return as assays(SE)$Z

Details

(tba...)

Author(s)

Alexander Toenges

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Unranged:
cts <- sapply(seq(1,10), function(x) rnorm(1000,100))
colnames(cts) <- paste0("sample", "_rep", seq(1,10))
cts <- data.frame(Gene=paste0("gene", seq(1,1000)), cts)
SE <- SEconstructFromCPM(InputData = cts, Type = "unranged", AverageByGroup = TRUE, GroupIndicator = "_rep")
## Ranged:
cts1 <- sapply(seq(1,10), function(x) rnorm(1000,100))
Gr <- GRanges(seqnames = rep("chr1", 1000), ranges = IRanges(start = seq(1,250), end = rep(1001, 1000)))
elementMetadata(Gr) <- cts1
RSE <- SEconstructFromCPM(InputData = Gr, Type = "ranged", AverageByGroup = TRUE, GroupIndicator = "_rep")

ATpoint/misterplotR documentation built on Feb. 15, 2020, 12:17 a.m.