Create_any_resolution_LFM: Create a ligation frequency matrix or InteractionSet binned...

Description Usage Arguments Value Examples

View source: R/binning.R

Description

Use this function to create a sparse ligation frequency matrix with genome annotation or an InteractionSet. Binning is optional. By default, the restriction fragment (RF) resolution will be chosen.

Usage

1
Create_any_resolution_LFM(RFpairs, RFanno, binSize = NULL)

Arguments

RFpairs

A dataframe with two columns containing restriction fragment pairs. The restriction fragment with the lower ID is always in the left column, and all restriction fragments are sorted in ascending order first by the left column and then by the right colunn.

RFanno

A dataframe giving the genomic annotation of the restriction fragments. Columns are: chromosome, start of restriction fragment, end of restriction fragment, restriction fragment ID. The table is sorted by chromosomal position and restriction fragments are numbered along their genomic position.

binSize

The size of a bin. Optional parameter; if no value is given, the function will default to not binning (binSize=NULL) and instead giving the ligation frequency matrix at restriction fragment resolution (calculation can be slow).

Value

The ligation frequency matrix LFM, a sparse matrix annotated by genomic position, or an InteractionSet.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Restriction fragment pairs are given here (RFpairs)
toyRFpairs <- data.frame(RF1 = c(1:15), RF2 = c(5,7,11,12,11,14,10,15,16,15,19,20,14,17,19))

# Genomic annotation of the restriction fragment pairs (RFanno)
chr <- c(rep.int(1,10), rep.int(2,10), rep.int(3,10))
start <- rep.int(seq(1,30,by = 3), 3)
end <- start + 2
RF_id <- c(1:30)
toyRFanno <- data.frame(chr, start, end, RF_id)

# Create a toy ligation frequency matrix
toyMatrix <- chromium:::Create_any_resolution_LFM(toyRFpairs, toyRFanno, binSize = 3)

# In a more realistic example the bin size would range between kilobases and megabases

AnnikaGable/chromium documentation built on May 5, 2019, 6:04 a.m.