Knowledge base

Sushi package to draw a bedgraph format diagram

Introduction

The display of bedgraph can use the plotBedgraph function of Sushi package

Code explanation

Input

bedGraph formatdata 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')  # Load Sushi package

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

chrom  = "chr11" # Chromosomes to be mapped
chromstart = 1650000  # Start drawing position on coloring problem
chromend  = 2350000  # End drawing position on chromosome

# Plot
plotBedgraph(Sushi_DNaseI.bedgraph,chrom,chromstart,chromend,colorbycol= SushiColors(5)) 
# The colorbycol here is the color palette used for signal coloring, the effect is shown in the figure

# Add gene annotation, n = 4 means adding 4 scales to the number, scale = "Mb" means using Mb as the unit
labelgenome(chrom,chromstart,chromend,n=4,scale="Mb")  

mtext("Read Depth",side=2,line=1.75,cex=1,font=2)  # Add note, side=2 means left

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

To display multiple bedgraphs together, you need to set the overlay parameter of the latter to TRUE

library('Sushi')  # Load Sushi package

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

chrom = "chr11"
chromstart = 1955000
chromend = 1960000

# Plot first figure
plotBedgraph(Sushi_ChIPSeq_CTCF.bedgraph,chrom,chromstart,chromend,
transparency=.50,color=SushiColors(2)(2)[1])
# plot second figure, overlay = TRUE
plotBedgraph(Sushi_DNaseI.bedgraph,chrom,chromstart,chromend,
transparency=.50,color=SushiColors(2)(2)[2],overlay=TRUE,
rescaleoverlay=TRUE)

Add location notes
labelgenome(chrom,chromstart,chromend,n=3,scale="Kb")

# Add egend
legend("topright",inset=0.025,legend=c("DNaseI","ChIP-seq (CTCF)"),
fill=opaque(SushiColors(2)(2)),border=SushiColors(2)(2),text.font=2,
cex=1.0)


In addition, the flip=TRUE parameter allows the graph to be flipped down and placed.

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