This is an example of integrating a Tracktables report into a RMarkdown document.
library(tracktables)
options(markdown.HTML.header = system.file("misc", "datatables.html", package = "knitr"))
oldFileLocations <- system.file("extdata",package="tracktables")
dir.create(file.path(getwd(),"IGVDirectory"),
           showWarnings = FALSE,recursive = TRUE)
file.copy(oldFileLocations,
          file.path(getwd(),"IGVDirectory"),
          recursive = TRUE)## [1] TRUEfileLocations <- file.path(getwd(),"IGVDirectory","extdata")Next the samplesheet of metadata and filesheet of locations is created.
bigwigs <- dir(fileLocations,pattern="*.bw",full.names=TRUE)
intervals <- dir(fileLocations,pattern="*.bed",full.names=TRUE)
bigWigMat <- cbind(gsub("_Example.bw","",basename(bigwigs)),
                   bigwigs)
intervalsMat <- cbind(gsub("_Peaks.bed","",basename(intervals)),
                      intervals)
FileSheet <- merge(bigWigMat,intervalsMat,all=TRUE)
FileSheet <- as.matrix(cbind(FileSheet,NA))
colnames(FileSheet) <- c("SampleName","bigwig","interval","bam")
SampleSheet <- cbind(as.vector(FileSheet[,"SampleName"]),
                     c("EBF","H3K4me3","H3K9ac","RNAPol2"),
                     c("ProB","ProB","ProB","ProB"))
colnames(SampleSheet) <- c("SampleName","Antibody","Species")The tracktables report is created from a call to . By default all paths are created relative the directory specified by .
HTMLreport <- maketracktable(fileSheet=FileSheet,
                               SampleSheet=SampleSheet,
                               filename="IGVEx3.html",
                               basedirectory=getwd(),
                               genome="mm9")## tracktables uses the Datatables javascript libraries.
##             For information on Datatables see http://datatables.net/cat(HTMLreport)