mergeLibs | R Documentation |
Aggregate count of reads (from the "score" column) by making a merged library. Only allowed for .ofst files!
mergeLibs(
df,
out_dir = file.path(libFolder(df), "ofst_merged"),
mode = "all",
type = "ofst",
keep_all_scores = TRUE,
paths = filepath(df, type),
lib_names_full = bamVarName(df, skip.libtype = FALSE),
max_splits = 20
)
df |
an ORFik |
out_dir |
Ouput directory, default |
mode |
character, default "all". Merge all or "rep" for collapsing replicates only, or "lib" for collapsing all per library type. |
type |
a character(default: "default"), load files in experiment
or some precomputed variant, like "ofst" or "pshifted".
These are made with ORFik:::convertLibs(),
shiftFootprintsByExperiment(), etc.
Can also be custom user made folders inside the experiments bam folder.
It acts in a recursive manner with priority: If you state "pshifted",
but it does not exist, it checks "ofst". If no .ofst files, it uses
"default", which always must exists. |
keep_all_scores |
logical, default TRUE, keep all library scores in the merged file. These
score columns are named the libraries full name from |
paths |
character vector, the filpaths to use,
default |
lib_names_full |
character vector, default: bamVarName(df, skip.libtype = FALSE). Name to assign to single libraries inside merged file, only kept if mode != "all" |
max_splits |
integer, default 20. If number of rows to merge > 2^31, how many times can you allow split merging to try to "rescue" the merging process? |
NULL, files saved to disc. A data.table with a score column that now contains the sum of scores per merge setting.
df2 <- ORFik.template.experiment()
df2 <- df2[df2$libtype == "RFP",]
# Merge all
#mergeLibs(df2, tempdir(), mode = "all", type = "default")
# Read as GRanges with mcols
#fimport(file.path(tempdir(), "all.ofst"))
# Read as direct fst data.table
#read_fst(file.path(tempdir(), "all.ofst"))
# Collapse replicates
#mergeLibs(df2, tempdir(), mode = "rep", type = "default")
# Collapse by lib types
#mergeLibs(df2, tempdir(), mode = "lib", type = "default")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.