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

Changeset 7:681dedc42aca (2018-01-28)
Previous changeset 6:6031247f61d4 (2017-10-28) Next changeset 8:a2bb4f5252a8 (2018-01-28)
Commit message:
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/diffbind commit affbc59222cde9be21e91fa1f9194930a070b830
modified:
diffbind.R
diffbind.xml
added:
test-data/BT474_ER_1.bam
test-data/BT474_ER_1.bed.gz
test-data/BT474_ER_2.bam
test-data/BT474_ER_2.bed.gz
test-data/MCF7_ER_1.bam
test-data/MCF7_ER_1.bed.gz
test-data/MCF7_ER_2.bam
test-data/MCF7_ER_2.bed.gz
test-data/out_binding.matrix
test-data/out_diffbind.bed
removed:
diffbind.tar.bz2
b
diff -r 6031247f61d4 -r 681dedc42aca diffbind.R
--- a/diffbind.R Sat Oct 28 12:53:58 2017 -0400
+++ b/diffbind.R Sun Jan 28 04:26:11 2018 -0500
[
@@ -3,7 +3,11 @@
 # we need that to not crash galaxy with an UTF8 error on German LC settings.
 Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
 
-library('getopt');
+suppressPackageStartupMessages({
+ library('getopt')
+ library('DiffBind')
+})
+
 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
 args <- commandArgs(trailingOnly = TRUE)
 
@@ -15,7 +19,9 @@
     'outfile' , 'o', 1, "character",
     'plots' , 'p', 2, "character",
     'infile' , 'i', 1, "character",
-    'format', 'f', 1, 'character'
+    'format', 'f', 1, "character",
+    'th', 't', 1, "double",
+    'bmatrix', 'b', 0, "logical"
 ), byrow=TRUE, ncol=4);
 
 opt = getopt(spec);
@@ -27,13 +33,10 @@
     q(status=1);
 }
 
-library('DiffBind')
-
 if ( !is.null(opt$plots) ) {
     pdf(opt$plots)
 }
 
-
 sample = dba(sampleSheet=opt$infile, peakFormat='bed')
 sample_count = dba.count(sample)
 sample_contrast = dba.contrast(sample_count, categories=DBA_CONDITION, minMembers=2)
@@ -44,6 +47,11 @@
 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, col.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, col.names=FALSE)
+}
 
 dev.off()
 sessionInfo()
b
diff -r 6031247f61d4 -r 681dedc42aca diffbind.tar.bz2
b
Binary file diffbind.tar.bz2 has changed
b
diff -r 6031247f61d4 -r 681dedc42aca diffbind.xml
--- a/diffbind.xml Sat Oct 28 12:53:58 2017 -0400
+++ b/diffbind.xml Sun Jan 28 04:26:11 2018 -0500
[
b'@@ -1,8 +1,10 @@\n-<tool id="diffbind" name="DiffBind" version="2.2.2">\n+<tool id="diffbind" name="DiffBind" version="2.6.5.0">\n     <description> differential binding analysis of ChIP-Seq peak data</description>\n     <requirements>\n-        <requirement type="package" version="2.0.9">bioconductor-diffbind</requirement>\n+        <requirement type="package" version="2.6.5">bioconductor-diffbind</requirement>\n         <requirement type="package" version="1.20.0">r-getopt</requirement>\n+        <!--added rmysql requirement to remove: "Warning: namespace \xe2\x80\x98RMySQL\xe2\x80\x99 is not available"-->\n+        <requirement type="package" version="0.10.11">r-rmysql</requirement>\n     </requirements>\n     <stdio>\n         <regex match="Execution halted"\n@@ -18,8 +20,10 @@\n            level="fatal"\n            description="An undefined error occured, please check your intput carefully and contact your administrator." />\n     </stdio>\n-    <command>\n-<![CDATA[\n+    <version_command><![CDATA[\n+echo $(R --version | grep version | grep -v GNU)", DiffBind version" $(R --vanilla --slave -e "library(DiffBind); cat(sessionInfo()\\$otherPkgs\\$DiffBind\\$Version)" 2> /dev/null | grep -v -i "WARNING: ")," getopt version" $(R --vanilla --slave -e "library(getopt); cat(sessionInfo()\\$otherPkgs\\$getopt\\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", rmysql version" $(R --vanilla --slave -e "library(rmysql); cat(sessionInfo()\\$otherPkgs\\$rmysql\\$Version)" 2> /dev/null | grep -v -i "WARNING: ")\n+    ]]></version_command>\n+    <command><![CDATA[\n         ## seems that diffbind also needs file extensions to work properly\n         #set $counter = 1\n         #for $sample in $samples:\n@@ -32,15 +36,20 @@\n             #set $counter = $counter + 1\n         #end for\n \n-        Rscript $__tool_directory__/diffbind.R\n+        Rscript \'$__tool_directory__/diffbind.R\'\n             -i $infile\n-            -o $outfile\n-            -p $plots\n+            -o \'$outfile\'\n+            -p \'$plots\'\n             -f $format\n+            -t $th\n+\n+            #if $binding_affinity_matrix:\n+                -b\n+            #end if\n ]]>\n     </command>\n     <configfiles>\n-<configfile name="infile">\n+<configfile name="infile"><![CDATA[\n #set $counter = 1\n #for $sample in $samples:\n #if str( $sample.bamcontrol ) != \'None\' and $counter == 1:\n@@ -54,8 +63,7 @@\n $sample.sample_id,$sample.tissue,$sample.factor,$sample.condition,$sample.replicate,#echo str($counter) + \'_bamreads.bam\'#,$sample.peaks\n #end if\n #set $counter = $counter + 1\n-#end for\n-</configfile>\n+#end for]]></configfile>\n     </configfiles>\n     <inputs>\n         <repeat name="samples" title="Samples" min="2">\n@@ -64,62 +72,326 @@\n             <param name="factor" type="text" value="Factor Name" label="Specify a factor name" help="e.g. ER" />\n             <param name="condition" type="text" value="Condition" label="Specify the condition" help="e.g. Resistent" />\n             <param name="replicate" type="integer" value="1" label="Specify the replicate number" help="e.g. 1" />\n-            <param format="bam" name="bamreads" type="data" label="Read BAM file" help="Specify the Read BAM file, used for Peak calling."/>\n-            <param format="bam" name="bamcontrol" type="data" optional="True" label="Control BAM file" help="If specifying a control BAM file for this sample, then all samples are required to specify one."/>\n-            <param format="bed" name="peaks" type="data" label="Peak file" help="Result of your Peak calling experiment."/>\n+            <param name="bamreads" type="data" format="bam" label="Read BAM file" help="Specify the Read BAM file, used for Peak calling."/>\n+            <param name="bamcontrol" type="data" format="bam" optional="True" label="Control BAM file" help="If specifying a control BAM file for this sample, then all samples are required to specify one."/>\n+            <param name="peaks" type="data" format="bed" label="Peak file" help="Result of your Peak calling experiment."/>\n         </repeat>\n'..b' and reporting\n+\n \n-DiffBind_ Authors:  Rory Stark, Gordon Brown (2011)\n+ * **Reading in peaksets**: \n+\n+The first step is to read in a set of peaksets and associated\n+metadata. Peaksets are derived either from ChIP-Seq peak callers, such as MACS\n+([1]), or using some other criterion (e.g. genomic windows, or all the promoter regions\n+in a genome). The easiest way to read in peaksets is using a comma-separated value\n+(csv) sample sheet with one line for each peakset. (Spreadsheets in Excel\xc2\xae format, with\n+a .xls or .xlsx suffix, are also accepted.) A single experiment can have more than\n+one associated peakset; e.g. if multiple peak callers are used for comparison purposes\n+each sample would have more than one line in the sample sheet. Once the peaksets\n+are read in, a merging function finds all overlapping peaks and derives a single set of\n+unique genomic intervals covering all the supplied peaks (a consensus peakset for the\n+experiment).\n+\n+ * **Occupancy analysis**: \n+\n+Peaksets, especially those generated by peak callers, provide\n+an insight into the potential occupancy of the protein being ChIPed for at specific\n+genomic loci. After the peaksets have been loaded, it can be useful to perform some\n+exploratory plotting to determine how these occupancy maps agree with each other,\n+e.g. between experimental replicates (re-doing the ChIP under the same conditions),\n+between different peak callers on the same experiment, and within groups of samples\n+representing a common experimental condition. DiffBind provides functions to enable\n+overlaps to be examined, as well as functions to determine how well similar samples\n+cluster together. Beyond quality control, the product of an occupancy analysis may be\n+a consensus peakset, representing an overall set of candidate binding sites to be used\n+in further analysis.\n+\n+ * **Counting reads**: \n \n-.. _DiffBind: http://www.bioconductor.org/packages/release/bioc/html/DiffBind.html\n+Once a consensus peakset has been derived, DiffBind can use the\n+supplied sequence read files to count how many reads overlap each interval for each\n+unique sample. The peaks in the consensus peakset may be re-centered and trimmed\n+based on calculating their summits (point of greatest read overlap) in order to provide\n+more standardized peak intervals. The final result of counting is a binding affinity matrix\n+containing a (normalized) read count for each sample at every potential binding site.\n+With this matrix, the samples can be re-clustered using affinity, rather than occupancy,\n+data. The binding affinity matrix is used for QC plotting as well as for subsequent\n+differential analysis.\n+\n+ * **Differential binding affinity analysis**: \n \n+The core functionality of DiffBind is the\n+differential binding affinity analysis, which enables binding sites to be identified that\n+are statistically significantly differentially bound between sample groups. To accomplish\n+this, first a contrast (or contrasts) is established, dividing the samples into groups to\n+be compared. Next the core analysis routines are executed, by default using DESeq2 .\n+This will assign a p-value and FDR to each candidate binding site indicating confidence\n+that they are differentially bound.\n+\n+ * **Plotting and reporting**: \n+\n+Once one or more contrasts have been run, DiffBind provides\n+a number of functions for reporting and plotting the results. MA plots give an\n+overview of the results of the analysis, while correlation heatmaps and PCA plots show\n+how the groups cluster based on differentially bound sites. Boxplots show the distribution\n+of reads within differentially bound sites corresponding to whether they gain or\n+lose affinity between the two sample groups. A reporting mechanism enables differentially\n+bound sites to be extracted for further processing, such as annotation, motif, and\n+pathway analyses.\n+\n+**References**\n+\n+DiffBind Authors:  Rory Stark, Gordon Brown (2011)\n Wrapper authors: Bjoern Gruening, Pavankumar Videm\n \n ]]>\n'
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/BT474_ER_1.bam
b
Binary file test-data/BT474_ER_1.bam has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/BT474_ER_1.bed.gz
b
Binary file test-data/BT474_ER_1.bed.gz has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/BT474_ER_2.bam
b
Binary file test-data/BT474_ER_2.bam has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/BT474_ER_2.bed.gz
b
Binary file test-data/BT474_ER_2.bed.gz has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/MCF7_ER_1.bam
b
Binary file test-data/MCF7_ER_1.bam has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/MCF7_ER_1.bed.gz
b
Binary file test-data/MCF7_ER_1.bed.gz has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/MCF7_ER_2.bam
b
Binary file test-data/MCF7_ER_2.bam has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/MCF7_ER_2.bed.gz
b
Binary file test-data/MCF7_ER_2.bed.gz has changed
b
diff -r 6031247f61d4 -r 681dedc42aca test-data/out_binding.matrix
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out_binding.matrix Sun Jan 28 04:26:11 2018 -0500
b
b'@@ -0,0 +1,1394 @@\n+chr18\t111567\t112005\t29.4139375878664\t19.9594576489093\t137.615208000375\t59.878372946728\n+chr18\t189223\t189652\t11.5554754809475\t23.110950961895\t19.9594576489093\t12.6059732519427\n+chr18\t215232\t216063\t31.5149331298568\t72.4843461986707\t11.5554754809475\t15.7574665649284\n+chr18\t311530\t312172\t54.6258840917518\t43.0704086108043\t17.8584621069189\t11.5554754809475\n+chr18\t346464\t347342\t21.0099554199046\t16.8079643359236\t75.6358395116564\t40.9694130688139\n+chr18\t356560\t357362\t57.7773774047375\t53.5753863207566\t11.5554754809475\t14.7069687939332\n+chr18\t371110\t372102\t81.9388261376278\t82.989323908623\t8.40398216796182\t9.45447993895705\n+chr18\t394600\t396513\t510.541916703681\t438.05757050501\t56.7268796337423\t43.0704086108043\n+chr18\t399014\t400382\t558.864814169461\t496.885445680743\t156.524167878289\t117.655750351465\n+chr18\t498906\t500200\t196.443083176108\t181.736114382174\t767.913870597511\t278.381909313735\n+chr18\t503518\t504552\t194.342087634117\t231.10950961895\t99.7972882445466\t61.9793684887184\n+chr18\t531672\t532439\t57.7773774047375\t73.5348439696659\t44.1209063817996\t23.110950961895\n+chr18\t568036\t569332\t207.998558657055\t221.655029679993\t165.978647817246\t157.574665649284\n+chr18\t589046\t589875\t117.655750351466\t149.170683481322\t50.4238930077709\t72.4843461986707\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.05049777099523\t1.05049777099523\t1.05049777099523\n+chr18\t2191100\t2191859\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 6031247f61d4 -r 681dedc42aca test-data/out_diffbind.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out_diffbind.bed Sun Jan 28 04:26:11 2018 -0500
b
@@ -0,0 +1,5 @@
+chr18 394600 396513 1914 * 7.15 7.89 5.55 2.35 7.06e-24 9.84e-21
+chr18 111567 112005 439 * 5.71 3.63 6.53 -2.89 1.27e-08 8.88e-06
+chr18 346464 347342 879 * 5 3.24 5.77 -2.52 6.51e-06 0.00303
+chr18 399014 400382 1369 * 7.62 8.05 7 1.04 1.04e-05 0.00364
+chr18 371110 372102 993 * 4.63 5.36 3.07 2.3 8.1e-05 0.0226