trackViewer bigWig smoothing
1
0
Entering edit mode
@liruiradiant-8906
Last seen 2.2 years ago
United States

Hello Jianhong,

I wonder if trackViewer can smooth bigWig tracks if the bin-size to generate them is only, say, 20bp? Attached are screenshots of the same bigwig files visualized with trackviewer and IGV. IGV seem to produce smoother track visualization?

Thanks!

enter image description here enter image description here


HA1 <- importScore(file = file.path(bwdir, 'x.bw'),
                   ranges = gr,
                    format="BigWig")
HA2 <- importScore(file = file.path(bwdir, 'y.bw'),
                   ranges = gr,
                    format="BigWig")
gr <- parse2GRanges("chr9:xx-xx:+")

library(TxDb.Hsapiens.UCSC.hg38.knownGene)
library(org.Hs.eg.db)
trs <- geneModelFromTxdb(TxDb.Hsapiens.UCSC.hg38.knownGene,
                         org.Hs.eg.db,
                         gr=gr)

ids <- getGeneIDsFromTxDb(gr, TxDb.Hsapiens.UCSC.hg38.knownGene)
ids <- "2395" # FXN
symbols <- mget(ids, org.Hs.egSYMBOL)
genes <- geneTrack(ids, TxDb.Hsapiens.UCSC.hg38.knownGene, 
                   symbols, asList=FALSE)

optSty <- optimizeStyle(trackList(HA1, HA2, genes), theme="safe")
trackList <- optSty$tracks
viewerStyle <- optSty$style

setTrackViewerStyleParam(viewerStyle, "margin", c(.05, .2, .05, .05)) #bottom, left, top and right margin.
setTrackXscaleParam(trackList[[2]], "draw", TRUE)
setTrackXscaleParam(trackList[[2]], "gp", list(cex=0.8))
# setTrackXscaleParam(trackList[[2]], attr="position", 
#                     value=list(x=xxx, y=2, label=1000))
setTrackViewerStyleParam(viewerStyle, "xaxis", FALSE) # disable x ticks
setTrackStyleParam(trackList[[1]], "ylim", c(0, 0.5))
setTrackStyleParam(trackList[[2]], "ylim", c(0, 0.5))



vp <- viewTracks(trackList, 
                 gr=gr, viewerStyle=viewerStyle, 
                 autoOptimizeStyle=TRUE)

addGuideLine(c(xxxx, xxxx), vp=vp) #peak1
addArrowMark(list(x=(xxxx + xxxx![enter image description here][1])/2,
                  y=2), # 2 means track 2 from the bottom.
             label="peak",
             col="darkgreen",
             vp=vp)
trackViewer • 1.7k views
ADD COMMENT
0
Entering edit mode
Ou, Jianhong ★ 1.3k
@ou-jianhong-4539
Last seen 7 days ago
United States

Hi,

trackViewer will not recalculate the signals by bins. You may want to try preprocess the signals by other packages such as GenomicRanges::binnedAverage to re-sample your signals and then plot the tracks. Or use deepTools to create a new bigwig file.

ADD COMMENT
0
Entering edit mode

Thanks! Using deepTools with a different binSize solved the issue. Also, it seems only an issue I need to address when I'm plotting larger genome regions, e.g. the whole gene including introns. When I'm plotting the promotor region only, the default setting in deeptools (bin = 50 ) works pretty well.

ADD REPLY

Login before adding your answer.

Traffic: 743 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6