makeSummarizedExperimentFromBam: Make a count matrix from a library or experiment

Description Usage Arguments Details Value Examples

View source: R/SummarizedExperiment_helpers.R

Description

Make a summerizedExperiment / matrix object from bam files

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
makeSummarizedExperimentFromBam(
  df,
  saveName = NULL,
  longestPerGene = TRUE,
  geneOrTxNames = "tx",
  region = "mrna",
  type = "count",
  lib.type = "ofst",
  weight = "score"
)

Arguments

df

an ORFik experiment

saveName

a character (default NULL), if set save experiment to path given. Always saved as .rds., it is optional to add .rds, it will be added for you if not present. Also used to load existing file with that name.

longestPerGene

a logical (default TRUE), if FALSE all transcript isoforms per gene.

geneOrTxNames

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

region

a character vector (default: "mrna"), make raw count matrices of whole mrnas or one of (leaders, cds, trailers). Can also be a GRangesList, then it uses this region directly.

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.

Details

If txdb or gtf path is added, it is a rangedSummerizedExperiment NOTE: If the file called saveName exists, it will then load file, not remake it!

Value

a SummarizedExperiment object or data.table if "type" is not "count, with rownames as transcript / gene names.

Examples

1
2
3
4
5
6
7
##Make experiment
df <- ORFik.template.experiment()
# makeSummarizedExperimentFromBam(df)
# Only cds (coding sequences):
# makeSummarizedExperimentFromBam(df, region = "cds")
# FPKM instead of raw counts on whole mrna regions
# makeSummarizedExperimentFromBam(df, type = "fpkm")

ORFik documentation built on March 27, 2021, 6 p.m.