Title: | BubbleTree: an intuitive visualization to elucidate tumoral aneuploidy and clonality in somatic mosaicism using next generation sequencing data |
---|---|
Description: | CNV analysis in groups of tumor samples. |
Authors: | Wei Zhu <[email protected]>, Michael Kuziora <[email protected]>, Todd Creasy <[email protected]>, Brandon Higgs <[email protected]> |
Maintainer: | Todd Creasy <[email protected]>, Wei Zhu <[email protected]> |
License: | LGPL (>= 3) |
Version: | 2.37.0 |
Built: | 2024-10-30 04:28:47 UTC |
Source: | https://github.com/bioc/BubbleTree |
A dataset containing pre-calculated BAF scores for annotated SNVs.
S4 object with seqnames, genomic ranges, strand, BAF score
internal
A dataset containing precalculated data from CNV segment analysis.
S4 object with rbd, rbd.adj, results
internal
A dataset containing pre-calculated segment calls.
S4 object with seqnames, genomic ranges, num.mark, score
internal
S4 GRanges dataset containing pre-calculated heterozygosity data.
S4
internal
A dataset containing precalculated data from CNV segment analysis.
S4 object with rbd, rbd.adj
internal
get annotation for genes and cytobands
annoByGenesAndCyto(.Object, chr, beg, end, critical.genes, gene.uni.clean.gr, cyto.gr) ## S4 method for signature 'Annotate' annoByGenesAndCyto(.Object, chr, beg, end, critical.genes, gene.uni.clean.gr, cyto.gr)
annoByGenesAndCyto(.Object, chr, beg, end, critical.genes, gene.uni.clean.gr, cyto.gr) ## S4 method for signature 'Annotate' annoByGenesAndCyto(.Object, chr, beg, end, critical.genes, gene.uni.clean.gr, cyto.gr)
.Object |
the objet |
chr |
the chromosome |
beg |
genomic start coord |
end |
genomic end coord |
critical.genes |
set of critical genes |
gene.uni.clean.gr |
gr object of genes |
cyto.gr |
gr object of cyto positions |
list of annotation for genes and cytobands
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) comm <- btcompare(vol.genes, cancer.genes.minus2) btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <-new("Annotate") nn <- "sam2" cc <- allCall.lst[[nn]] z <- drawBTree(btreeplotter, [email protected]) + ggplot2::labs(title=sprintf("%s (%s)", nn, info(cc))) out <- cc@result$dist %>% filter(seg.size >= 0.1 ) %>% arrange(gtools::mixedorder(as.character(seqnames)), start) ann <- annoByGenesAndCyto(annotator, as.character(out$seqnames), as.numeric(out$start), as.numeric(out$end), comm$comm, gene.uni.clean.gr=gene.uni.clean.gr, cyto.gr=cyto.gr)
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) comm <- btcompare(vol.genes, cancer.genes.minus2) btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <-new("Annotate") nn <- "sam2" cc <- allCall.lst[[nn]] z <- drawBTree(btreeplotter, cc@rbd.adj) + ggplot2::labs(title=sprintf("%s (%s)", nn, info(cc))) out <- cc@result$dist %>% filter(seg.size >= 0.1 ) %>% arrange(gtools::mixedorder(as.character(seqnames)), start) ann <- annoByGenesAndCyto(annotator, as.character(out$seqnames), as.numeric(out$start), as.numeric(out$end), comm$comm, gene.uni.clean.gr=gene.uni.clean.gr, cyto.gr=cyto.gr)
get the BAF track
bafTrack(.Object, result.dat, gr2, somatic.gr = NULL, min.prev = 0.15, cex = 1.2) ## S4 method for signature 'TrackPlotter' bafTrack(.Object, result.dat, gr2, somatic.gr = NULL, min.prev = 0.15, cex = 1.2)
bafTrack(.Object, result.dat, gr2, somatic.gr = NULL, min.prev = 0.15, cex = 1.2) ## S4 method for signature 'TrackPlotter' bafTrack(.Object, result.dat, gr2, somatic.gr = NULL, min.prev = 0.15, cex = 1.2)
.Object |
the object |
result.dat |
the result dataframe |
gr2 |
the gr2 object |
somatic.gr |
somatic gr object annotation |
min.prev |
previous min |
cex |
the cex |
the highlighted BAF track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "all.somatic.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" p2 <- bafTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, somatic.gr=all.somatic.lst[[nn]])
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "all.somatic.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" p2 <- bafTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, somatic.gr=all.somatic.lst[[nn]])
btcompare
btcompare(set1, set2)
btcompare(set1, set2)
set1 |
first set |
set2 |
second set to compare |
combined, unique list of genes
load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) # 77 common cancer genes comm <- btcompare(vol.genes, cancer.genes.minus2)
load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) # 77 common cancer genes comm <- btcompare(vol.genes, cancer.genes.minus2)
btpredict
btpredict(.Object) ## S4 method for signature 'BTreePredictor' btpredict(.Object)
btpredict(.Object) ## S4 method for signature 'BTreePredictor' btpredict(.Object)
.Object |
the object |
.Object populated with the predictions
load(system.file("data", "allRBD.lst.RData", package="BubbleTree")) btreepredictor <- new("BTreePredictor") btreepredictor@config$cutree.h <- 0.15 high.ploidy <- rep(TRUE, length(allRBD.lst)) high.purity <- rep(TRUE, length(allRBD.lst)) high.ploidy[c("sam6", "ovary.wgs", "ovary.wes", "TCGA-06-0145-01A-01W-0224-08", "TCGA-13-1500-01A-01D-0472-01", "TCGA-AO-A0JJ-01A-11W-A071-09")] <- FALSE high.purity[c("sam6", "ovary.wgs", "ovary.wes")] <- FALSE rbd <- allRBD.lst[["sam6"]] btreepredictor@config$high.ploidy <- high.ploidy["sam6"] btreepredictor@config$high.purity <- high.purity["sam6"] btreepredictor <- loadRBD(btreepredictor, rbd) btreepredictor@config$min.segSize <- ifelse(max(btreepredictor@rbd$seg.size, na.rm=TRUE) < 0.4, 0.1, 0.4) btreepredictor <- btpredict(btreepredictor) cat(info(btreepredictor), "\n")
load(system.file("data", "allRBD.lst.RData", package="BubbleTree")) btreepredictor <- new("BTreePredictor") btreepredictor@config$cutree.h <- 0.15 high.ploidy <- rep(TRUE, length(allRBD.lst)) high.purity <- rep(TRUE, length(allRBD.lst)) high.ploidy[c("sam6", "ovary.wgs", "ovary.wes", "TCGA-06-0145-01A-01W-0224-08", "TCGA-13-1500-01A-01D-0472-01", "TCGA-AO-A0JJ-01A-11W-A071-09")] <- FALSE high.purity[c("sam6", "ovary.wgs", "ovary.wes")] <- FALSE rbd <- allRBD.lst[["sam6"]] btreepredictor@config$high.ploidy <- high.ploidy["sam6"] btreepredictor@config$high.purity <- high.purity["sam6"] btreepredictor <- loadRBD(btreepredictor, rbd) btreepredictor@config$min.segSize <- ifelse(max(btreepredictor@rbd$seg.size, na.rm=TRUE) < 0.4, 0.1, 0.4) btreepredictor <- btpredict(btreepredictor) cat(info(btreepredictor), "\n")
BTreePlotter
btreeplotter <- new("BTreePlotter")
btreeplotter <- new("BTreePlotter")
BTreePredictor
btreepredictor <- new("BTreePredictor")
btreepredictor <- new("BTreePredictor")
A dataset containing a list of known cancer genes.
list
internal
A dataset containing an annotated list of centromere locations.
list
internal
S4 GRanges object containing data on chromosomal locations with seqnames, genomic range, strand, name
S4
internal
S4 GRanges object containing data on chromosomal locations with seqnames, genomic range, strand, name, gieStain.
S4
internal
draw the BTree track
drawBTree(.Object, rbd, size = 1) ## S4 method for signature 'BTreePlotter' drawBTree(.Object, rbd, size = 1)
drawBTree(.Object, rbd, size = 1) ## S4 method for signature 'BTreePlotter' drawBTree(.Object, rbd, size = 1)
.Object |
the object |
rbd |
the rbd object |
size |
the size |
draw the BTree track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) # 77 common cancer genes comm <- btcompare(vol.genes, cancer.genes.minus2) btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <-new("Annotate") cc <- allCall.lst[["sam2"]] z <- drawBTree(btreeplotter, [email protected]) + ggplot2::labs(title=sprintf("%s (%s)", "sam2", info(cc)))
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) # 77 common cancer genes comm <- btcompare(vol.genes, cancer.genes.minus2) btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <-new("Annotate") cc <- allCall.lst[["sam2"]] z <- drawBTree(btreeplotter, cc@rbd.adj) + ggplot2::labs(title=sprintf("%s (%s)", "sam2", info(cc)))
draw the Bubbles
drawBubbles(.Object, rbd, col = NULL) ## S4 method for signature 'BTreePlotter' drawBubbles(.Object, rbd, col = "gray80")
drawBubbles(.Object, rbd, col = NULL) ## S4 method for signature 'BTreePlotter' drawBubbles(.Object, rbd, col = "gray80")
.Object |
the object |
rbd |
the rbd object |
col |
the col value |
draw the bubbles on the track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) nn <- "sam2" rbd1 <- allCall.lst[[nn]]@rbd rbd2 <- allCall.lst[[nn]]@rbd.adj arrows <- trackBTree(btreeplotter, rbd1, rbd2, min.srcSize=0.01, min.trtSize=0.01) btree <- drawBTree(btreeplotter, rbd1) + drawBubbles(btreeplotter, rbd2, "gray80") + arrows
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) nn <- "sam2" rbd1 <- allCall.lst[[nn]]@rbd rbd2 <- allCall.lst[[nn]]@rbd.adj arrows <- trackBTree(btreeplotter, rbd1, rbd2, min.srcSize=0.01, min.trtSize=0.01) btree <- drawBTree(btreeplotter, rbd1) + drawBubbles(btreeplotter, rbd2, "gray80") + arrows
draw the features
drawFeatures(.Object, rbd, col = NULL) ## S4 method for signature 'BTreePlotter' drawFeatures(.Object, rbd, col = "black")
drawFeatures(.Object, rbd, col = NULL) ## S4 method for signature 'BTreePlotter' drawFeatures(.Object, rbd, col = "black")
.Object |
the object |
rbd |
the rbd object |
col |
the col value |
draw the annotation on the track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) # 77 common cancer genes merged from 2 sets comm <- btcompare(vol.genes, cancer.genes.minus2) btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <- new("Annotate") nn <- "sam12" cc <- allCall.lst[[nn]] z <- drawBTree(btreeplotter, [email protected]) + ggplot2::labs(title=sprintf("%s (%s)", nn, info(cc))) out <- cc@result$dist %>% filter(seg.size >= 0.1 ) %>% arrange(gtools::mixedorder(as.character(seqnames)), start) ann <- with(out, { annoByGenesAndCyto(annotator, as.character(out$seqnames), as.numeric(out$start), as.numeric(out$end), comm$comm, gene.uni.clean.gr=gene.uni.clean.gr, cyto.gr=cyto.gr) }) out$cyto <- ann$cyto out$genes <- ann$ann v <- z + drawFeatures(btreeplotter, out) print(v)
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) # 77 common cancer genes merged from 2 sets comm <- btcompare(vol.genes, cancer.genes.minus2) btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <- new("Annotate") nn <- "sam12" cc <- allCall.lst[[nn]] z <- drawBTree(btreeplotter, cc@rbd.adj) + ggplot2::labs(title=sprintf("%s (%s)", nn, info(cc))) out <- cc@result$dist %>% filter(seg.size >= 0.1 ) %>% arrange(gtools::mixedorder(as.character(seqnames)), start) ann <- with(out, { annoByGenesAndCyto(annotator, as.character(out$seqnames), as.numeric(out$start), as.numeric(out$end), comm$comm, gene.uni.clean.gr=gene.uni.clean.gr, cyto.gr=cyto.gr) }) out$cyto <- ann$cyto out$genes <- ann$ann v <- z + drawFeatures(btreeplotter, out) print(v)
S4 GRanges object containing human gene annotation with seqnames, genomic coordinates, stand, gene.sybmol.
S4
internal
get all tracks
getTracks(p1, p2, title = "")
getTracks(p1, p2, title = "")
p1 |
set 1 |
p2 |
set 2 |
title |
the title |
all of the requested tracks
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "all.somatic.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" ymax <- ifelse(nn %in% c("lung.wgs", "lung.wes"), 9, 4.3) p1 <- xyTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, ymax=ymax) + ggplot2::labs(title=nn) p2 <- bafTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, somatic.gr=all.somatic.lst[[nn]]) t1 <- getTracks(p1, p2)
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "all.somatic.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" ymax <- ifelse(nn %in% c("lung.wgs", "lung.wes"), 9, 4.3) p1 <- xyTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, ymax=ymax) + ggplot2::labs(title=nn) p2 <- bafTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, somatic.gr=all.somatic.lst[[nn]]) t1 <- getTracks(p1, p2)
get the heteroLoci track
heteroLociTrack(.Object, result.dat, gr2, hetero.gr = NULL, min.prev = 0.15, ymax = 4.3, cex = 0.5) ## S4 method for signature 'TrackPlotter' heteroLociTrack(.Object, result.dat, gr2, hetero.gr = NULL, min.prev = 0.15, ymax = 4.3, cex = 0.5)
heteroLociTrack(.Object, result.dat, gr2, hetero.gr = NULL, min.prev = 0.15, ymax = 4.3, cex = 0.5) ## S4 method for signature 'TrackPlotter' heteroLociTrack(.Object, result.dat, gr2, hetero.gr = NULL, min.prev = 0.15, ymax = 4.3, cex = 0.5)
.Object |
the object |
result.dat |
the results |
gr2 |
the gr2 object |
hetero.gr |
hetero annotation |
min.prev |
previous min |
ymax |
max y |
cex |
the cex |
the highlightted heterozygosity track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "allHetero.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" z1 <- heteroLociTrack(trackplotter, allCall.lst[[nn]]@result, gr2, allHetero.lst[[nn]])
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "allHetero.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" z1 <- heteroLociTrack(trackplotter, allCall.lst[[nn]]@result, gr2, allHetero.lst[[nn]])
Seqinfo object containing names and lengths of each chromosome of the human genome.
Seqinfo
internal
info
info(.Object) ## S4 method for signature 'BTreePredictor' info(.Object)
info(.Object) ## S4 method for signature 'BTreePredictor' info(.Object)
.Object |
the object |
print out info of prediction data
load(system.file("data", "allRBD.lst.RData", package="BubbleTree")) btreepredictor <- new("BTreePredictor") btreepredictor@config$cutree.h <- 0.15 high.ploidy <- rep(TRUE, length(allRBD.lst)) high.purity <- rep(TRUE, length(allRBD.lst)) high.ploidy[c("sam6", "ovary.wgs", "ovary.wes", "TCGA-06-0145-01A-01W-0224-08", "TCGA-13-1500-01A-01D-0472-01", "TCGA-AO-A0JJ-01A-11W-A071-09")] <- FALSE high.purity[c("sam6", "ovary.wgs", "ovary.wes")] <- FALSE nn <- "sam6" rbd <- allRBD.lst[[nn]] btreepredictor@config$high.ploidy <- high.ploidy[nn] btreepredictor@config$high.purity <- high.purity[nn] btreepredictor <- loadRBD(btreepredictor, rbd) btreepredictor@config$min.segSize <- ifelse(max(btreepredictor@rbd$seg.size, na.rm=TRUE) < 0.4, 0.1, 0.4) btreepredictor <- btpredict(btreepredictor) cat(info(btreepredictor), "\n")
load(system.file("data", "allRBD.lst.RData", package="BubbleTree")) btreepredictor <- new("BTreePredictor") btreepredictor@config$cutree.h <- 0.15 high.ploidy <- rep(TRUE, length(allRBD.lst)) high.purity <- rep(TRUE, length(allRBD.lst)) high.ploidy[c("sam6", "ovary.wgs", "ovary.wes", "TCGA-06-0145-01A-01W-0224-08", "TCGA-13-1500-01A-01D-0472-01", "TCGA-AO-A0JJ-01A-11W-A071-09")] <- FALSE high.purity[c("sam6", "ovary.wgs", "ovary.wes")] <- FALSE nn <- "sam6" rbd <- allRBD.lst[[nn]] btreepredictor@config$high.ploidy <- high.ploidy[nn] btreepredictor@config$high.purity <- high.purity[nn] btreepredictor <- loadRBD(btreepredictor, rbd) btreepredictor@config$min.segSize <- ifelse(max(btreepredictor@rbd$seg.size, na.rm=TRUE) < 0.4, 0.1, 0.4) btreepredictor <- btpredict(btreepredictor) cat(info(btreepredictor), "\n")
load the RBD data
loadRBD(.Object, rbd, total.mark = NA) ## S4 method for signature 'BTreePredictor' loadRBD(.Object, rbd, total.mark = NA)
loadRBD(.Object, rbd, total.mark = NA) ## S4 method for signature 'BTreePredictor' loadRBD(.Object, rbd, total.mark = NA)
.Object |
the object |
rbd |
rbd object |
total.mark |
total mark |
.Object populated with the RBD list with updated segment size
load(system.file("data", "allRBD.lst.RData", package="BubbleTree")) btreepredictor <- new("BTreePredictor") btreepredictor@config$cutree.h <- 0.15 high.ploidy <- rep(TRUE, length(allRBD.lst)) high.purity <- rep(TRUE, length(allRBD.lst)) high.ploidy[c("sam6", "ovary.wgs", "ovary.wes", "TCGA-06-0145-01A-01W-0224-08", "TCGA-13-1500-01A-01D-0472-01", "TCGA-AO-A0JJ-01A-11W-A071-09")] <- FALSE high.purity[c("sam6", "ovary.wgs", "ovary.wes")] <- FALSE nn <- "sam6" rbd <- allRBD.lst[[nn]] btreepredictor@config$high.ploidy <- high.ploidy[nn] btreepredictor@config$high.purity <- high.purity[nn] btreepredictor <- loadRBD(btreepredictor, rbd)
load(system.file("data", "allRBD.lst.RData", package="BubbleTree")) btreepredictor <- new("BTreePredictor") btreepredictor@config$cutree.h <- 0.15 high.ploidy <- rep(TRUE, length(allRBD.lst)) high.purity <- rep(TRUE, length(allRBD.lst)) high.ploidy[c("sam6", "ovary.wgs", "ovary.wes", "TCGA-06-0145-01A-01W-0224-08", "TCGA-13-1500-01A-01D-0472-01", "TCGA-AO-A0JJ-01A-11W-A071-09")] <- FALSE high.purity[c("sam6", "ovary.wgs", "ovary.wes")] <- FALSE nn <- "sam6" rbd <- allRBD.lst[[nn]] btreepredictor@config$high.ploidy <- high.ploidy[nn] btreepredictor@config$high.purity <- high.purity[nn] btreepredictor <- loadRBD(btreepredictor, rbd)
make the RBD object
makeRBD(.Object, ...) ## S4 method for signature 'RBD' makeRBD(.Object, snp.gr, cnv.gr, unimodal.kurtosis = -0.1)
makeRBD(.Object, ...) ## S4 method for signature 'RBD' makeRBD(.Object, snp.gr, cnv.gr, unimodal.kurtosis = -0.1)
.Object |
the object |
... |
other input (not needed) |
snp.gr |
SNP GenomicRanges object |
cnv.gr |
CNV GenomicRanges object |
unimodal.kurtosis |
kurtosis |
RBD object
# load sample files load(system.file("data", "cnv.gr.rda", package="BubbleTree")) load(system.file("data", "snp.gr.rda", package="BubbleTree")) # load annotations load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) # initialize RBD object r <- new("RBD", unimodal.kurtosis=-0.1) # create new RBD object with GenomicRanges objects for SNPs and CNVs rbd <- makeRBD(r, snp.gr, cnv.gr) head(rbd) # create a new prediction btreepredictor <- new("BTreePredictor", rbd=rbd, max.ploidy=6, prev.grid=seq(0.2,1, by=0.01)) pred <- btpredict(btreepredictor) # create rbd plot btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) btree <- drawBTree(btreeplotter, pred@rbd) print(btree) # create rbd.adj plot btreeplotter <- new("BTreePlotter", branch.col="gray50") btree <- drawBTree(btreeplotter, [email protected]) print(btree) # create a combined plot with rbd and rbd.adj that shows the arrows indicating change # THIS IS VERY MESSY WITH CURRENT DATA from Dong btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) arrows <- trackBTree(btreeplotter, pred@rbd, [email protected], min.srcSize=0.01, min.trtSize=0.01) btree <- drawBTree(btreeplotter, pred@rbd) + arrows print(btree) # create a plot with overlays of significant genes btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <- new("Annotate") comm <- btcompare(vol.genes, cancer.genes.minus2) sample.name <- "22_cnv_snv" btree <- drawBTree(btreeplotter, [email protected]) + ggplot2::labs(title=sprintf("%s (%s)", sample.name, info(pred))) out <- pred@result$dist %>% filter(seg.size >= 0.1 ) %>% arrange(gtools::mixedorder(as.character(seqnames)), start) ann <- with(out, { annoByGenesAndCyto(annotator, as.character(out$seqnames), as.numeric(out$start), as.numeric(out$end), comm$comm, gene.uni.clean.gr=gene.uni.clean.gr, cyto.gr=cyto.gr) }) out$cyto <- ann$cyto out$genes <- ann$ann btree <- btree + drawFeatures(btreeplotter, out) print(btree) # print out purity and ploidy values info <- info(pred) cat("\nPurity/Ploidy: ", info, "\n")
# load sample files load(system.file("data", "cnv.gr.rda", package="BubbleTree")) load(system.file("data", "snp.gr.rda", package="BubbleTree")) # load annotations load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "cyto.gr.rda", package="BubbleTree")) load(system.file("data", "cancer.genes.minus2.rda", package="BubbleTree")) load(system.file("data", "vol.genes.rda", package="BubbleTree")) load(system.file("data", "gene.uni.clean.gr.rda", package="BubbleTree")) # initialize RBD object r <- new("RBD", unimodal.kurtosis=-0.1) # create new RBD object with GenomicRanges objects for SNPs and CNVs rbd <- makeRBD(r, snp.gr, cnv.gr) head(rbd) # create a new prediction btreepredictor <- new("BTreePredictor", rbd=rbd, max.ploidy=6, prev.grid=seq(0.2,1, by=0.01)) pred <- btpredict(btreepredictor) # create rbd plot btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) btree <- drawBTree(btreeplotter, pred@rbd) print(btree) # create rbd.adj plot btreeplotter <- new("BTreePlotter", branch.col="gray50") btree <- drawBTree(btreeplotter, pred@rbd.adj) print(btree) # create a combined plot with rbd and rbd.adj that shows the arrows indicating change # THIS IS VERY MESSY WITH CURRENT DATA from Dong btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) arrows <- trackBTree(btreeplotter, pred@rbd, pred@rbd.adj, min.srcSize=0.01, min.trtSize=0.01) btree <- drawBTree(btreeplotter, pred@rbd) + arrows print(btree) # create a plot with overlays of significant genes btreeplotter <- new("BTreePlotter", branch.col="gray50") annotator <- new("Annotate") comm <- btcompare(vol.genes, cancer.genes.minus2) sample.name <- "22_cnv_snv" btree <- drawBTree(btreeplotter, pred@rbd.adj) + ggplot2::labs(title=sprintf("%s (%s)", sample.name, info(pred))) out <- pred@result$dist %>% filter(seg.size >= 0.1 ) %>% arrange(gtools::mixedorder(as.character(seqnames)), start) ann <- with(out, { annoByGenesAndCyto(annotator, as.character(out$seqnames), as.numeric(out$start), as.numeric(out$end), comm$comm, gene.uni.clean.gr=gene.uni.clean.gr, cyto.gr=cyto.gr) }) out$cyto <- ann$cyto out$genes <- ann$ann btree <- btree + drawFeatures(btreeplotter, out) print(btree) # print out purity and ploidy values info <- info(pred) cat("\nPurity/Ploidy: ", info, "\n")
merge snp and cnv data
mergeSnpCnv(.Object, snp.gr, cnv.gr) ## S4 method for signature 'RBD' mergeSnpCnv(.Object, snp.gr, cnv.gr)
mergeSnpCnv(.Object, snp.gr, cnv.gr) ## S4 method for signature 'RBD' mergeSnpCnv(.Object, snp.gr, cnv.gr)
.Object |
the object |
snp.gr |
SNP GenomicRanges object |
cnv.gr |
CNV GenomicRanges object |
combined, unique list of genes
get the RScore track
RscoreTrack(.Object, result.dat, gr2, cnv.gr = NULL, min.prev = 0.15, ymax = 3, cex = 1.5) ## S4 method for signature 'TrackPlotter' RscoreTrack(.Object, result.dat, gr2, cnv.gr = NULL, min.prev = 0.15, ymax = 3, cex = 1.5)
RscoreTrack(.Object, result.dat, gr2, cnv.gr = NULL, min.prev = 0.15, ymax = 3, cex = 1.5) ## S4 method for signature 'TrackPlotter' RscoreTrack(.Object, result.dat, gr2, cnv.gr = NULL, min.prev = 0.15, ymax = 3, cex = 1.5)
.Object |
the object |
result.dat |
the results |
gr2 |
the gr2 object |
cnv.gr |
cnv annotation |
min.prev |
previous min |
ymax |
max y |
cex |
the cex |
the highlighted RScore track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "allCNV.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) gr2 = centromere.dat trackplotter <- new("TrackPlotter") nn <- "sam2" z <- RscoreTrack(trackplotter, allCall.lst[[nn]]@result, gr2, allCNV.lst[[nn]])
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "allCNV.lst.RData", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) gr2 = centromere.dat trackplotter <- new("TrackPlotter") nn <- "sam2" z <- RscoreTrack(trackplotter, allCall.lst[[nn]]@result, gr2, allCNV.lst[[nn]])
saveXLS
saveXLS(dat.lst, xls.fn, row.names = FALSE, ...)
saveXLS(dat.lst, xls.fn, row.names = FALSE, ...)
dat.lst |
dataframe |
xls.fn |
filename |
row.names |
row names |
... |
misc |
new Excel file
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) all.summary <- plyr::ldply(allCall.lst, function(.Object) { purity <- .Object@result$prev[1] adj <- .Object@result$ploidy.adj["adj"] # when purity is low the calculation result is not reliable ploidy <- (2*adj -2)/purity + 2 with(.Object@result, return(c(Purity=round(purity,3), Prevalences=paste(round(prev,3), collapse=", "), "Tumor ploidy"=round(ploidy,1)))) }) %>% plyr::rename(c(".id"="Sample")) xls.filename <- paste("all_summary", "xlsx", sep=".") saveXLS(list(Summary=all.summary), xls.filename)
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) all.summary <- plyr::ldply(allCall.lst, function(.Object) { purity <- .Object@result$prev[1] adj <- .Object@result$ploidy.adj["adj"] # when purity is low the calculation result is not reliable ploidy <- (2*adj -2)/purity + 2 with(.Object@result, return(c(Purity=round(purity,3), Prevalences=paste(round(prev,3), collapse=", "), "Tumor ploidy"=round(ploidy,1)))) }) %>% plyr::rename(c(".id"="Sample")) xls.filename <- paste("all_summary", "xlsx", sep=".") saveXLS(list(Summary=all.summary), xls.filename)
S4 GRanges object containing data on chromosomal locations with seqnames, genomic position, strand, name
S4
internal
get the geom_segment location of the BTree track
trackBTree(.Object, rbd1, rbd2, is.matched = FALSE, min.srcSize = 0.5, min.trtSize = 0.1, min.overlap = 1e+05) ## S4 method for signature 'BTreePlotter' trackBTree(.Object, rbd1, rbd2, is.matched = FALSE, min.srcSize = 0.5, min.trtSize = 0.1, min.overlap = 1e+05)
trackBTree(.Object, rbd1, rbd2, is.matched = FALSE, min.srcSize = 0.5, min.trtSize = 0.1, min.overlap = 1e+05) ## S4 method for signature 'BTreePlotter' trackBTree(.Object, rbd1, rbd2, is.matched = FALSE, min.srcSize = 0.5, min.trtSize = 0.1, min.overlap = 1e+05)
.Object |
the object |
rbd1 |
rbd one |
rbd2 |
rbd two |
is.matched |
is it matched |
min.srcSize |
min src size |
min.trtSize |
min trt size |
min.overlap |
min overlap |
geom_segment location of BTree track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) nn <- "sam2" rbd1 <- allCall.lst[[nn]]@rbd rbd2 <- allCall.lst[[nn]]@rbd.adj arrows <- trackBTree(btreeplotter, rbd1, rbd2, min.srcSize=0.01, min.trtSize=0.01) btree <- drawBTree(btreeplotter, rbd1) + drawBubbles(btreeplotter, rbd2, "gray80") + arrows
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) btreeplotter <- new("BTreePlotter", max.ploidy=5, max.size=10) nn <- "sam2" rbd1 <- allCall.lst[[nn]]@rbd rbd2 <- allCall.lst[[nn]]@rbd.adj arrows <- trackBTree(btreeplotter, rbd1, rbd2, min.srcSize=0.01, min.trtSize=0.01) btree <- drawBTree(btreeplotter, rbd1) + drawBubbles(btreeplotter, rbd2, "gray80") + arrows
TrackPlotter
trackplotter <- new("TrackPlotter")
trackplotter <- new("TrackPlotter")
A dataset containing a list of known cancer genes.
list
internal
get the xy track
xyTrack(.Object, result.dat, gr2, min.prev = 0.15, ymax = 4.3) ## S4 method for signature 'TrackPlotter' xyTrack(.Object, result.dat, gr2, min.prev = 0.15, ymax = 4.3)
xyTrack(.Object, result.dat, gr2, min.prev = 0.15, ymax = 4.3) ## S4 method for signature 'TrackPlotter' xyTrack(.Object, result.dat, gr2, min.prev = 0.15, ymax = 4.3)
.Object |
the object |
result.dat |
result dataframe |
gr2 |
gr2 object |
min.prev |
previous min |
ymax |
the max y |
the highlighted xy track
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" ymax <- ifelse(nn %in% c("lung.wgs", "lung.wes"), 9, 4.3) p1 <- xyTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, ymax=ymax) + ggplot2::labs(title=nn)
load(system.file("data", "allCall.lst.RData", package="BubbleTree")) load(system.file("data", "centromere.dat.rda", package="BubbleTree")) load(system.file("data", "hg19.seqinfo.rda", package="BubbleTree")) trackplotter <- new("TrackPlotter") gr2 = centromere.dat nn <- "sam2" ymax <- ifelse(nn %in% c("lung.wgs", "lung.wes"), 9, 4.3) p1 <- xyTrack(trackplotter, result.dat=allCall.lst[[nn]]@result, gr2=gr2, ymax=ymax) + ggplot2::labs(title=nn)