transcriptWindow: Make 100 bases size meta window for all libraries in...

View source: R/experiment_plots.R

transcriptWindowR Documentation

Make 100 bases size meta window for all libraries in experiment

Description

Gives you binned meta coverage plots, either saved seperatly or all in one.

Usage

transcriptWindow(
  leaders,
  cds,
  trailers,
  df,
  outdir = NULL,
  scores = c("sum", "transcriptNormalized"),
  allTogether = TRUE,
  colors = experiment.colors(df),
  title = "Coverage metaplot",
  windowSize = min(100, min(widthPerGroup(leaders, FALSE)), min(widthPerGroup(cds,
    FALSE)), min(widthPerGroup(trailers, FALSE))),
  returnPlot = is.null(outdir),
  dfr = NULL,
  idName = "",
  plot.ext = ".pdf",
  type = "ofst",
  is.sorted = FALSE,
  drop.zero.dt = TRUE,
  verbose = TRUE,
  force = TRUE,
  library.names = bamVarName(df),
  BPPARAM = bpparam()
)

Arguments

leaders

a GRangesList of leaders (5' UTRs)

cds

a GRangesList of coding sequences

trailers

a GRangesList of trailers (3' UTRs)

df

an ORFik experiment

outdir

directory to save to (default: NULL, no saving)

scores

scoring function (default: c("sum", "transcriptNormalized")), see ?coverageScorings for possible scores.

allTogether

plot all coverage plots in 1 output? (defualt: TRUE)

colors

Which colors to use, default auto color from function experiment.colors, new color per library type. Else assign colors yourself.

title

title of ggplot

windowSize

size of binned windows, default: 100

returnPlot

return plot from function, default is.null(outdir), so TRUE if outdir is not defined.

dfr

an ORFik experiment of RNA-seq to normalize against. Will add RNA normalized to plot name if this is done.

idName

A character ID to add to saved name of plot, if you make several plots in the same folder, and same experiment, like splitting transcripts in two groups like targets / nontargets etc. (default: "")

plot.ext

character, default: ".pdf". Alternatives: ".png" or ".jpg".

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.
Presets are (folder is relative to default lib folder, some types fall back to other formats if folder does not exist):
- "default": load the original files for experiment, usually bam.
- "ofst": loads ofst files from the ofst folder, relative to lib folder (falls back to default)
- "pshifted": loads ofst, wig or bigwig from pshifted folder (falls back to ofst, then default)
- "cov": Load covRle objects from cov_RLE folder (fail if not found)
- "covl": Load covRleList objects, from cov_RLE_List folder (fail if not found)
- "bed": Load bed files, from bed folder (falls back to default)
- Other formats must be loaded directly with fimport

is.sorted

logical (FALSE), is grl sorted. That is + strand groups in increasing ranges (1,2,3), and - strand groups in decreasing ranges (3,2,1)

drop.zero.dt

logical FALSE, if TRUE and as.data.table is TRUE, remove all 0 count positions. This greatly speeds up and most importantly, greatly reduces memory usage. Will not change any plots, unless 0 positions are used in some sense. (mean, median, zscore coverage will only scale differently)

verbose

logical, default TRUE, message about library output status.

force

logical, default TRUE If TRUE, reload library files even if matching named variables are found in environment used by experiment (see envExp) A simple way to make sure correct libraries are always loaded. FALSE is faster if data is loaded correctly already.

BPPARAM

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

Value

NULL, or ggplot object if returnPlot is TRUE

See Also

Other experiment plots: transcriptWindow1(), transcriptWindowPer()

Examples

df <- ORFik.template.experiment()[3,] # Only third library
loadRegions(df) # Load leader, cds and trailers as GRangesList
#transcriptWindow(leaders, cds, trailers, df, outdir = "directory/to/save")

Roleren/ORFik documentation built on June 30, 2024, 12:54 p.m.