An application of GGplot Eitan Halper-Stromberg
Getting Started R CMD build targetSeqView.zip R CMD INSTALL targetSeqView_1.0.tar.gz Open the vignette Look at/do the examples Apply it to your own data if applicable Repurpose the code if you like
Input files Txt file with regions to inspect SampleDescChr1Start1End1LeftSideSegDupChr2Start2End2RightSideSeqDupValidationStatusSample LCL TRUE FALSEPCR Validated1320KB0001MultAlnForVignette.bam LCL TRUE TRUEPCR Validated1320KB0001MultAlnForVignette.bam Bam File
Example 1: failed path <- system.file("extdata", package="targetSeqView”) filename=file.path(path,"twoSVJunctionsFailed.txt”) retfail=ViewAndScore(filename=filename,bamFilePath=path,esti mateIndelRate=FALSE,estimateMmRate=FALSE,getReadLength =FALSE,build="hg19",verbose=TRUE)
View it! p1=formatPlot(retfail[[1]][[1]][[1]][[2]],title='Alignment supporting a structural variant') p2=formatPlot(retfail[[1]][[1]][[2]][[2]],title='supporting no SV') p3=formatPlot(retfail[[1]][[1]][[3]][[2]],title='supporting no SV') grid.newpage() pushViewport(viewport(layout = grid.layout(3, 1))) print(p1,vp = viewport(layout.pos.row = 1, layout.pos.col=1)) print(p2,vp = viewport(layout.pos.row = 2, layout.pos.col=1)) print(p3,vp = viewport(layout.pos.row = 3, layout.pos.col=1)) Event 1: Event 2: p1=formatPlot(retfail[[1]][[2]][[1]][[2]],title='Alignment supporting a structural variant') p2=formatPlot(retfail[[1]][[2]][[2]][[2]],title='supporting no SV') p3=formatPlot(retfail[[1]][[2]][[3]][[2]],title='supporting no SV') grid.newpage() pushViewport(viewport(layout = grid.layout(3, 1))) print(p1,vp = viewport(layout.pos.row = 1, layout.pos.col=1)) print(p2,vp = viewport(layout.pos.row = 2, layout.pos.col=1)) print(p3,vp = viewport(layout.pos.row = 3, layout.pos.col=1))
Example 2: Passed filename=file.path(path,"twoSVJunctionsPassed.txt") retpass=ViewAndScore(filename=filename,bamFilePath=path,estimateIndelRat e=FALSE, estimateMmRate=FALSE,getReadLength=FALSE,build="hg19",refexpansion=c(0,0),verbose=TRUE)
p1=formatPlot(retpass[[1]][[1]][[1]][[2]],title='Alignment supporting a structural variant', mismatchcolor='red') p2=formatPlot(retpass[[1]][[1]][[2]][[2]],title='supporting no SV', mismatchcolor='red') p3=formatPlot(retpass[[1]][[1]][[3]][[2]],title='supporting no SV', mismatchcolor='red') grid.newpage() pushViewport(viewport(layout = grid.layout(3, 1))) print(p1,vp = viewport(layout.pos.row = 1, layout.pos.col=1)) print(p2,vp = viewport(layout.pos.row = 2, layout.pos.col=1)) print(p3,vp = viewport(layout.pos.row = 3, layout.pos.col=1)) p1=formatPlot(retpass[[1]][[2]][[1]][[2]],title='Alignment supporting a structural variant', mismatchcolor='red') p2=formatPlot(retpass[[1]][[2]][[2]][[2]],title='supporting no SV', mismatchcolor='red') p3=formatPlot(retpass[[1]][[2]][[3]][[2]],title='supporting no SV', mismatchcolor='red') grid.newpage() pushViewport(viewport(layout = grid.layout(3, 1))) print(p1,vp = viewport(layout.pos.row = 1, layout.pos.col=1)) print(p2,vp = viewport(layout.pos.row = 2, layout.pos.col=1)) print(p3,vp = viewport(layout.pos.row = 3, layout.pos.col=1)) View it!
The data frame head(retpass[[1]][[1]][[2]][[2]]) afvec2 posvec2 ref ypostail refname 1 M HWI-ST619_61:3:2108:13668:175483:ATCACG 2 M HWI-ST619_61:3:2108:13668:175483:ATCACG 3 A HWI-ST619_61:3:2108:13668:175483:ATCACG 4 M HWI-ST619_61:3:2108:13668:175483:ATCACG 5 C HWI-ST619_61:3:2108:13668:175483:ATCACG 6 M HWI-ST619_61:3:2108:13668:175483:ATCACG dtailA <- ggplot(dftailA, aes(x = posvec2, y = ypostail, fill = factor(afvec2, levels = get("l")), height = 0.85)) + geom_tile() + facet_grid(. ~ ref, scales = "free") The call to ggplot
More data gureReproduction