Summary info

## Options
opt$example <- eval(parse(text=opt$example))
example <- opt$example
names(example) <- NULL


## Required libs
suppressMessages(library("GenomicRanges"))
suppressMessages(library("ggbio"))
suppressMessages(library("TxDb.Hsapiens.UCSC.hg19.knownGene"))
suppressMessages(library("derfinder"))
suppressMessages(library("derfinderPlot"))

Summary information for simulation data set, analysis run2-v1.0.10 showcasing best clusters 1, 13, 32 which illustrate a two transcript gene with both transcripts differentially expressed, a candidate DER overlapping exons from both strands, and a two transcript gene with only one differentially expressed respectively.

Number of filtered bases

## Extract data from log files
reads <- system(paste0('grep filterData ', file.path(rootdir, opt$short, 'CoverageInfo', 'logs'), '/fullCov-*.e* | grep -v "that 0 percent"'), intern=TRUE)
filt <- data.frame(original=as.integer(gsub("were | rows", "", regmatches(reads, regexpr("were [0-9]* rows", reads)))), filtered=as.integer(gsub("are | rows", "", regmatches(reads, regexpr("are [0-9]* rows", reads)))))

## How many were filtered?
## What is the percent filtered?
## Percent remaining?
filtered <- colSums(filt)
summ <- c(
    'Filtered' = filtered["original"] - filtered["filtered"],
    'PercentFilt' = (filtered["original"] - filtered["filtered"]) / filtered["original"] * 100,
    'PercentRemaining' = 100 - (filtered["original"] - filtered["filtered"]) / filtered["original"] * 100
)
summ
##         Filtered.original      PercentFilt.original 
##              3.095562e+09              9.999628e+01 
## PercentRemaining.original 
##              3.720187e-03

Number of candidate regions

## Load regions data
load(file.path(rootdir, opt$short, 'derAnalysis', opt$run, 'fullRegions.Rdata'))

## How many candidate regions?
nRegs  <- c('cDERsN' = length(fullRegions))
nRegs
## cDERsN 
##    469

Number of DE regions

As determined by q-value < 0.10

## How many regions DE? Judged by q-value
## What is the percent of regions DE among the candidate ones?
qval <- c(
    'nDE' = sum(fullRegions$significantQval == TRUE),
    'percentDE' = sum(fullRegions$significantQval == TRUE) / length(fullRegions) * 100
    )
qval
##       nDE percentDE 
## 171.00000  36.46055

As determined by FWER adjusted p-value < 0.05

## How many regions DE? Judged by FWER adjusted p-value
## What is the percent of regions DE among the candidate ones?
fwer <- c(
    'nDE' = sum(fullRegions$significantFWER == TRUE),
    'percentDE' = sum(fullRegions$significantFWER == TRUE) / length(fullRegions) * 100
    )
fwer
##       nDE percentDE 
## 122.00000  26.01279
## Save results
save(summ, nRegs, qval, fwer, file=file.path(resdir, "summaryResults.Rdata"))

Example regions from each case

## Load full coverage data
load(file.path(rootdir, opt$short, 'CoverageInfo', 'fullCov.Rdata'))

## Load options
load(file.path(rootdir, opt$short, 'derAnalysis', opt$run, 'chr22', 'optionsStats.Rdata'))

## For ggplot
tmp <- fullRegions
names(tmp) <- seq_len(length(tmp))
regions.df <- as.data.frame(tmp)
regions.df$width <- width(tmp)
rm(tmp)

## Select clusters by cluster area
df <- data.frame(area=fullRegions$area, clusterChr=paste0(as.integer(fullRegions$cluster), chr=as.character(seqnames(fullRegions))))
regionClustAreas <- tapply(df$area, df$clusterChr, sum)
bestArea <- sapply(names(head(sort(regionClustAreas, decreasing=TRUE), 70)), function(y) { which(df$clusterChr == y)[[1]]})

## Graphical setup: ideograms 
## Load ideogram info
data(hg19IdeogramCyto, package = "biovizBase")
ideos.set <- as.character(unique(seqnames(fullRegions[bestArea])))
p.ideos <- lapply(ideos.set, function(xx) { 
    plotIdeogram(hg19IdeogramCyto, xx)
})
names(p.ideos) <- ideos.set


## Graphical setup: transcription database
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene

## Graphical setup: main plotting function
regionClusterPlot <- function(idx, tUse="fwer") {
    ## Chr specific selections
    chr <- as.character(seqnames(fullRegions[idx]))
    p.ideo <- p.ideos[[chr]]
    covInfo <- fullCov[[chr]]
    
    ## Make the plot
    p <- plotCluster(idx, regions=fullRegions, annotation=regions.df, coverageInfo=covInfo, groupInfo=optionsStats$groupInfo, titleUse=tUse, txdb=txdb, p.ideogram=p.ideo)
    print(p)
    
    ## Save .Rdata
    save(p, file=file.path(resdir, paste0("exampleRegion", idx, ".Rdata")) )
    
    ## Save as pdf
    pdf(file=file.path(resdir, paste0("exampleRegion", idx, ".pdf")), width=20, height=10)
    print(p)
    dev.off()
    rm(p.ideo, covInfo)
    
    return(invisible(TRUE)) 
}

## Genome plots
for(idx in opt$example) {
    regionClusterPlot(bestArea[idx], "fwer")
}

Reproducibility

Date the report was generated.

## [1] "2014-12-10 14:12:28 EST"

Wallclock time spent generating the report.

## Time difference of 1.709 mins

R session information.

## Session info
options(width=120)
devtools::session_info()
## Session info-----------------------------------------------------------------------------------------------------------
##  setting  value                                      
##  version  R version 3.1.1 Patched (2014-10-16 r66782)
##  system   x86_64, linux-gnu                          
##  ui       X11                                        
##  language (EN)                                       
##  collate  en_US.UTF-8                                
##  tz       
## Packages---------------------------------------------------------------------------------------------------------------
##  package                           * version  date       source                                      
##  acepack                             1.3.3.3  2013-05-03 CRAN (R 3.1.1)                              
##  AnnotationDbi                     * 1.28.1   2014-10-29 Bioconductor                                
##  base64enc                           0.1.2    2014-06-26 CRAN (R 3.1.0)                              
##  BatchJobs                           1.5      2014-10-30 CRAN (R 3.1.1)                              
##  BBmisc                              1.8      2014-10-30 CRAN (R 3.1.1)                              
##  Biobase                           * 2.26.0   2014-10-15 Bioconductor                                
##  BiocGenerics                      * 0.12.1   2014-11-15 Bioconductor                                
##  BiocParallel                        1.0.0    2014-10-15 Bioconductor                                
##  biomaRt                             2.22.0   2014-10-15 Bioconductor                                
##  Biostrings                          2.34.0   2014-10-15 Bioconductor                                
##  biovizBase                          1.14.0   2014-10-15 Bioconductor                                
##  bitops                              1.0.6    2013-08-17 CRAN (R 3.1.0)                              
##  brew                                1.0.6    2011-04-13 CRAN (R 3.1.0)                              
##  BSgenome                            1.34.0   2014-10-15 Bioconductor                                
##  bumphunter                          1.6.0    2014-10-15 Bioconductor                                
##  Cairo                               1.5.6    2014-06-26 CRAN (R 3.1.0)                              
##  checkmate                           1.5.0    2014-10-19 CRAN (R 3.1.1)                              
##  cluster                             1.15.3   2014-09-04 CRAN (R 3.1.1)                              
##  codetools                           0.2.9    2014-08-21 CRAN (R 3.1.1)                              
##  colorspace                          1.2.4    2013-09-30 CRAN (R 3.1.0)                              
##  DBI                                 0.3.1    2014-09-24 CRAN (R 3.1.1)                              
##  derfinder                         * 1.0.10   2014-11-23 Bioconductor                                
##  derfinderHelper                     1.0.4    2014-11-05 Github (lcolladotor/derfinderHelper@27bcfe6)
##  derfinderPlot                     * 1.0.3    2014-11-05 Github (lcolladotor/derfinderPlot@8d076e3)  
##  devtools                            1.6.1    2014-10-07 CRAN (R 3.1.1)                              
##  dichromat                           2.0.0    2013-01-24 CRAN (R 3.1.0)                              
##  digest                              0.6.6    2014-12-10 CRAN (R 3.1.1)                              
##  doRNG                               1.6      2014-03-07 CRAN (R 3.1.0)                              
##  evaluate                            0.5.5    2014-04-29 CRAN (R 3.1.0)                              
##  fail                                1.2      2013-09-19 CRAN (R 3.1.0)                              
##  foreach                             1.4.2    2014-04-11 CRAN (R 3.1.0)                              
##  foreign                             0.8.61   2014-03-28 CRAN (R 3.1.1)                              
##  formatR                             1.0      2014-08-25 CRAN (R 3.1.1)                              
##  Formula                             1.1.2    2014-07-13 CRAN (R 3.1.1)                              
##  GenomeInfoDb                      * 1.2.3    2014-11-15 Bioconductor                                
##  GenomicAlignments                   1.2.1    2014-11-05 Bioconductor                                
##  GenomicFeatures                   * 1.18.2   2014-10-29 Bioconductor                                
##  GenomicFiles                        1.2.0    2014-10-15 Bioconductor                                
##  GenomicRanges                     * 1.18.3   2014-11-20 Bioconductor                                
##  getopt                            * 1.20.0   2013-08-30 CRAN (R 3.1.1)                              
##  GGally                              0.5.0    2014-12-02 CRAN (R 3.1.1)                              
##  ggbio                             * 1.14.0   2014-11-04 Bioconductor                                
##  ggplot2                           * 1.0.0    2014-05-21 CRAN (R 3.1.0)                              
##  graph                               1.44.1   2014-12-10 Bioconductor                                
##  gridExtra                           0.9.1    2012-08-09 CRAN (R 3.1.1)                              
##  gtable                              0.1.2    2012-12-05 CRAN (R 3.1.0)                              
##  Hmisc                               3.14.6   2014-11-22 CRAN (R 3.1.1)                              
##  htmltools                           0.2.6    2014-09-08 CRAN (R 3.1.1)                              
##  IRanges                           * 2.0.0    2014-10-15 Bioconductor                                
##  iterators                           1.0.7    2014-04-11 CRAN (R 3.1.0)                              
##  knitr                               1.8      2014-11-11 CRAN (R 3.1.1)                              
##  knitrBootstrap                    * 1.0.0    2014-11-19 Github (jimhester/knitrBootstrap@76c41f0)   
##  labeling                            0.3      2014-08-23 CRAN (R 3.1.1)                              
##  lattice                             0.20.29  2014-04-04 CRAN (R 3.1.1)                              
##  latticeExtra                        0.6.26   2013-08-15 CRAN (R 3.1.0)                              
##  locfit                              1.5.9.1  2013-04-20 CRAN (R 3.1.0)                              
##  markdown                            0.7.4    2014-08-24 CRAN (R 3.1.1)                              
##  MASS                                7.3.35   2014-09-30 CRAN (R 3.1.1)                              
##  Matrix                              1.1.4    2014-06-15 CRAN (R 3.1.1)                              
##  matrixStats                         0.12.2   2014-12-07 CRAN (R 3.1.1)                              
##  mime                                0.2      2014-09-26 CRAN (R 3.1.1)                              
##  munsell                             0.4.2    2013-07-11 CRAN (R 3.1.0)                              
##  nnet                                7.3.8    2014-03-28 CRAN (R 3.1.1)                              
##  OrganismDbi                         1.8.0    2014-10-15 Bioconductor                                
##  pkgmaker                            0.22     2014-05-14 CRAN (R 3.1.0)                              
##  plyr                                1.8.1    2014-02-26 CRAN (R 3.1.0)                              
##  proto                               0.3.10   2012-12-22 CRAN (R 3.1.0)                              
##  qvalue                              1.40.0   2014-10-15 Bioconductor                                
##  RBGL                                1.42.0   2014-10-15 Bioconductor                                
##  RColorBrewer                        1.1.2    2014-12-07 CRAN (R 3.1.1)                              
##  Rcpp                                0.11.3   2014-09-29 CRAN (R 3.1.1)                              
##  RCurl                               1.95.4.5 2014-12-06 CRAN (R 3.1.1)                              
##  registry                            0.2      2012-01-24 CRAN (R 3.1.0)                              
##  reshape                             0.8.5    2014-04-23 CRAN (R 3.1.0)                              
##  reshape2                            1.4.1    2014-12-06 CRAN (R 3.1.1)                              
##  rmarkdown                         * 0.3.3    2014-09-17 CRAN (R 3.1.1)                              
##  R.methodsS3                         1.6.1    2014-01-05 CRAN (R 3.1.0)                              
##  rngtools                            1.2.4    2014-03-06 CRAN (R 3.1.0)                              
##  rpart                               4.1.8    2014-03-28 CRAN (R 3.1.1)                              
##  Rsamtools                           1.18.2   2014-11-12 Bioconductor                                
##  RSQLite                             1.0.0    2014-10-25 CRAN (R 3.1.1)                              
##  rstudioapi                          0.1      2014-03-27 CRAN (R 3.1.1)                              
##  rtracklayer                         1.26.2   2014-11-12 Bioconductor                                
##  S4Vectors                         * 0.4.0    2014-10-15 Bioconductor                                
##  scales                              0.2.4    2014-04-22 CRAN (R 3.1.0)                              
##  sendmailR                           1.2.1    2014-09-21 CRAN (R 3.1.1)                              
##  stringr                             0.6.2    2012-12-06 CRAN (R 3.1.0)                              
##  survival                            2.37.7   2014-01-22 CRAN (R 3.1.1)                              
##  TxDb.Hsapiens.UCSC.hg19.knownGene * 3.0.0    2014-09-29 Bioconductor                                
##  VariantAnnotation                   1.12.6   2014-12-07 Bioconductor                                
##  XML                                 3.98.1.1 2013-06-20 CRAN (R 3.1.0)                              
##  xtable                              1.7.4    2014-09-12 CRAN (R 3.1.1)                              
##  XVector                           * 0.6.0    2014-10-15 Bioconductor                                
##  yaml                                2.1.13   2014-06-12 CRAN (R 3.1.1)                              
##  zlibbioc                            1.12.0   2014-10-15 Bioconductor