density.matrix: Density matrix builder

View source: R/density.matrix.R

density.matrixR Documentation

Density matrix builder

Description

A function (completely in R) that generates a matrix given a list of regions (.bed files) and signals (.bigWig files) alternative (even though more time consuming) to computeMatrix.deeptools. The output can be passed as it is to the functions plot.density.profile, plot.density.summary and, plot.density.differences.

Usage

## S3 method for class 'matrix'
density(
  mode,
  regions.list,
  samples.list,
  region.names = NULL,
  sample.names = NULL,
  sort.regions.coordinates = FALSE,
  reference.point = "center",
  reference.point.label = NULL,
  upstream = 500,
  downstream = 500,
  body.length = 1000,
  missing.data.as.zero = FALSE,
  bin.size = 10,
  binning.operation = "mean",
  stranded = FALSE
)

Arguments

mode

A string indicating the method for the matrix computation:

  • scale-regions all regions in the BED file are stretched or shrunken to the length (in bases) indicated by the user (body.length);

  • reference-point the matrix will be performed on the range -upstream+downstream from the indicated reference point (center, TSS, TES).

regions.list

A string vector with a list of full paths to bed files or list of data.frames in at least BED3 format (eg. generated by build.bed).

samples.list

A string vector with a list of full paths to bigWig files.

region.names

A string vector with the names of the regions. If NULL or of length lower than the number of regions the names will be assigned using the basename of the file if a path is provided otherwise "region_<order number>". By default NULL.

sample.names

A string vector with the names of the samples. If NULL or of length lower than the number of samples the names will be assigned using the basename of the file. By default NULL.

sort.regions.coordinates

Logical value to define whether the output matrix should contain the regions sorted by genomic location for each region group (sorted by sort.bed). By default FALSE.

reference.point

The reference point for the matrix generation could be either the region start ("TSS"), the region end ("TES") or the "center" of the region. By default "center".

reference.point.label

A single string with the label for the reference point that could be used for the plots.

upstream

Distance, in bases (bp), upstream of the reference-point, in "reference-point" mode, or the region start, in "scale-regions" mode. By default 500.

downstream

Distance, in bases (bp), downstream of the reference-point, in "reference-point" mode, or the region start, in "scale-regions" mode. By default 500.

body.length

Distance, in bases (bp), to which all regions will be fit. By default: 1000.

missing.data.as.zero

A logical value to define whether missing data (NAs) should be treated as zeros. By default FALSE.

bin.size

Length, in bases (bp), of the non-overlapping bins for averaging the score over the regions length. By default 10.

binning.operation

A single string to define the type of statistic that should be used over the bin size range. The options are: "mean", "median", "sum". By default "mean".

stranded

Logical value to indicate whether the strand of the region should be taken into account. When TRUE, the order of the bigWig score for the given region will be reversed. Default FALSE.

Value

The function returns a named list containing:

  • metadata data.frame with the parameters used to build the matrix;

  • matrix.data data.frame with the computed scores;

  • original.file.path with the string: "Matrix generated by Rseb::density.matrix()".

This list can be passed as it is to the functions plot.density.profile, plot.density.summary and, plot.density.differences.


sebastian-gregoricchio/Rseb documentation built on May 15, 2024, 5:45 a.m.