Description Usage Arguments Value Examples
Method to convert GenomeTrackWidget to htmlwidgets objects
1 2 3 4 5 6 7 8 9 10 11 |
p |
GenomeTrackWidget or other object storing plot information |
htmlwidgets object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(GenomicRanges)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
## First we'll read in some sample data
genomation_dir <- system.file("extdata", package = "genomationData")
samp.file <- file.path(genomation_dir,'SamplesInfo.txt')
samp.info <- read.table(samp.file, header=TRUE, sep="\t",
stringsAsFactors = FALSE)
samp.info$fileName <- file.path(genomation_dir, samp.info$fileName)
ctcf.peaks = genomation::readBroadPeak(system.file("extdata",
"wgEncodeBroadHistoneH1hescCtcfStdPk.broadPeak.gz",
package = "genomationData"))
ctcf.peaks = ctcf.peaks[seqnames(ctcf.peaks) == "chr21"]
## resize peaks to size 1000
ctcf.peaks = resize(ctcf.peaks, width = 10000, fix = "center")
## Make track plotter
track_params <- set_track_parameters(samp.info$fileName[1:3],
annotation = TxDb.Hsapiens.UCSC.hg19.knownGene,
track_names = samp.info$sampleName[1:3] ,
share_y = TRUE)
example_plot <- plot_tracks(ctcf.peaks[1], track_params)
class(example_plot)
example_widtet <- to_widget(example_plot)
class(example_plot)
if (interactive()){
example_plot
example_widget
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.