Repository 'diffbind'
hg clone https://toolshed.g2.bx.psu.edu/repos/bgruening/diffbind

Changeset 13:1de83981d43c (2018-05-30)
Previous changeset 12:fa56d93f7980 (2018-04-19) Next changeset 14:c97a786e8fb5 (2018-06-07)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/diffbind commit 13485bed6a57ec4a34cab4ec6bb8b36d219e3610
modified:
diffbind.R
diffbind.xml
test-data/DiffBind_analysis.RData
test-data/out_diffbind.tab
added:
test-data/out_binding_matrix.tab
test-data/out_diffbind.bed
test-data/out_diffbind.interval
removed:
test-data/out_analysis_info.txt
test-data/out_binding.matrix
test-data/out_rscript.txt
b
diff -r fa56d93f7980 -r 1de83981d43c diffbind.R
--- a/diffbind.R Thu Apr 19 17:15:53 2018 -0400
+++ b/diffbind.R Wed May 30 12:25:42 2018 -0400
[
@@ -94,12 +94,49 @@
 
 # Output differential binding sites
 resSorted <- diff_bind[order(diff_bind$FDR),]
-write.table(as.data.frame(resSorted), file = opt$outfile, sep="\t", quote = FALSE, append=TRUE, row.names = FALSE)
+# Convert from GRanges (1-based) to 0-based format (adapted from https://www.biostars.org/p/89341/)
+if (opt$format == "bed") {
+    resSorted  <- data.frame(Chrom=seqnames(resSorted),
+        Start=start(resSorted) - 1,
+        End=end(resSorted),
+        Name=rep("DiffBind", length(resSorted)),
+        Score=rep("0", length(resSorted)),
+        Strand=gsub("\\*", ".", strand(resSorted)))
+} else if (opt$format == "interval") {
+     # Output as interval
+    df <- as.data.frame(resSorted)
+    extrainfo <- NULL
+    for (i in 1:nrow(df)) {
+        extrainfo[i] <- paste0(c(df$width[i], df[i, 6:ncol(df)]), collapse="|")
+    }
+    resSorted  <- data.frame(Chrom=seqnames(resSorted),
+        Start=start(resSorted) - 1,
+        End=end(resSorted),
+        Name=rep("DiffBind", length(resSorted)),
+        Score=rep("0", length(resSorted)),
+        Strand=gsub("\\*", ".", strand(resSorted)),
+        Comment=extrainfo)
+} else {
+    # Output as 0-based tabular
+    resSorted <- data.frame(Chrom=seqnames(resSorted),
+        Start=start(resSorted) - 1,
+        End=end(resSorted),
+        Name=rep("DiffBind", length(resSorted)),
+        Score=rep("0", length(resSorted)),
+        Strand=gsub("\\*", ".", strand(resSorted)),
+        mcols(resSorted))
+}
+write.table(resSorted, file = opt$outfile, sep="\t", quote = FALSE, append=TRUE, row.names = FALSE)
 
 # Output binding affinity scores
 if (!is.null(opt$bmatrix)) {
     bmat <- dba.peakset(sample_count, bRetrieve=TRUE, DataType=DBA_DATA_FRAME)
-    write.table(as.data.frame(bmat), file="bmatrix.tab", sep="\t", quote=FALSE, row.names=FALSE)
+    # Output as 0-based tabular
+    bmat <- data.frame(Chrom=bmat[, 1],
+        Start=bmat[, 2] - 1,
+        End=bmat[, 3],
+        bmat[, 4:ncol(bmat)])
+    write.table(bmat, file="bmatrix.tab", sep="\t", quote=FALSE, row.names=FALSE)
 }
 
 # Output RData file
b
diff -r fa56d93f7980 -r 1de83981d43c diffbind.xml
--- a/diffbind.xml Thu Apr 19 17:15:53 2018 -0400
+++ b/diffbind.xml Wed May 30 12:25:42 2018 -0400
[
b'@@ -1,4 +1,4 @@\n-<tool id="diffbind" name="DiffBind" version="2.6.6.2">\n+<tool id="diffbind" name="DiffBind" version="2.6.6.3">\n     <description> differential binding analysis of ChIP-Seq peak data</description>\n     <requirements>\n         <requirement type="package" version="2.6.6">bioconductor-diffbind</requirement>\n@@ -106,7 +106,7 @@\n     <inputs>\n         <repeat name="rep_group" title="Group" min="2" max="2" default="2">\n             <param name="groupName" type="text" label="Name"\n-            help="Name for the Group that the peak and BAM files belong to e.g. Resistant/Responsive (two Groups in total must be specified for DiffBind). NOTE: Please only use letters, numbers or underscores.">\n+            help="Name for the Group that the peak and BAM files belong to e.g. Resistant/Responsive (two Groups must be specified for DiffBind). NOTE: Please only use letters, numbers or underscores.">\n                 <sanitizer>\n                     <valid initial="string.letters,string.digits"><add value="_" /></valid>\n                 </sanitizer>\n@@ -133,9 +133,9 @@\n         <!-- Output Options -->\n         <section name="out" expanded="false" title="Output Options">\n             <param name="format" type="select" label="Output Format">\n+                <option value="interval" selected="True">Interval</option>\n                 <option value="bed">BED</option>\n-                <option value="gff">GFF</option>\n-                <option value="wig">WIG</option>\n+                <option value="tabular">Tabular (tab-separated)</option>\n             </param>\n             <param name="pdf" type="boolean" truevalue="True" falsevalue="" checked="False" label="Visualising the analysis results" help="output an additional PDF file" />\n             <param name="binding_matrix" type="boolean" truevalue="True" falsevalue="" checked="False" label="Output binding affinity matrix?" help="Output a table of the binding scores" />\n@@ -146,7 +146,12 @@\n     </inputs>\n \n     <outputs>\n-        <data name="outfile" format="tabular" label="${tool.name} on ${on_string}: Differentially bound sites" />\n+        <data name="outfile" format="interval" label="${tool.name} on ${on_string}: Differentially bound sites">\n+            <change_format>\n+                <when input="out.format" value="bed" format="bed" />\n+                <when input="out.format" value="tabular" format="tabular" />\n+            </change_format>\n+        </data>\n         <data name="plots" format="pdf" label="${tool.name} on ${on_string}: Plots">\n             <filter>out[\'pdf\']</filter>\n         </data>\n@@ -165,34 +170,72 @@\n     </outputs>\n \n     <tests>\n+        <!-- Ensure outputs work -->\n         <test expect_num_outputs="6">\n             <repeat name="rep_group">\n                 <param name="groupName" value="Resistant"/>\n-                <param name="peaks" value="BT474_ER_1.bed.gz,BT474_ER_2.bed.gz"/>\n+                <param name="peaks" ftype="bed" value="BT474_ER_1.bed.gz,BT474_ER_2.bed.gz"/>\n                 <param name="bamreads" ftype="bam" value="BT474_ER_1.bam,BT474_ER_2.bam" />\n             </repeat>\n             <repeat name="rep_group">\n                 <param name="groupName" value="Responsive"/>\n-                <param name="peaks" value="MCF7_ER_1.bed.gz,MCF7_ER_2.bed.gz"/>\n+                <param name="peaks" ftype="bed" value="MCF7_ER_1.bed.gz,MCF7_ER_2.bed.gz"/>\n                 <param name="bamreads" ftype="bam" value="MCF7_ER_1.bam,MCF7_ER_2.bam" />\n             </repeat>\n             <param name="scorecol" value="5" />\n+            <param name="format" value="interval"/>\n             <param name="pdf" value="True" />\n             <param name="binding_matrix" value="True" />\n             <param name="rdata" value="True" />\n             <param name="rscript" value="True"/>\n             <param name="analysis_info" value="True"/>\n-            <output name="outfile" value="out_diffbind.tab" />\n+            <output name="outfile" ftype="interval" value="out_d'..b'\n-* **FDR**: a multiple testing corrected FDR p-value\n+* **Chrom**: Chromosome name\n+* **Start**: Start position of site\n+* **End**: End position of site\n+* **Score**: 0\n+* **Name**: DiffBind\n+* **Strand**: Strand\n+* **Comment**: The pipe ("|") separated values in this column correspond to:\n+\n+    * *width*: Length of site\n+    * *Conc*: Mean read concentration over all the samples (the default calculation uses log2 normalized ChIP read counts with control read counts subtracted)\n+    * *Conc_Group1*: Mean concentration over the first group (e.g. Responsive)\n+    * *Conc_Group2*: Mean concentration over second group (e.g. Resistant)\n+    * *Fold*: Fold shows the difference in mean concentrations between the two groups (e.g. Responsive - Resistant), with a positive value indicating increased binding affinity in the first group and a negative value indicating increased binding affinity in the second group.\n+    * *p.value*: P-value confidence measure for identifying these sites as differentially bound\n+    * *FDR*: a multiple testing corrected FDR p-value\n+\n+Example - **BED format**:\n+\n+    =====  ======  ======  ========  =====  ======\n+    Chrom  Start   End     Name      Score  Strand\n+    =====  ======  ======  ========  =====  ======\n+    chr18  394599  396513  DiffBind    0      \\.  \n+    chr18  111566  112005  DiffBind    0      \\.  \n+    chr18  346463  347342  DiffBind    0      \\.  \n+    chr18  399013  400382  DiffBind    0      \\.  \n+    chr18  371109  372102  DiffBind    0      \\.  \n+    =====  ======  ======  ========  =====  ======\n+\n+Example - **Tabular format**:\n+\n+    =====  ======  ======  ========  =====  ======  ====  ===============  ==============  =====  ========  ========\n+    Chrom  Start   End     Name      Score  Strand  Conc  Conc_Responsive  Conc_Resistant  Fold   p.value   FDR\n+    =====  ======  ======  ========  =====  ======  ====  ===============  ==============  =====  ========  ========\n+    chr18  394599  396513  DiffBind    0      \\.    7.15  5.55             7.89            -2.35  7.06E-24  9.84E-21\n+    chr18  111566  112005  DiffBind    0      \\.    5.71  6.53             3.63            2.89   1.27E-08  8.88E-06\n+    chr18  346463  347342  DiffBind    0      \\.    5     5.77             3.24            2.52   6.51E-06  0.00303\n+    chr18  399013  400382  DiffBind    0      \\.    7.62  7                8.05            -1.04  1.04E-05  0.00364\n+    chr18  371109  372102  DiffBind    0      \\.    4.63  3.07             5.36            -2.3   8.10E-05  0.0226\n+    =====  ======  ======  ========  =====  ======  ====  ===============  ==============  =====  ========  ========\n \n \n **Binding Affinity Matrix**\n \n The final result of counting is a binding affinity matrix containing a (normalized) read count for each sample at every potential binding site. With this matrix, the samples can be re-clustered using affinity, rather than occupancy, data. The binding affinity matrix can be used for QC plotting as well as for subsequent\n-differential analysis.\n+differential analysis. Note that this output is a tabular 0-based format.\n \n Example:\n \n     =====  ======  ======  =========  =========  ==========  ==========\n-    CHR    START   END     MCF7_ER_1  MCF7_ER_2  BT474_ER_1  BT474_ER_2\n+    Chrom  Start   End     MCF7_ER_1  MCF7_ER_2  BT474_ER_1  BT474_ER_2\n     =====  ======  ======  =========  =========  ==========  ==========\n     chr18  111567  112005  137.6152   59.87837   29.41393    19.95945\n     chr18  189223  189652  19.95945   12.60597   11.55547    23.11095\n@@ -426,6 +499,8 @@\n .. _`Bioconductor package`: https://bioconductor.org/packages/release/bioc/html/DiffBind.html\n .. _`DiffBind User Guide`: https://bioconductor.org/packages/release/bioc/vignettes/DiffBind/inst/doc/DiffBind.pdf\n .. _`Bioconductor post`: https://support.bioconductor.org/p/69924/\n+.. _here: https://galaxyproject.org/learn/datatypes/#interval\n+.. _`Biostars post`: https://www.biostars.org/p/84686/\n \n ]]>\n     </help>\n'
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/DiffBind_analysis.RData
b
Binary file test-data/DiffBind_analysis.RData has changed
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/out_analysis_info.txt
--- a/test-data/out_analysis_info.txt Thu Apr 19 17:15:53 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
@@ -1,83 +0,0 @@
-dba.count Info
-
-4 Samples, 1394 sites in matrix (2141 total):
-              ID         Tissue  Condition Caller Intervals
-1  MCF7_ER_1_bed  MCF7_ER_1_bed Responsive   macs      1556
-2  MCF7_ER_2_bed  MCF7_ER_2_bed Responsive   macs      1046
-3 BT474_ER_1_bed BT474_ER_1_bed  Resistant   macs      1080
-4 BT474_ER_2_bed BT474_ER_2_bed  Resistant   macs      1122
-
-dba.analyze Info
-
-4 Samples, 1394 sites in matrix:
-              ID         Tissue  Condition Caller Intervals FRiP
-1  MCF7_ER_1_bed  MCF7_ER_1_bed Responsive counts      1394 0.38
-2  MCF7_ER_2_bed  MCF7_ER_2_bed Responsive counts      1394 0.22
-3 BT474_ER_1_bed BT474_ER_1_bed  Resistant counts      1394 0.27
-4 BT474_ER_2_bed BT474_ER_2_bed  Resistant counts      1394 0.25
-
-1 Contrast:
-      Group1 Members1    Group2 Members2 DB.DESeq2
-1 Responsive        2 Resistant        2         5
-
-SessionInfo
-
-R version 3.4.1 (2017-06-30)
-Platform: x86_64-apple-darwin14.5.0 (64-bit)
-Running under: OS X El Capitan 10.11.6
-
-Matrix products: default
-BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
-LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
-
-locale:
-[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_US.UTF-8
-
-attached base packages:
-[1] parallel  stats4    methods   stats     graphics  grDevices utils    
-[8] datasets  base     
-
-other attached packages:
- [1] bindrcpp_0.2               rjson_0.2.15              
- [3] DiffBind_2.6.6             SummarizedExperiment_1.8.0
- [5] DelayedArray_0.4.1         matrixStats_0.52.2        
- [7] Biobase_2.38.0             GenomicRanges_1.30.3      
- [9] GenomeInfoDb_1.14.0        IRanges_2.12.0            
-[11] S4Vectors_0.16.0           BiocGenerics_0.24.0       
-[13] getopt_1.20.0             
-
-loaded via a namespace (and not attached):
-  [1] Category_2.44.0          bitops_1.0-6             bit64_0.9-5             
-  [4] RColorBrewer_1.1-2       progress_1.1.2           httr_1.3.1              
-  [7] Rgraphviz_2.22.0         tools_3.4.1              backports_1.0.5         
- [10] R6_2.2.2                 rpart_4.1-13             KernSmooth_2.23-15      
- [13] Hmisc_4.0-3              DBI_0.8                  lazyeval_0.2.1          
- [16] colorspace_1.3-2         nnet_7.3-12              gridExtra_2.3           
- [19] DESeq2_1.18.1            prettyunits_1.0.2        bit_1.1-12              
- [22] compiler_3.4.1           sendmailR_1.2-1          graph_1.56.0            
- [25] htmlTable_1.9            labeling_0.3             rtracklayer_1.38.0      
- [28] caTools_1.17.1           scales_0.5.0             checkmate_1.8.2         
- [31] BatchJobs_1.6            genefilter_1.60.0        RBGL_1.54.0             
- [34] stringr_1.3.0            digest_0.6.12            Rsamtools_1.30.0        
- [37] foreign_0.8-67           AnnotationForge_1.20.0   XVector_0.18.0          
- [40] htmltools_0.3.6          base64enc_0.1-3          pkgconfig_2.0.1         
- [43] limma_3.34.6             htmlwidgets_1.0          rlang_0.2.0             
- [46] RSQLite_2.0              BBmisc_1.11              bindr_0.1.1             
- [49] GOstats_2.44.0           hwriter_1.3.2            BiocParallel_1.12.0     
- [52] gtools_3.5.0             acepack_1.4.1            dplyr_0.7.4             
- [55] RCurl_1.95-4.8           magrittr_1.5             Formula_1.2-1           
- [58] GO.db_3.5.0              GenomeInfoDbData_0.99.1  Matrix_1.2-12           
- [61] Rcpp_0.12.15             munsell_0.4.3            stringi_1.1.6           
- [64] edgeR_3.20.7             zlibbioc_1.24.0          gplots_3.0.1            
- [67] fail_1.3                 plyr_1.8.4               grid_3.4.1              
- [70] blob_1.1.1               ggrepel_0.7.0            gdata_2.18.0            
- [73] lattice_0.20-34          Biostrings_2.46.0        splines_3.4.1           
- [76] GenomicFeatures_1.28.5   annotate_1.56.0          locfit_1.5-9.1          
- [79] knitr_1.20               pillar_1.2.1             systemPipeR_1.12.0      
- [82] geneplotter_1.56.0       biomaRt_2.34.2           glue_1.2.0              
- [85] XML_3.98-1.6             ShortRead_1.36.0         latticeExtra_0.6-28     
- [88] data.table_1.10.4        gtable_0.2.0             amap_0.8-14             
- [91] assertthat_0.2.0         ggplot2_2.2.1            xtable_1.8-2            
- [94] survival_2.40-1          tibble_1.4.2             pheatmap_1.0.8          
- [97] GenomicAlignments_1.14.1 AnnotationDbi_1.40.0     memoise_1.1.0           
-[100] cluster_2.0.6            brew_1.0-6               GSEABase_1.40.0         
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/out_binding.matrix
--- a/test-data/out_binding.matrix Thu Apr 19 17:15:53 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
b'@@ -1,1395 +0,0 @@\n-CHR\tSTART\tEND\tMCF7_ER_1_bed\tMCF7_ER_2_bed\tBT474_ER_1_bed\tBT474_ER_2_bed\n-chr18\t111567\t112005\t137.615208000375\t59.878372946728\t29.4139375878664\t19.9594576489093\n-chr18\t189223\t189652\t19.9594576489093\t12.6059732519427\t11.5554754809475\t23.110950961895\n-chr18\t215232\t216063\t11.5554754809475\t15.7574665649284\t31.5149331298568\t72.4843461986707\n-chr18\t311530\t312172\t17.8584621069189\t11.5554754809475\t54.6258840917518\t43.0704086108043\n-chr18\t346464\t347342\t75.6358395116564\t40.9694130688139\t21.0099554199046\t16.8079643359236\n-chr18\t356560\t357362\t11.5554754809475\t14.7069687939332\t57.7773774047375\t53.5753863207566\n-chr18\t371110\t372102\t8.40398216796182\t9.45447993895705\t81.9388261376278\t82.989323908623\n-chr18\t394600\t396513\t56.7268796337423\t43.0704086108043\t510.541916703681\t438.05757050501\n-chr18\t399014\t400382\t156.524167878289\t117.655750351465\t558.864814169461\t496.885445680743\n-chr18\t498906\t500200\t767.913870597511\t278.381909313735\t196.443083176108\t181.736114382174\n-chr18\t503518\t504552\t99.7972882445466\t61.9793684887184\t194.342087634117\t231.10950961895\n-chr18\t531672\t532439\t44.1209063817996\t23.110950961895\t57.7773774047375\t73.5348439696659\n-chr18\t568036\t569332\t165.978647817246\t157.574665649284\t207.998558657055\t221.655029679993\n-chr18\t589046\t589875\t50.4238930077709\t72.4843461986707\t117.655750351466\t149.170683481322\n-chr18\t651923\t652540\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t657092\t657876\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t770235\t770992\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t832068\t832623\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t845064\t845849\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t922955\t924107\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t995240\t996193\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1075317\t1075949\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1147156\t1148528\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1150202\t1150753\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1220993\t1221400\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1221403\t1222223\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1241658\t1242294\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1269916\t1270558\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1302131\t1303494\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1359568\t1360093\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1392692\t1393631\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1394274\t1394992\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1460102\t1460758\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1618037\t1618797\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1903962\t1904450\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1905463\t1907085\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t1995317\t1995795\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t2070406\t2071263\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t2084320\t2084599\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t2096239\t2097152\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t2156043\t2156770\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t2171820\t2172243\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t2185313\t2185959\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t2189792\t2190434\t1.05049777099523\t1.'..b'-chr18\t74662083\t74662612\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74664965\t74666178\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74755273\t74755853\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74766525\t74767180\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74800752\t74801820\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74805140\t74805915\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74813207\t74813783\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74826803\t74827698\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74850113\t74850847\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74967232\t74968167\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t74974177\t74975856\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t75162079\t75162656\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t75306150\t75306689\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t75404862\t75405830\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t75463876\t75464359\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76166820\t76167943\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76212084\t76212732\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76244283\t76244913\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76247276\t76247878\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76355382\t76355883\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76382039\t76382699\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76398929\t76399745\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76431621\t76432094\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76528540\t76529917\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76533867\t76534686\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76566546\t76567310\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76574330\t76575226\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76652675\t76653264\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76653336\t76654222\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76734601\t76735073\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76749882\t76750469\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76759894\t76760344\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t76822532\t76823743\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77062037\t77062828\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77173663\t77174478\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77300430\t77301170\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77424530\t77425198\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77438941\t77440103\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77541065\t77541645\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77694136\t77695082\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77725047\t77725936\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77968049\t77968792\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n-chr18\t77987486\t77988208\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n'
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/out_binding_matrix.tab
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out_binding_matrix.tab Wed May 30 12:25:42 2018 -0400
b
b'@@ -0,0 +1,1395 @@\n+Chrom\tStart\tEnd\tMCF7_ER_1_bed_gz\tMCF7_ER_2_bed_gz\tBT474_ER_1_bed_gz\tBT474_ER_2_bed_gz\n+chr18\t111566\t112005\t137.615208000375\t59.878372946728\t29.4139375878664\t19.9594576489093\n+chr18\t189222\t189652\t19.9594576489093\t12.6059732519427\t11.5554754809475\t23.110950961895\n+chr18\t215231\t216063\t11.5554754809475\t15.7574665649284\t31.5149331298568\t72.4843461986707\n+chr18\t311529\t312172\t17.8584621069189\t11.5554754809475\t54.6258840917518\t43.0704086108043\n+chr18\t346463\t347342\t75.6358395116564\t40.9694130688139\t21.0099554199046\t16.8079643359236\n+chr18\t356559\t357362\t11.5554754809475\t14.7069687939332\t57.7773774047375\t53.5753863207566\n+chr18\t371109\t372102\t8.40398216796182\t9.45447993895705\t81.9388261376278\t82.989323908623\n+chr18\t394599\t396513\t56.7268796337423\t43.0704086108043\t510.541916703681\t438.05757050501\n+chr18\t399013\t400382\t156.524167878289\t117.655750351465\t558.864814169461\t496.885445680743\n+chr18\t498905\t500200\t767.913870597511\t278.381909313735\t196.443083176108\t181.736114382174\n+chr18\t503517\t504552\t99.7972882445466\t61.9793684887184\t194.342087634117\t231.10950961895\n+chr18\t531671\t532439\t44.1209063817996\t23.110950961895\t57.7773774047375\t73.5348439696659\n+chr18\t568035\t569332\t165.978647817246\t157.574665649284\t207.998558657055\t221.655029679993\n+chr18\t589045\t589875\t50.4238930077709\t72.4843461986707\t117.655750351466\t149.170683481322\n+chr18\t651922\t652540\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t657091\t657876\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t770234\t770992\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t832067\t832623\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t845063\t845849\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t922954\t924107\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t995239\t996193\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1075316\t1075949\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1147155\t1148528\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1150201\t1150753\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1220992\t1221400\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1221402\t1222223\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1241657\t1242294\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1269915\t1270558\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1302130\t1303494\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1359567\t1360093\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1392691\t1393631\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1394273\t1394992\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1460101\t1460758\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1618036\t1618797\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1903961\t1904450\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1905462\t1907085\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t1995316\t1995795\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2070405\t2071263\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2084319\t2084599\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2096238\t2097152\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2156042\t2156770\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2171819\t2172243\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2185312\t2185959\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2189791\t2190434\t1.050'..b'+chr18\t74662082\t74662612\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74664964\t74666178\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74755272\t74755853\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74766524\t74767180\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74800751\t74801820\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74805139\t74805915\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74813206\t74813783\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74826802\t74827698\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74850112\t74850847\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74967231\t74968167\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t74974176\t74975856\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t75162078\t75162656\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t75306149\t75306689\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t75404861\t75405830\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t75463875\t75464359\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76166819\t76167943\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76212083\t76212732\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76244282\t76244913\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76247275\t76247878\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76355381\t76355883\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76382038\t76382699\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76398928\t76399745\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76431620\t76432094\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76528539\t76529917\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76533866\t76534686\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76566545\t76567310\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76574329\t76575226\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76652674\t76653264\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76653335\t76654222\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76734600\t76735073\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76749881\t76750469\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76759893\t76760344\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t76822531\t76823743\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77062036\t77062828\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77173662\t77174478\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77300429\t77301170\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77424529\t77425198\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77438940\t77440103\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77541064\t77541645\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77694135\t77695082\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77725046\t77725936\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77968048\t77968792\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t77987485\t77988208\t1.05049777099523\t1.05049777099523\t1.05049777099523\t1.05049777099523\n'
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/out_diffbind.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out_diffbind.bed Wed May 30 12:25:42 2018 -0400
b
@@ -0,0 +1,6 @@
+Chrom Start End Name Score Strand
+chr18 394599 396513 DiffBind 0 .
+chr18 111566 112005 DiffBind 0 .
+chr18 346463 347342 DiffBind 0 .
+chr18 399013 400382 DiffBind 0 .
+chr18 371109 372102 DiffBind 0 .
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/out_diffbind.interval
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out_diffbind.interval Wed May 30 12:25:42 2018 -0400
b
@@ -0,0 +1,6 @@
+Chrom Start End Name Score Strand Comment
+chr18 394599 396513 DiffBind 0 . 1914|7.15|5.55|7.89|-2.35|7.06e-24|9.84e-21
+chr18 111566 112005 DiffBind 0 . 439|5.71|6.53|3.63|2.89|1.27e-08|8.88e-06
+chr18 346463 347342 DiffBind 0 . 879|5|5.77|3.24|2.52|6.51e-06|0.00303
+chr18 399013 400382 DiffBind 0 . 1369|7.62|7|8.05|-1.04|1.04e-05|0.00364
+chr18 371109 372102 DiffBind 0 . 993|4.63|3.07|5.36|-2.3|8.1e-05|0.0226
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/out_diffbind.tab
--- a/test-data/out_diffbind.tab Thu Apr 19 17:15:53 2018 -0400
+++ b/test-data/out_diffbind.tab Wed May 30 12:25:42 2018 -0400
b
@@ -1,6 +1,6 @@
-seqnames start end width strand Conc Conc_Responsive Conc_Resistant Fold p.value FDR
-chr18 394600 396513 1914 * 7.15 5.55 7.89 -2.35 7.06e-24 9.84e-21
-chr18 111567 112005 439 * 5.71 6.53 3.63 2.89 1.27e-08 8.88e-06
-chr18 346464 347342 879 * 5 5.77 3.24 2.52 6.51e-06 0.00303
-chr18 399014 400382 1369 * 7.62 7 8.05 -1.04 1.04e-05 0.00364
-chr18 371110 372102 993 * 4.63 3.07 5.36 -2.3 8.1e-05 0.0226
+Chrom Start End Name Score Strand Conc Conc_Responsive Conc_Resistant Fold p.value FDR
+chr18 394599 396513 DiffBind 0 . 7.15 5.55 7.89 -2.35 7.06e-24 9.84e-21
+chr18 111566 112005 DiffBind 0 . 5.71 6.53 3.63 2.89 1.27e-08 8.88e-06
+chr18 346463 347342 DiffBind 0 . 5 5.77 3.24 2.52 6.51e-06 0.00303
+chr18 399013 400382 DiffBind 0 . 7.62 7 8.05 -1.04 1.04e-05 0.00364
+chr18 371109 372102 DiffBind 0 . 4.63 3.07 5.36 -2.3 8.1e-05 0.0226
b
diff -r fa56d93f7980 -r 1de83981d43c test-data/out_rscript.txt
--- a/test-data/out_rscript.txt Thu Apr 19 17:15:53 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
@@ -1,119 +0,0 @@
-## Setup R error handling to go to stderr
-options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
-# we need that to not crash galaxy with an UTF8 error on German LC settings.
-Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
-
-suppressPackageStartupMessages({
-    library('getopt')
-    library('DiffBind')
-    library('rjson')
-})
-
-options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
-args <- commandArgs(trailingOnly = TRUE)
-
-#get options, using the spec as defined by the enclosed list.
-#we read the options from the default: commandArgs(TRUE).
-spec = matrix(c(
-    'infile' , 'i', 1, "character",
-    'outfile' , 'o', 1, "character",
-    'scorecol', 'n', 1, "integer",
-    'lowerbetter', 'l', 1, "logical",
-    'summits', 's', 1, "integer",
-    'th', 't', 1, "double",
-    'format', 'f', 1, "character",
-    'plots' , 'p', 2, "character",
-    'bmatrix', 'b', 0, "logical",
-    "rdaOpt", "r", 0, "logical",
-    'infoOpt' , 'a', 0, "logical",
-    'verbose', 'v', 2, "integer",
-    'help' , 'h', 0, "logical"
-), byrow=TRUE, ncol=4);
-
-opt = getopt(spec);
-
-# if help was asked for print a friendly message
-# and exit with a non-zero error code
-if ( !is.null(opt$help) ) {
-    cat(getopt(spec, usage=TRUE));
-    q(status=1);
-}
-
-parser <- newJSONParser()
-parser$addData(opt$infile)
-factorList <- parser$getObject()
-filenamesIn <- unname(unlist(factorList[[1]][[2]]))
-peaks <- filenamesIn[grepl("peaks.bed", filenamesIn)]
-bams <- filenamesIn[grepl("bamreads.bam", filenamesIn)]
-ctrls <- filenamesIn[grepl("bamcontrol.bam", filenamesIn)]
-
-# get the group and sample id from the peaks filenames
-groups <- sapply(strsplit(peaks,"-"), `[`, 1)
-samples <- sapply(strsplit(peaks,"-"), `[`, 2)
-
-if ( length(ctrls) != 0 ) {
-    sampleTable <- data.frame(SampleID=samples,
-                        Condition=groups,
-                        bamReads=bams,
-                        bamControl=ctrls,
-                        Peaks=peaks,
-                        Tissue=samples, # using "Tissue" column to display ids as labels in PCA plot
-                        stringsAsFactors=FALSE)
-} else {
-    sampleTable <- data.frame(SampleID=samples,
-                        Replicate=samples,
-                        Condition=groups,
-                        bamReads=bams,
-                        Peaks=peaks,
-                        Tissue=samples,
-                        stringsAsFactors=FALSE)
-}
-
-sample = dba(sampleSheet=sampleTable, peakFormat='bed', scoreCol=opt$scorecol, bLowerScoreBetter=opt$lowerbetter)
-
-if ( !is.null(opt$summits) ) {
-    sample_count = dba.count(sample, summits=opt$summits)
-} else {
-    sample_count = dba.count(sample)
-}
-
-sample_contrast = dba.contrast(sample_count, categories=DBA_CONDITION, minMembers=2)
-sample_analyze = dba.analyze(sample_contrast)
-diff_bind = dba.report(sample_analyze, th=opt$th)
-
-# Generate plots
-if ( !is.null(opt$plots) ) {
-    pdf(opt$plots)
-    orvals = dba.plotHeatmap(sample_analyze, contrast=1, correlations=FALSE, cexCol=0.8, th=opt$th)
-    dba.plotPCA(sample_analyze, contrast=1, th=opt$th, label=DBA_TISSUE, labelSize=0.3)
-    dba.plotMA(sample_analyze, th=opt$th)
-    dba.plotVolcano(sample_analyze, th=opt$th)
-    dba.plotBox(sample_analyze, th=opt$th)
-    dev.off()
-}
-
-# Output differential binding sites
-resSorted <- diff_bind[order(diff_bind$FDR),]
-write.table(as.data.frame(resSorted), file = opt$outfile, sep="\t", quote = FALSE, append=TRUE, row.names = FALSE)
-
-# Output binding affinity scores
-if (!is.null(opt$bmatrix)) {
-    bmat <- dba.peakset(sample_count, bRetrieve=TRUE, DataType=DBA_DATA_FRAME)
-    write.table(as.data.frame(bmat), file="bmatrix.tab", sep="\t", quote=FALSE, row.names=FALSE)
-}
-
-# Output RData file
-if (!is.null(opt$rdaOpt)) {
-    save.image(file = "DiffBind_analysis.RData")
-}
-
-# Output analysis info
-if (!is.null(opt$infoOpt)) {
-    info <- "DiffBind_analysis_info.txt"
-    cat("dba.count Info\n\n", file=info, append = TRUE)
-    capture.output(sample, file=info, append=TRUE)
-    cat("\ndba.analyze Info\n\n", file=info, append = TRUE)
-    capture.output(sample_analyze, file=info, append=TRUE)
-    cat("\nSessionInfo\n\n", file=info, append = TRUE)
-    capture.output(sessionInfo(), file=info, append=TRUE)
-}
\ No newline at end of file