To generate the report provided with this package you need to install pandoc version 1.12.3. If you do not also have LaTEX installed, follow the instructions from the pandoc link to install as well.
http://pandoc.org/installing.html
library(BarrettsProgressionRisk)
# Provide either a single bam file as an argument bam=<my file> or a path to one or more bam files path=<my bam path>
runQDNAseq(bam=<my file>, outputPath=<qdnaseq output path>)
# See the example of sample information table in example/endoscopy.xlsx
info = loadSampleInformation(<my info table>)
segObj = segmentRawData(info, <outputPath/rawReadCounts.txt>, <outputPath/fittedReadCounts.txt>, verbose=F)
sampleRisk = predictRiskFromSegments(segObj, verbose=F)
library(BarrettsProgressionRisk)
# Load example data set
data(package='BarrettsProgressionRisk',ExampleQDNAseqData)
# bamPath needs to contain one or more bam files for a patient, the default binsize is 50.
# This should not be changed without extensive testing of the data unless you are retraining the underlying model!
# example of fitted data output from QDNAseq function call: runQDNAseq(bamPath='.', outputPath='<my path>/', binsize=50)
print(fit.data)
# example of raw data output from QDNAseq function call
print(raw.data)
# example of sample information table
print(info)
# Segment the fitted and raw data
segObj = segmentRawData(loadSampleInformation(info), raw.data, fit.data, verbose=F)
# Predict risks from segmented data
pr = predictRiskFromSegments(segObj, verbose=F)
## -- Results -- ##
# get QC information
sampleResiduals(pr)
# plot raw data
plotSegmentData(pr)
# Per sample mountain plots with annotations for coefficients
copyNumberMountainPlot(pr, annotate=T)
### Per sample classifications/probabilities
# risk per sample for samples that pass QC (see sampleResiduals(...))
predictions(pr,'sample')
# output the absolute risk CI per sample
absoluteRiskCI(pr, 'sample')
# Plot the sample classifications by Endoscopy and location
patientRiskTilesPlot(pr)
### Per endoscopy classifications/probabilities
# risk per endoscopy
predictions(pr,'endoscopy')
# output the absolute risk CI per endoscopy
absoluteRiskCI(pr, 'endoscopy')
# Plot the endoscopy predictions over time, with risk classifications and confidence intervals based on the table output by absoluteRiskCI(...)
patientEndoscopyPlot(pr)
# Get recommendations per endoscopy, given as either sequential integers or dates in the sample information loaded initially.
rx(pr)
A script is included in inst/bin/generate_report.R. To write your own three parameters are needed:
library(rmarkdown)
library(knitr)
# bamPath needs to contain one or more bam files for a patient, the default binsize is 50.
# This should not be changed without extensive testing of the data unless you are retraining the underlying model!
# BarrettsProgressionRisk::runQDNAseq(bamPath='.', outputPath=<path to qdnaseq output>, binsize=50)
qdnaseq.path=system.file('extdata/example',package="BarrettsProgressionRisk")
info.file = system.file('extdata/example','endoscopy.xlsx',package="BarrettsProgressionRisk")
output.dir='~/tmp'
options(warn = -1)
rmd = system.file('rmd','RiskReport.Rmd',package="BarrettsProgressionRisk")
rmarkdown::render(rmd, params=list(path=path.expand(qdnaseq.path), info.file=info.file),
output_dir=path.expand(output.dir), output_format='html_document',
intermediates_dir=path.expand(output.dir))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.