Knowledge base

Sushi draws a partially enlarged bedgraph graph

Introduction

The bedgraph graph can be displayed using the plotBedgraph function of the Sushi package. However, we sometimes need to magnify a certain part of the coordinate axis on the basis of the original picture. At this time, use the magnification function of the Sushi package (including circle the magnified part and add magnified side branches

Code explanation

Input

bedGraph格式的data frame

head(Sushi_DNaseI.bedgraph)
chrom   start     end value1 
chr11 1640504 1640664     12 
chr11 1640904 1641004     13 
chr11 1641004 1641064     24 
chr11 1641064 1641164     15 
chr11 1645224 1645384     16 
chr11 1645504 1645664     1
Code example
library('Sushi')  # Loading Sushi package

Sushi_data = data(package ='Sushi') # List Sushi's own data
data(list = Sushi_data$results[,3]) # Load data

layout(matrix(c(1,1,2,3),2, 2, byrow = TRUE))  # Lay out the canvas using traditional lyout
par(mar=c(3,4,1,1))  # Adjust the margins of the drawing

chrom = "chr11"  #Chromosomes
chromstart = 1900000  #The starting position of the drawn chromosome
chromend = 2350000   #The end position of the drawn chromosome

# Drawing
plotBedgraph(Sushi_DNaseI.bedgraph,chrom,chromstart=chromstart,
chromend=chromend,colorbycol= SushiColors(5))  #Add bedgraph figure

labelgenome(chrom,chromstart=chromstart,chromend=chromend,n=4,
scale="Mb")  #Add axis position

mtext("Read Depth",side=2,line=1.75,cex=1,font=2)  #Add Y-axis annotation

axis(side=2,las=2,tcl=.2)  #Add Y axis

Use the zoomsregion function to zoom in on the specified area, where c(0, 0.580) of offsets, where 0 means that the distance between the left side branch and the left is 0, the right side branch is 0.580 from the right, and wideextend adjusts the left and right The proportional size of the side branch angle, extend=c(0.01,0.13), which means that the distance from the top to the graph is 0.01, and the distance from the beginning of the lower side branch is 0.13

zoomregion1 = c(1955000,1960000)
zoomregion2 = c(2279000,2284000)
zoomsregion(zoomregion1,extend=c(0.01,0.13),wideextend=0.05,
offsets=c(0,0.580))
zoomsregion(zoomregion2,extend=c(0.01,0.13),wideextend=0.05,
offsets=c(0.580,0))

Then use plotBedgraph to draw the picture, zoombox will add a border to the subsequent picture

plotBedgraph(Sushi_DNaseI.bedgraph,chrom,chromstart=zoomregion1[1],
chromend=zoomregion1[2],colorbycol= SushiColors(5))
labelgenome(chrom,chromstart=zoomregion1[1],chromend=zoomregion1[2],
n=4,scale="Kb",edgeblankfraction=0.2,cex.axis=.75)
zoombox()  # Add border
mtext("Read Depth",side=2,line=1.75,cex=1,font=2)
axis(side=2,las=2,tcl=.2)

plotBedgraph(Sushi_DNaseI.bedgraph,chrom,chromstart=zoomregion2[1],
chromend=zoomregion2[2],colorbycol= SushiColors(5))
labelgenome(chrom,chromstart=zoomregion2[1],chromend=zoomregion2[2],
n=4,scale="Kb",edgeblankfraction=0.2,cex.axis=.75)
zoombox() # Add border
mtext("Read Depth",side=2,line=1.75,cex=1,font=2)
axis(side=2,las=2,tcl=.2)

Reference

https://www.bioconductor.org/packages/release/bioc/vignettes/Sushi/inst/doc/Sushi.pdf

Leave a Reply

Your email address will not be published. Required fields are marked *

Close Bitnami banner
Bitnami