# HG changeset patch # User dave # Date 1528398887 14400 # Node ID 962b0ae5939fd0097d2485696d22ee088b7e905f planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/cummerbund commit b'1f42c4a241d1a9baaadcdc58d22701bd55700537\n'-dirty diff -r 000000000000 -r 962b0ae5939f cummeRbund.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cummeRbund.R Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,147 @@ +## Feature Selection ## +options(echo=TRUE) +get_features <- function(myGenes, f="gene") { + if (f == "isoforms") + return(isoforms(myGenes)) + else if (f == "tss") + return(TSS(myGenes)) + else if (f == "cds") + return(CDS(myGenes)) + else + return(myGenes) +} + +## Main Function ## + +library(argparse) + +parser <- ArgumentParser(description='Create a plot with cummeRbund') + +parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +parser$add_argument('--features', dest='features', action="store", default="genes") +parser$add_argument('--clustering', dest='clustering', action="store", default="both") +parser$add_argument('--iter_max', dest='iter_max', action="store") +parser$add_argument('--genes', dest='genes', action="append") +parser$add_argument('--k', dest='k', action="store") +parser$add_argument('--x', dest='x', action="store") +parser$add_argument('--y', dest='y', action="store") + +args <- parser$parse_args() + +## Load cummeRbund library +library("cummeRbund") + +## Initialize cuff object +cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) + +## Print out info +print(cuff) +sink("cuffdb_info.txt") +print(cuff) +print("SAMPLES:") +samples(cuff) +print("REPLICATES:") +replicates(cuff) +print("FEATURES:") +print(annotation(genes(cuff))) +cat(annotation(genes(cuff))[[1]],sep=",") +sink() + +png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +tryCatch({ + if (args$plotType == 'density') { + csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) + } + else if (args$plotType == 'boxplot') { + csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) + } + else if (args$plotType == 'mds') { + MDSplot(genes(cuff), replicates=args$replicates) + } + else if (args$plotType == 'pca') { + PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) + } + else if (args$plotType == 'dendrogram') { + csDendro(genes(cuff), replicates=args$replicates) + } + else if (args$plotType == 'scatter') { + if (args$gene_selector) { + myGenes <- getGenes(cuff, args$genes) + csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) + } + else { + csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) + } + } + else if (args$plotType == 'volcano') { + if (args$gene_selector) { + myGenes <- get_features(getGenes(cuff, args$genes), args$features) + } + else { + myGenes <- genes(cuff) + } + csVolcano(myGenes, args$x, args$y) + } + else if (args$plotType == 'heatmap') { + if (args$gene_selector) { + myGenes <- getGenes(cuff, args$genes) + } + else { + myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) + } + csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) + } + else if (args$plotType == 'cluster') { + myGenes <- getGenes(cuff, args$genes) + csCluster(get_features(myGenes, args$features), k=args$k) + } + else if (args$plotType == 'dispersion') { + dispersionPlot(genes(cuff)) + } + else if (args$plotType == 'fpkmSCV') { + fpkmSCVPlot(genes(cuff)) + } + else if (args$plotType == 'scatterMatrix') { + csScatterMatrix(genes(cuff)) + } + else if (args$plotType == 'expressionplot') { + myGenes <- getGenes(cuff, args$genes) + expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) + } + else if (args$plotType == 'expressionbarplot') { + myGeneId <- args$genes + myGenes <- getGenes(cuff, myGeneId) + expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) + } + else if (args$plotType == 'mds') { + MDSplot(genes(cuff),replicates=args$replicates) + } + else if (args$plotType == 'pca') { + PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) + } + else if (args$plotType == 'maplot') { + MAplot(genes(cuff), args$x, args$y, useCount=args$count) + } + else if (args$plotType == 'genetrack') { + myGene <- getGene(cuff, args$genes) + plotTracks(makeGeneRegionTrack(myGene)) + } +},error = function(e) { + write(paste("Failed:", e, sep=" "), stderr()) + q("no", 1, TRUE) +}) +devname = dev.off() diff -r 000000000000 -r 962b0ae5939f cummeRbund.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cummeRbund.xml Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,363 @@ + + + visualize Cuffdiff output + + cummeRbund_macros.xml + + + r-argparse + bioconductor-cummerbund + + + + 0: + --gene_selector + #for gene in $p.plot.genes: + --genes ${gene.gene_id} + #end for + #end if + #elif $p.plot.type == "cluster": + --features $p.plot.features --k $p.plot.k --iter_max $p.plot.iter_max + #if len($p.plot.genes) > 0: + #for gene in $p.plot.genes: + --genes ${gene.gene_id} + #end for + #end if + #elif $p.plot.type in [ "expressionplot", "expressionbarplot" ]: + #if $p.plot.type == "expressionplot": + $p.plot.draw_summary + #end if + --features $p.plot.features $p.plot.error_bars --genes ${p.plot.gene_id} $p.plot.replicates $p.plot.log10 + #end if + #if $p.plot.type == "density": + $p.plot.log10 + #end if + > "${output}" 2>&1 ; +#end for +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `_ written by James E. Johnson of the Minnesota Supercomputing Institute. + ]]> + + doi:10.1038/nprot.2012.016 + + diff -r 000000000000 -r 962b0ae5939f cummeRbund_macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cummeRbund_macros.xml Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 962b0ae5939f test-data/boxplot.png Binary file test-data/boxplot.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/boxplot.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/boxplot.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,279 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/cuffdiff_out.sqlite Binary file test-data/cuffdiff_out.sqlite has changed diff -r 000000000000 -r 962b0ae5939f test-data/dendrogram.png Binary file test-data/dendrogram.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/dendrogram.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/dendrogram.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,280 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +'dendrogram' with 2 branches and 2 members total, at height 0.7672512 +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/density.png Binary file test-data/density.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/density.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/density.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,281 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Warning message: +Removed 128 rows containing non-finite values (stat_density). +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/dispersion.png Binary file test-data/dispersion.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/dispersion.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/dispersion.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,282 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Warning messages: +1: Transformation introduced infinite values in continuous x-axis +2: Transformation introduced infinite values in continuous y-axis +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/expressionbarplot.png Binary file test-data/expressionbarplot.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/expressionbarplot.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/expressionbarplot.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,311 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Getting gene information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting isoforms information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting CDS information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting TSS information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting promoter information: + distData +Getting splicing information: + distData +Getting relCDS information: + distData +Scale for 'colour' is already present. Adding another scale for 'colour', +which will replace the existing scale. +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/expressionplot.png Binary file test-data/expressionplot.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/expressionplot.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/expressionplot.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,309 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Getting gene information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting isoforms information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting CDS information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting TSS information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting promoter information: + distData +Getting splicing information: + distData +Getting relCDS information: + distData +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/fpkmSCV.png Binary file test-data/fpkmSCV.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/fpkmSCV.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/fpkmSCV.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,285 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Scale for 'x' is already present. Adding another scale for 'x', which will +replace the existing scale. +`geom_smooth()` using method = 'loess' +Warning message: +In .local(object, FPKMLowerBound, ...) : + At least one of your conditions does not have enough replicates to estimate variance. Estimating variance across all conditions instead. +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/heatmap.png Binary file test-data/heatmap.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/heatmap.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/heatmap.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,311 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Getting gene information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting isoforms information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting CDS information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting TSS information: + FPKM + Differential Expression Data + Annotation Data + Replicate FPKMs + Counts +Getting promoter information: + distData +Getting splicing information: + distData +Getting relCDS information: + distData +Using tracking_id, sample_name as id variables +No id variables; using all as measure variables +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/maplot.png Binary file test-data/maplot.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/maplot.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/maplot.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,281 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Warning message: +Removed 52 rows containing missing values (geom_point). +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/pca.png Binary file test-data/pca.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/pca.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/pca.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,280 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +Warning: Ignoring unknown aesthetics: label +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/scatter.png Binary file test-data/scatter.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/scatter.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/scatter.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,279 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/scatterMatrix.png Binary file test-data/scatterMatrix.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/scatterMatrix.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/scatterMatrix.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,279 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +> devname = dev.off() +> diff -r 000000000000 -r 962b0ae5939f test-data/volcano.png Binary file test-data/volcano.png has changed diff -r 000000000000 -r 962b0ae5939f test-data/volcano.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/volcano.txt Thu Jun 07 15:14:47 2018 -0400 @@ -0,0 +1,279 @@ +> get_features <- function(myGenes, f="gene") { ++ if (f == "isoforms") ++ return(isoforms(myGenes)) ++ else if (f == "tss") ++ return(TSS(myGenes)) ++ else if (f == "cds") ++ return(CDS(myGenes)) ++ else ++ return(myGenes) ++ } +> +> ## Main Function ## +> +> library(argparse) +Loading required package: proto +> +> parser <- ArgumentParser(description='Create a plot with cummeRbund') +> +> parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) +> parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) +> parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) +> parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) +> parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) +> parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) +> parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) +> parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) +> parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) +> parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) +> parser$add_argument('--border', dest='border', action="store_true", default=FALSE) +> parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) +> parser$add_argument('--count', dest='count', action="store_true", default=FALSE) +> parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) +> parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) +> parser$add_argument('--features', dest='features', action="store", default="genes") +> parser$add_argument('--clustering', dest='clustering', action="store", default="both") +> parser$add_argument('--iter_max', dest='iter_max', action="store") +> parser$add_argument('--genes', dest='genes', action="append") +> parser$add_argument('--k', dest='k', action="store") +> parser$add_argument('--x', dest='x', action="store") +> parser$add_argument('--y', dest='y', action="store") +> +> args <- parser$parse_args() +> +> ## Load cummeRbund library +> library("cummeRbund") +Loading required package: BiocGenerics +Loading required package: methods +Loading required package: parallel + +Attaching package: ‘BiocGenerics’ + +The following objects are masked from ‘package:parallel’: + + clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, + clusterExport, clusterMap, parApply, parCapply, parLapply, + parLapplyLB, parRapply, parSapply, parSapplyLB + +The following objects are masked from ‘package:stats’: + + IQR, mad, xtabs + +The following objects are masked from ‘package:base’: + + anyDuplicated, append, as.data.frame, cbind, colnames, do.call, + duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, + is.unsorted, lapply, lengths, Map, mapply, match, mget, order, + paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, + Reduce, rownames, sapply, setdiff, sort, table, tapply, union, + unique, unsplit, which, which.max, which.min + +Loading required package: RSQLite +Loading required package: DBI +Loading required package: ggplot2 +Loading required package: reshape2 +Loading required package: fastcluster + +Attaching package: ‘fastcluster’ + +The following object is masked from ‘package:stats’: + + hclust + +Loading required package: rtracklayer +Loading required package: GenomicRanges +Loading required package: stats4 +Loading required package: S4Vectors + +Attaching package: ‘S4Vectors’ + +The following objects are masked from ‘package:base’: + + colMeans, colSums, expand.grid, rowMeans, rowSums + +Loading required package: IRanges +Loading required package: GenomeInfoDb +Loading required package: Gviz +Loading required package: grid +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘ensembldb’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ +Warning: namespace ‘AnnotationHub’ is not available and has been replaced +by .GlobalEnv when processing object ‘plot.index’ + +Attaching package: ‘cummeRbund’ + +The following object is masked from ‘package:GenomicRanges’: + + promoters + +The following object is masked from ‘package:IRanges’: + + promoters + +The following object is masked from ‘package:BiocGenerics’: + + conditions + +> +> ## Initialize cuff object +> cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) +> +> ## Print out info +> print(cuff) +CuffSet instance with: + 2 samples + 87 genes + 90 isoforms + 88 TSS + 0 CDS + 87 promoters + 88 splicing + 0 relCDS +> sink("cuffdb_info.txt") +> print(cuff) +> print("SAMPLES:") +> samples(cuff) +> print("REPLICATES:") +> replicates(cuff) +> print("FEATURES:") +> print(annotation(genes(cuff))) +> cat(annotation(genes(cuff))[[1]],sep=",") +> sink() +> +> png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) +> tryCatch({ ++ if (args$plotType == 'density') { ++ csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'boxplot') { ++ csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'dendrogram') { ++ csDendro(genes(cuff), replicates=args$replicates) ++ } ++ else if (args$plotType == 'scatter') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ else { ++ csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) ++ } ++ } ++ else if (args$plotType == 'volcano') { ++ if (args$gene_selector) { ++ myGenes <- get_features(getGenes(cuff, args$genes), args$features) ++ } ++ else { ++ myGenes <- genes(cuff) ++ } ++ csVolcano(myGenes, args$x, args$y) ++ } ++ else if (args$plotType == 'heatmap') { ++ if (args$gene_selector) { ++ myGenes <- getGenes(cuff, args$genes) ++ } ++ else { ++ myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) ++ } ++ csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) ++ } ++ else if (args$plotType == 'cluster') { ++ myGenes <- getGenes(cuff, args$genes) ++ csCluster(get_features(myGenes, args$features), k=args$k) ++ } ++ else if (args$plotType == 'dispersion') { ++ dispersionPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'fpkmSCV') { ++ fpkmSCVPlot(genes(cuff)) ++ } ++ else if (args$plotType == 'scatterMatrix') { ++ csScatterMatrix(genes(cuff)) ++ } ++ else if (args$plotType == 'expressionplot') { ++ myGenes <- getGenes(cuff, args$genes) ++ expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'expressionbarplot') { ++ myGeneId <- args$genes ++ myGenes <- getGenes(cuff, myGeneId) ++ expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) ++ } ++ else if (args$plotType == 'mds') { ++ MDSplot(genes(cuff),replicates=args$replicates) ++ } ++ else if (args$plotType == 'pca') { ++ PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) ++ } ++ else if (args$plotType == 'maplot') { ++ MAplot(genes(cuff), args$x, args$y, useCount=args$count) ++ } ++ else if (args$plotType == 'genetrack') { ++ myGene <- getGene(cuff, args$genes) ++ plotTracks(makeGeneRegionTrack(myGene)) ++ } ++ },error = function(e) { ++ write(paste("Failed:", e, sep=" "), stderr()) ++ q("no", 1, TRUE) ++ }) +> devname = dev.off() +>