Skip to contents

Normalizes data in a grandR object and puts the normalized data into a new slot

Usage

Normalize(
  data,
  genes = Genes(data),
  name = "norm",
  slot = "count",
  set.to.default = TRUE,
  size.factors = NULL,
  return.sf = FALSE
)

NormalizeFPKM(
  data,
  genes = Genes(data),
  name = "fpkm",
  slot = "count",
  set.to.default = TRUE,
  tlen = GeneInfo(data, "Length")
)

NormalizeRPM(
  data,
  genes = Genes(data),
  name = "rpm",
  slot = "count",
  set.to.default = TRUE,
  factor = 1e+06
)

NormalizeTPM(
  data,
  genes = Genes(data),
  name = "tpm",
  slot = "count",
  set.to.default = TRUE,
  tlen = GeneInfo(data, "Length")
)

Arguments

data

the grandR object

genes

compute the normalization w.r.t. these genes (see details)

name

the name of the new slot for the normalized data

slot

the name of the slot for the data to normalize

set.to.default

set the new slot as the default slot

size.factors

numeric vector; if not NULL, use these size factors instead of computing size factors

return.sf

return the size factors and not a grandR object

tlen

the transcript lengths (for FPKM and TPM)

factor

the rpm factor (default: 1 (m)illion)

Value

a new grandR object with a new data slot

Details

Normalize will perform DESeq2 normalization, i.e. it will use estimateSizeFactorsForMatrix to estimate size factors, and divide each value by this. If genes are given, size factors will be computed only w.r.t. these genes (but then all genes are normalized).

NormalizeFPKM will compute fragments per kilobase and million mapped reads. If genes are given, the scaling factor will only be computed w.r.t. these genes (but then all genes are normalized).

NormalizeRPM will compute reads per million mapped reads. If genes are given, the scaling factor will only be computed w.r.t. these genes (but then all genes are normalized).

NormalizeTPM will compute transcripts per million mapped reads. If genes are given, the scaling factor will only be computed w.r.t. these genes (but then all genes are normalized).

Genes can be referred to by their names, symbols, row numbers in the gene table, or a logical vector referring to the gene table rows.

Examples

sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
                  design=c("Cell",Design$dur.4sU,Design$Replicate))
#> Warning: Duplicate gene symbols (n=1, e.g. MATR3) present, making unique!

sars <- Normalize(sars)
DefaultSlot(sars)
#> [1] "norm"