HiCRatio.Plot: This function plots a Ratio HiC plot. The function uses...

Description Usage Arguments Details Value

View source: R/functions.R

Description

This function plots a Ratio HiC plot. The function uses global variables provided default by the pileup.r script.

Usage

1
HiCRatio.Plot(plotData, plotTitle, arrowYes = 0, offsetf = 1)

Arguments

plotData

Data input in a matrix format.

plotTitle

Title of the plot.

ArrowYes

Boolean, 1 = arrows at CHiP peaks, 0 = No arrow.

Details

zoomC1 = zoomC/2

plotData$change <- log2(plotData[,3])

plotData$colvalue <- ifelse(plotData$change<0,-plotData$change, plotData$change)

rbPal <- colorRampPalette(c("white","blue"))

rbPal1 <- colorRampPalette(c("white","red"))

plotData$colvalue <- ifelse(plotData$colvalue<=ratioSBR, plotData$colvalue, ratioSBR) #makes color values above the max = to the max range

plotData$colB <- ifelse(plotData$change<=0, plotData$colvalue, 0)

plotData$colR <- ifelse(plotData$change>=0, plotData$colvalue, 0)

plot(1,1,xlim=c(-zoomC1,zoomC1), ylim=c(-zoomC*(0.5*mirrorPlot),minY*1.5),

ylab=yAxisTitle,xlab=xAxisTitle,yaxt="n",xaxt="n",yaxs="i",xaxs ="i") # added *2 to fit inverted plot

axis(2, at = ylabel,labels = y2label, las = 2)

axis(1, at = xlabel,labels = xlabel, las = 1)

palette(paste0(rbPal1(shades*ratioSBR ),"FF"))

points(((plotData$V1-0.5)*resKB+(plotData$V2-plotData$V1+offsetf)*resKB*offset)-zoomC,

((plotData$V2)*resKB-(plotData$V1)*resKB)-zoomC,

pch=18,

cex=sz,

col=shades*plotData$colR)

palette(paste0(rbPal(shades*ratioSBR ),"FF"))

points(((plotData$V1-0.5)*resKB+(plotData$V2-plotData$V1+offsetf)*resKB*offset)-zoomC,

((plotData$V2)*resKB-(plotData$V1)*resKB)-zoomC,

pch=18,

cex=sz,

col=shades*plotData$colB)

title(main=plotTitle,line = -plotTitleOffset)

arrows(minarrowmax,arrowposx,minarrowmin,arrowposx,col="black",lwd=1,length=.025,code = 3)

arrows(maxarrowmin,arrowposx,maxarrowmax,arrowposx,col="black",lwd=1,length=.025,code = 3)

Value

A Ratio HiC plot


gb305/Rpackages documentation built on Feb. 18, 2020, 2:55 p.m.