makeSummarizedExperimentFromBam {ORFik} | R Documentation |
Make a summerizedExperiment / matrix object from bam files
makeSummarizedExperimentFromBam( df, saveName = NULL, longestPerGene = TRUE, geneOrTxNames = "tx", region = "mrna", type = "count" )
df |
an ORFik |
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 |
type |
default: "count" (raw counts matrix), alternative is "fpkm", "log2fpkm" or "log10fpkm" |
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!
a SummarizedExperiment
object or data.table if
"type" is not "count, with rownames as transcript / gene names.
# 1. Pick directory dir <- system.file("extdata", "", package = "ORFik") # 2. Pick an experiment name exper <- "ORFik" # 3. Pick .gff/.gtf location txdb <- system.file("extdata", "annotations.gtf", package = "ORFik") template <- create.experiment(dir = dir, exper, txdb = txdb, viewTemplate = FALSE) template$X5[6] <- "heart" # <- fix non unique row # read experiment df <- read.experiment(template) # makeSummarizedExperimentFromBam(df) # Only cds (coding sequences): # makeSummarizedExperimentFromBam(df, region = "cds") # FPKM instead of raw counts on whole mrna regions # makeSummarizedExperimentFromBam(df, type = "fpkm")