Learn R Programming

nucleR (version 2.4.0)

syntheticNucMap: Generates a synthetic nucleosome map

Description

This function generates a synthetic nucleosome map using the parameters given by the user and returns the coverage (like NGS experiments) or a pseudo-hybdridization ratio (like Tiling Arrays) toghether with the perfect information about the well positioned and fuzzy nucleosome positions.

Usage

syntheticNucMap(wp.num=100, wp.del=10, wp.var=20, fuz.num=50, fuz.var=50, max.cover=20, nuc.len=147, lin.len=20, rnd.seed=NULL, as.ratio=FALSE, show.plot=FALSE, ...)

Arguments

wp.num
Number of well-positioned (non overlapped) nucleosomes. They are placed uniformly every nuc.len+lin.len basepairs.
wp.del
Number of well-positioned nucleosomes (the ones generated by wp.num) to remove. This will create an uncovered region.
wp.var
Maximum variance in basepairs of the well-positioned nucleosomes. This will create some variation in the position of the reads describing the same nucleosome
fuz.num
Number of fuzzy nucleosomes. They are distributed randomly over all the region. They could be overlapped with other well-positioned or fuzzy nucleosomes.
fuz.var
Maximum variance of the fuzzy nucleosomes. This allow to set different variance in well-positioned and fuzzy nucleosome reads (using wp.var and fuz.var)
max.cover
Maximum coverage of a nucleosome, i.e., how many times a nucleosome read can be repeated. The final coverage probably will be higher by the addition of overlapping nucleosomes.
nuc.len
Nucleosome length. It's not recomended change the default 147bp value.
lin.len
Linker DNA length. Usually around 20 bp.
rnd.seed
As this model uses random distributions for the placement, by setting the rnd.seed to a known value allows to reproduce maps in different executions or computers. If you don't need this, just left it in default value.
as.ratio
If as.ratio=TRUE this will create and return a synthetic naked DNA control map and the ratio between it and the nucleosome coverage. This can be used to simulate hybridization ratio data, like the one in Tiling Arrays.
show.plot
If TRUE, will plot the output coverage map, with the nucleosome calls and optionally the calculated ratio.
...
Additional parameters to be passed to plot if show.plot=TRUE

Value

A list with the following elements:
wp.starts
Start points of well-positioned nucleosomes
wp.nreads
Number of repetitions of each well positioned read
wp.reads
Well positioned nucleosome reads (IRanges format), containing the repetitions
fuz.starts
Start points of the fuzzy nucleosomes
fuz.nreads
Number of repetitions of each fuzzy nucleosome read
fuz.reads
Fuzzy nucleosome reads (IRanges format), containing all the repetitions
syn.reads
All synthetic nucleosome reads togheter (IRanges format)
The following elements will be only returned if as.ratio=TRUE:
ctr.reads
The pseudo-naked DNA (control) reads (IRanges format)
syn.ratio
The calculated ratio nucleosomal/control (Rle format)

Examples

Run this code
	
	#Generate a synthetic map with 50wp + 20fuzzy nucleosomes using fixed random seed=1
	res = syntheticNucMap(wp.num=50, fuz.num=20, show.plot=TRUE, rnd.seed=1)

	#Increase the fuzzyness
	res = syntheticNucMap(wp.num=50, fuz.num=20, wp.var=70, fuz.var=150, show.plot=TRUE, rnd.seed=1)

	#Calculate also a random map and get the ratio between random and nucleosomal
	res = syntheticNucMap(wp.num=50, wp.del=0, fuz.num=20, as.ratio=TRUE, show.plot=TRUE, rnd.seed=1)

	print(res)

	#Different reads can be accessed separately from results
	#Let's use this to plot the nucleosomal + the random map
	par(mfrow=c(3,1), mar=c(3,4,1,1))
	plot(as.vector(coverage(res$syn.reads)), type="h", col="red", ylab="nucleosomal", ylim=c(0,35))
	plot(as.vector(coverage(res$ctr.reads)), type="h", col="blue", ylab="random", ylim=c(0,35))
	plot(as.vector(res$syn.ratio), type="h", col="orange", ylab="ratio")	

Run the code above in your browser using DataLab