90 likes | 164 Views
An application of GGplot. Eitan Halper-Stromberg. Getting Started. https://github.com/Eitan177/targetSeqView 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
E N D
An application of GGplot Eitan Halper-Stromberg
Getting Started • https://github.com/Eitan177/targetSeqView • 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 • SampleDesc Chr1 Start1 End1 LeftSideSegDup Chr2 Start2 End2 RightSideSeqDupValidationStatus Sample • LCL 14 107083256 107083431 TRUE 14 107078225 107078400 FALSE PCR Validated 1320KB0001MultAlnForVignette.bam • LCL 2 89544257 89544432 TRUE 2 89533400 89533644 TRUE PCR Validated 1320KB0001MultAlnForVignette.bam • Bam File
Example 1: failed path <- system.file("extdata", package="targetSeqView”) filename=file.path(path,"twoSVJunctionsFailed.txt”) retfail=ViewAndScore(filename=filename,bamFilePath=path,estimateIndelRate=FALSE,estimateMmRate=FALSE,getReadLength=FALSE,build="hg19",verbose=TRUE)
View it! Event 1: 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 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,estimateIndelRate=FALSE, estimateMmRate=FALSE,getReadLength=FALSE,build="hg19",refexpansion=c(0,0),verbose=TRUE)
View it! 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))
The data frame head(retpass[[1]][[1]][[2]][[2]]) afvec2 posvec2 ref ypostailrefname 1 M 107082761 107082756 1 HWI-ST619_61:3:2108:13668:175483:ATCACG 2 M 107082762 107082756 1 HWI-ST619_61:3:2108:13668:175483:ATCACG 3 A 107082763 107082756 1 HWI-ST619_61:3:2108:13668:175483:ATCACG 4 M 107082764 107082756 1 HWI-ST619_61:3:2108:13668:175483:ATCACG 5 C 107082765 107082756 1 HWI-ST619_61:3:2108:13668:175483:ATCACG 6 M 107082766 107082756 1 HWI-ST619_61:3:2108:13668:175483:ATCACG The call to ggplot dtailA <- ggplot(dftailA, aes(x = posvec2, y = ypostail, fill = factor(afvec2, levels = get("l")), height = 0.85)) + geom_tile() + facet_grid(. ~ ref, scales = "free")
More data • https://github.com/Eitan177/targetSeqViewFigureReproduction