comparison hairpinTool.R @ 9:f1076bfb0ed1

- Fixed tool to actually make use of barcode location options - Stored variables now properly used in processHairpinReads function
author shian_su <registertonysu@gmail.com>
date Wed, 30 Jul 2014 15:13:45 +1000
parents 548802b3492f
children 8923d4ea858b
comparison
equal deleted inserted replaced
8:548802b3492f 9:f1076bfb0ed1
33 # wise test 33 # wise test
34 # 18.selectOpt -String specifying type of selection for barcode 34 # 18.selectOpt -String specifying type of selection for barcode
35 # plots 35 # plots
36 # 19.selectVals -String specifying members selected for barcode 36 # 19.selectVals -String specifying members selected for barcode
37 # plots 37 # plots
38 # ###
38 # 39 #
39 # OUT: Bar Plot of Counts Per Index 40 # OUT: Bar Plot of Counts Per Index
40 # Bar Plot of Counts Per Hairpin 41 # Bar Plot of Counts Per Hairpin
41 # MDS Plot 42 # MDS Plot
42 # Smear Plot 43 # Smear Plot
55 library(statmod, quietly=TRUE, warn.conflicts=FALSE) 56 library(statmod, quietly=TRUE, warn.conflicts=FALSE)
56 library(splines, quietly=TRUE, warn.conflicts=FALSE) 57 library(splines, quietly=TRUE, warn.conflicts=FALSE)
57 library(edgeR, quietly=TRUE, warn.conflicts=FALSE) 58 library(edgeR, quietly=TRUE, warn.conflicts=FALSE)
58 library(limma, quietly=TRUE, warn.conflicts=FALSE) 59 library(limma, quietly=TRUE, warn.conflicts=FALSE)
59 60
60 if (packageVersion("edgeR") < "3.5.23") { 61 if (packageVersion("edgeR") < "3.5.27") {
61 stop("Please update 'edgeR' to version >= 3.5.23 to run this tool") 62 stop("Please update 'edgeR' to version >= 3.5.23 to run this tool")
62 } 63 }
63 64
64 if (packageVersion("limma")<"3.19.19") { 65 if (packageVersion("limma")<"3.19.19") {
65 message("Update 'limma' to version >= 3.19.19 to see updated barcode graphs") 66 message("Update 'limma' to version >= 3.19.19 to see updated barcode graphs")
357 358
358 if (inputType=="fastq") { 359 if (inputType=="fastq") {
359 # Use EdgeR hairpin process and capture outputs 360 # Use EdgeR hairpin process and capture outputs
360 hpReadout <- capture.output( 361 hpReadout <- capture.output(
361 data <- processHairpinReads(fastqPath, samplePath, annoPath, 362 data <- processHairpinReads(fastqPath, samplePath, annoPath,
363 barcodeStart=barStart, barcodeEnd=barEnd,
362 hairpinStart=hpStart, hairpinEnd=hpEnd, 364 hairpinStart=hpStart, hairpinEnd=hpEnd,
363 verbose=TRUE) 365 verbose=TRUE)
364 ) 366 )
365 367
366 # Remove function output entries that show processing data or is empty 368 # Remove function output entries that show processing data or is empty
466 pdf(mdsPdf) 468 pdf(mdsPdf)
467 plotMDS(data, labels=data$samples$group, col=as.numeric(data$samples$group), 469 plotMDS(data, labels=data$samples$group, col=as.numeric(data$samples$group),
468 main="MDS Plot") 470 main="MDS Plot")
469 newEntry <- c("MDS Plot (.pdf)", "mds.pdf") 471 newEntry <- c("MDS Plot (.pdf)", "mds.pdf")
470 linkData <- rbind(linkData, newEntry) 472 linkData <- rbind(linkData, newEntry)
473 invisible(dev.off())
474
475 # BCV Plot
476 png(bcvPng, width=600, height=600)
477 plotBCV(data, main="BCV Plot")
478 imageData <- rbind(imageData, c("BCV Plot", "bcv.png"))
479 invisible(dev.off())
480
481 pdf(bcvPdf)
482 plotBCV(data, main="BCV Plot")
483 newEntry <- c("BCV Plot (.pdf)", "bcv.pdf")
471 invisible(dev.off()) 484 invisible(dev.off())
472 485
473 if (workMode=="classic") { 486 if (workMode=="classic") {
474 # Assess differential representation using classic exact testing methodology 487 # Assess differential representation using classic exact testing methodology
475 # in edgeR 488 # in edgeR