countTable_regions: Make a list of count matrices from experiment

View source: R/SummarizedExperiment_helpers.R

countTable_regionsR Documentation

Make a list of count matrices from experiment

Description

By default will make count tables over mRNA, leaders, cds and trailers for all libraries in experiment. region

Usage

countTable_regions(
  df,
  out.dir = libFolder(df),
  longestPerGene = FALSE,
  geneOrTxNames = "tx",
  regions = c("mrna", "leaders", "cds", "trailers"),
  type = "count",
  lib.type = "ofst",
  weight = "score",
  rel.dir = "QC_STATS",
  forceRemake = FALSE,
  library.names = bamVarName(df),
  BPPARAM = bpparam()
)

Arguments

df

an ORFik experiment

out.dir

character, output directory, default: resFolder(df). Will make a folder within this called "QC_STATS" with all results in this directory. Warning: If you assign not default path, you will have a hazzle to load files later. Much easier to load count tables, statistics, ++ later with default. Update resFolder of df instead if needed.

longestPerGene

a logical (default FALSE), if FALSE all transcript isoforms per gene. Ignored if "region" is not a character of either: "mRNA","tx", "cds", "leaders" or "trailers".

geneOrTxNames

a character vector (default "tx"), should row names keep trancript names ("tx") or change to gene names ("gene")

regions

a character vector, default: c("mrna", "leaders", "cds", "trailers"), make raw count matrices of whole regions specified. Can also be a custom GRangesList of for example uORFs or a subset of cds etc.

type

default: "count" (raw counts matrix), alternative is "fpkm", "log2fpkm" or "log10fpkm"

lib.type

a character(default: "default"), load files in experiment or some precomputed variant, either "ofst", "bedo", "bedoc" or "pshifted". These are made with ORFik:::convertLibs() or shiftFootprintsByExperiment(). Can also be custom user made folders inside the experiments bam folder.

weight

numeric or character, a column to score overlaps by. Default "score", will check for a metacolumn called "score" in libraries. If not found, will not use weights.

rel.dir

relative output directory for out.dir, default: "QC_STATS". For pshifted, write "pshifted".

forceRemake

logical, default FALSE. If TRUE, will not look for existing file count table files.

library.names

character, default: bamVarName(df). Names to load libraries as to environment and names to display in plots.

BPPARAM

how many cores/threads to use? default: bpparam()

Value

a list of data.table, 1 data.table per region. The regions will be the names the list elements.

See Also

Other countTable: countTable()

Examples

##Make experiment
df <- ORFik.template.experiment()
## Create count tables for all default regions
# countTable_regions(df)
## Pshifted reads (first create pshiftead libs)
# countTable_regions(df, lib.type = "pshifted", rel.dir = "pshifted")

Roleren/ORFik documentation built on Dec. 18, 2024, 11:39 p.m.