changeset 0:fd3ea97a96bc draft

planemo upload commit 103cb51ec368438642504c3f98b76c363db478bb
author kyost
date Sat, 28 Apr 2018 15:07:26 -0400
parents
children 038420cc02e3
files ATAC_Primer_Tool.ga concatenate_ordered.bash concatenate_ordered.xml filter_bam.bash filter_bam.xml find_qPCR_regions.R find_qPCR_regions.xml make_window_bed.R make_window_bed.xml test-data/Ch1-1.pe.q10.sort.bam.rmdup.filter.bam test-data/Ch1-1.pe.q10.sort.bam.rmdup.filter.bam.bai test-data/Ch13-1.pe.q10.sort.rmdup.filter.bam test-data/RAMA_peaks.bed test-data/combined.f9.bed.coverage test-data/combined.f9.coverage test-data/combined.o.bed.coverage test-data/combined.o.coverage test-data/dataset_684.dat test-data/dataset_686.dat test-data/dataset_688.dat test-data/dataset_690.dat test-data/dataset_692.dat test-data/dataset_list test-data/dataset_list_ordered test-data/ext_peak test-data/lib_sizes.txt test-data/mm9.chrom.sizes.txt test-data/qPCR_regions.bed test-data/qPCR_windows.bed test-data/read_counts_ordered.txt test-data/test.bam test-data/test.bam.bai test-data/test.bed test-data/test.filter.bam test-data/test.readcounts.txt test-data/test_1.bam tool_dependencies.xml window_coverage.bash window_coverage.xml
diffstat 39 files changed, 1527 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ATAC_Primer_Tool.ga	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+{"uuid": "adf14070-f445-41b0-ba62-c9a96d71bae5", "tags": [], "format-version": "0.1", "name": "ATAC Primer Tool", "steps": {"0": {"tool_id": null, "tool_version": null, "outputs": [], "workflow_outputs": [{"output_name": "output", "uuid": "4a35572c-71e7-4459-8588-5f5934dfa525", "label": null}], "input_connections": {}, "tool_state": "{\"collection_type\": \"list\"}", "id": 0, "uuid": "2c0a2479-903a-46d6-af83-2fd16f0c4111", "errors": null, "name": "Input dataset collection", "label": "ATAC-seq bam files", "inputs": [], "position": {"top": 294, "left": 214}, "annotation": "", "content_id": null, "type": "data_collection_input"}, "1": {"tool_id": null, "tool_version": null, "outputs": [], "workflow_outputs": [{"output_name": "output", "uuid": "cb2d4088-fe8d-454b-aea3-118709f04e53", "label": null}], "input_connections": {}, "tool_state": "{}", "id": 1, "uuid": "0b108843-4679-4a27-b45c-2aeb734f4659", "errors": null, "name": "Input dataset", "label": "chrom.sizes", "inputs": [], "position": {"top": 449.5, "left": 198}, "annotation": "", "content_id": null, "type": "data_input"}, "2": {"tool_id": null, "tool_version": null, "outputs": [], "workflow_outputs": [{"output_name": "output", "uuid": "1a1ce0ab-0645-49c8-a41c-fce53509282d", "label": null}], "input_connections": {}, "tool_state": "{}", "id": 2, "uuid": "6c0d911c-ebb7-416e-ac79-8a5e003d7887", "errors": null, "name": "Input dataset", "label": "Peak bed file", "inputs": [], "position": {"top": 593, "left": 140.5}, "annotation": "", "content_id": null, "type": "data_input"}, "3": {"tool_id": "filter_bam", "tool_version": "0.1.0", "outputs": [{"type": "bed", "name": "output1"}, {"type": "bam", "name": "output2"}, {"type": "tabular", "name": "output3"}], "workflow_outputs": [], "input_connections": {"input2": {"output_name": "output", "id": 2}, "input3": {"output_name": "output", "id": 1}, "input1": {"output_name": "output", "id": 0}}, "tool_state": "{\"input2\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"input3\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"__rerun_remap_job_id__\": null, \"input1\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"__page__\": null}", "id": 3, "uuid": "cf3b0244-7460-4d59-a0ef-c74f3b1e0a41", "errors": null, "name": "Filter bam files", "post_job_actions": {"HideDatasetActionoutput3": {"output_name": "output3", "action_type": "HideDatasetAction", "action_arguments": {}}, "HideDatasetActionoutput2": {"output_name": "output2", "action_type": "HideDatasetAction", "action_arguments": {}}, "HideDatasetActionoutput1": {"output_name": "output1", "action_type": "HideDatasetAction", "action_arguments": {}}, "RenameDatasetActionoutput2": {"output_name": "output2", "action_type": "RenameDatasetAction", "action_arguments": {"newname": "#{input1 | basename}.filter.bam"}}}, "label": null, "inputs": [{"name": "input2", "description": "runtime parameter for tool Filter bam files"}, {"name": "input3", "description": "runtime parameter for tool Filter bam files"}, {"name": "input1", "description": "runtime parameter for tool Filter bam files"}], "position": {"top": 364.5, "left": 554}, "annotation": "", "content_id": "filter_bam", "type": "tool"}, "4": {"tool_id": "make_window_bed", "tool_version": "0.1.0", "outputs": [{"type": "bed", "name": "output"}], "workflow_outputs": [], "input_connections": {"input1": {"output_name": "output", "id": 2}}, "tool_state": "{\"input2\": \"\\\"100\\\"\", \"__page__\": null, \"input1\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"galaxy_input2\": \"\\\"100\\\"\", \"galaxy_input1\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"__rerun_remap_job_id__\": null}", "id": 4, "uuid": "bcd18c7c-9923-4f61-866a-65242eb0a3b2", "errors": null, "name": "Create bed file of qPCR windows", "post_job_actions": {"RenameDatasetActiongalaxy_output": {"output_name": "galaxy_output", "action_type": "RenameDatasetAction", "action_arguments": {"newname": "qPCR window bed file"}}, "HideDatasetActionoutput": {"output_name": "output", "action_type": "HideDatasetAction", "action_arguments": {}}}, "label": "Create bed file of qPCR windows", "inputs": [{"name": "input1", "description": "runtime parameter for tool Create bed file of qPCR windows"}], "position": {"top": 637.5, "left": 479.5}, "annotation": "", "content_id": "make_window_bed", "type": "tool"}, "5": {"tool_id": "concatenate_ordered", "tool_version": "0.1.0", "outputs": [{"type": "tabular", "name": "output1"}], "workflow_outputs": [], "input_connections": {"input1": {"output_name": "output3", "id": 3}}, "tool_state": "{\"__page__\": null, \"__rerun_remap_job_id__\": null, \"input1\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\"}", "id": 5, "uuid": "1aa966bb-d26e-4a42-ba94-13683bfe07d9", "errors": null, "name": "Concatenate Ordered Dataset Collection", "post_job_actions": {"HideDatasetActionoutput1": {"output_name": "output1", "action_type": "HideDatasetAction", "action_arguments": {}}, "RenameDatasetActionoutput1": {"output_name": "output1", "action_type": "RenameDatasetAction", "action_arguments": {"newname": "read_counts.txt"}}}, "label": null, "inputs": [{"name": "input1", "description": "runtime parameter for tool Concatenate Ordered Dataset Collection"}], "position": {"top": 387, "left": 866.5}, "annotation": "", "content_id": "concatenate_ordered", "type": "tool"}, "6": {"tool_id": "window_coverage", "tool_version": "0.1.0", "outputs": [{"type": "bed", "name": "output1"}, {"type": "bed", "name": "output2"}], "workflow_outputs": [], "input_connections": {"input2": {"output_name": "output", "id": 4}, "input1": {"output_name": "output2", "id": 3}}, "tool_state": "{\"input2\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"input3\": \"\\\"0.9\\\"\", \"__rerun_remap_job_id__\": null, \"input1\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"__page__\": null}", "id": 6, "uuid": "2edcc6f7-3942-481b-b81d-35cb7ddc04c6", "errors": null, "name": "Calculate window coverage", "post_job_actions": {"HideDatasetActionoutput2": {"output_name": "output2", "action_type": "HideDatasetAction", "action_arguments": {}}, "HideDatasetActionoutput1": {"output_name": "output1", "action_type": "HideDatasetAction", "action_arguments": {}}, "RenameDatasetActionoutput2": {"output_name": "output2", "action_type": "RenameDatasetAction", "action_arguments": {"newname": "Spanning fragment coverage bed file"}}, "RenameDatasetActionoutput1": {"output_name": "output1", "action_type": "RenameDatasetAction", "action_arguments": {"newname": "Coverage bed file"}}}, "label": null, "inputs": [{"name": "input2", "description": "runtime parameter for tool Calculate window coverage"}, {"name": "input1", "description": "runtime parameter for tool Calculate window coverage"}], "position": {"top": 654.5, "left": 895}, "annotation": "", "content_id": "window_coverage", "type": "tool"}, "7": {"tool_id": "find_qPCR_regions", "tool_version": "0.1.0", "outputs": [{"type": "bed", "name": "output"}], "workflow_outputs": [{"output_name": "galaxy_output", "uuid": "f600b360-070e-4575-ac5d-f04c91b39dd3", "label": null}, {"output_name": "output", "uuid": "fff2624f-b80a-41d7-9266-7f045dbeada7", "label": "ATAC qPCR regions"}], "input_connections": {"input2": {"output_name": "output2", "id": 6}, "input3": {"output_name": "output1", "id": 5}, "input1": {"output_name": "output1", "id": 6}}, "tool_state": "{\"input2\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"input3\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"input1\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"input4\": \"\\\"0.8\\\"\", \"__page__\": null, \"__rerun_remap_job_id__\": null, \"input5\": \"\\\"3\\\"\"}", "id": 7, "uuid": "24038597-f150-48f0-9d82-780c5a365649", "errors": null, "name": "Find ATAC qPCR regions", "post_job_actions": {"RenameDatasetActionoutput": {"output_name": "output", "action_type": "RenameDatasetAction", "action_arguments": {"newname": "ATAC qPCR regions"}}}, "label": "Find ATAC qPCR regions", "inputs": [{"name": "input2", "description": "runtime parameter for tool Find ATAC qPCR regions"}, {"name": "input3", "description": "runtime parameter for tool Find ATAC qPCR regions"}, {"name": "input1", "description": "runtime parameter for tool Find ATAC qPCR regions"}], "position": {"top": 521.5, "left": 1240.5}, "annotation": "", "content_id": "find_qPCR_regions", "type": "tool"}, "8": {"tool_id": "Extract genomic DNA 1", "tool_version": "2.2.3", "outputs": [{"type": "input", "name": "out_file1"}], "workflow_outputs": [{"output_name": "out_file1", "uuid": "b77e473a-edfd-41b2-b042-309282512b26", "label": "ATAC qPCR regions sequences"}], "input_connections": {"input": {"output_name": "output", "id": 7}}, "tool_state": "{\"out_format\": \"\\\"fasta\\\"\", \"interpret_features\": \"\\\"yes\\\"\", \"__page__\": null, \"__rerun_remap_job_id__\": null, \"seq_source\": \"{\\\"index_source\\\": \\\"cached\\\", \\\"__current_case__\\\": 0}\", \"input\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\"}", "id": 8, "uuid": "1cb77694-0165-4eba-a5d5-03cade8c8c60", "errors": null, "name": "Extract Genomic DNA", "post_job_actions": {"RenameDatasetActionout_file1": {"output_name": "out_file1", "action_type": "RenameDatasetAction", "action_arguments": {"newname": "ATAC qPCR regions DNA sequences"}}}, "label": "Extract DNA sequence for ATAC qPCR Regions", "inputs": [{"name": "input", "description": "runtime parameter for tool Extract Genomic DNA"}], "position": {"top": 534, "left": 1548}, "annotation": "", "content_id": "Extract genomic DNA 1", "type": "tool"}}, "annotation": "", "a_galaxy_workflow": "true"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/concatenate_ordered.bash	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+input1=$1
+output1=$2
+
+echo $input1 |tr , '\n' > input_series
+
+cat input_series | while read file
+do
+	cat $file >> count_list
+done
+
+sort -k1 count_list > sorted_list
+cut -f 2 sorted_list > $output1
+
+rm input_series
+rm count_list
+rm sorted_list
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/concatenate_ordered.xml	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,29 @@
+<tool id="concatenate_ordered" name="Concatenate Ordered Dataset Collection" version="0.1.0">
+    <description> Concatenates files in dataset collection based on orginial file name stored in first column.</description>
+    <requirements>
+    </requirements>
+    <stdio>
+        <exit_code range="1:" />
+    </stdio>
+    <command><![CDATA[
+		$__tool_directory__/./concatenate_ordered.bash "$input1" "$output1"
+    ]]></command>
+    <inputs>
+        <param type="data" name="input1" format="tabular" multiple="true" label="Read Counts Files"/>
+    </inputs>
+    <outputs>
+        <data name="output1" format="tabular" label="Read Counts"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input1" value="dataset_692.dat,dataset_684.dat,dataset_688.dat,dataset_686.dat,dataset_690.dat"/>
+            <output name="output1" file="read_counts_ordered.txt"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+        This tools takes a series of input files and concatenates the contents in order according to the alphabetical order of the first column of the input files containing the original file name.
+    ]]></help>
+    <citations>
+        <citation type="doi">doi:10.1038/nmeth.4663</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter_bam.bash	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,35 @@
+#Requires bam files and bed file containing coordinates of peaks of interest
+#Generates filtered bams and library size file to upload into Galaxy
+
+#required arguements:
+#($1): bam file
+#($2): bed file containing regions of interest
+
+#Usage: filter_bam /pathtofolder/ qPCR_peaks.bed
+
+#outputs:
+#Filtered bam files containing reads in regions of interest
+#read_counts: txt file containing number of mapped reads in each bam file, used for normalization
+
+bam_file=$1
+peak_file=$2
+chrom_sizes=$3
+ext_peak_file=$4
+filtered_bam_file=$5
+read_counts=$6
+name=$7
+
+bedtools slop -i $peak_file -g $chrom_sizes -b 2000 | sort -k1,1 -k2,2n - > $ext_peak_file
+
+samtools index $bam_file
+
+samtools view -c -F 1284 $bam_file > count
+echo $name > name
+paste name count > $read_counts
+
+#create bed file of fragments for each bam file
+
+samtools view -b -L $ext_peak_file $bam_file > $filtered_bam_file
+
+rm name
+rm count
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter_bam.xml	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,40 @@
+<tool id="filter_bam" name="Filter bam files" version="0.1.0">
+    <description> Filters bam files for reads in regions of interest.</description>
+    <requirements>
+        <requirement type="package" version="1.3">samtools</requirement>
+        <requirement type="package" version="2.27.0.0">bedtools</requirement>
+    </requirements>
+    <stdio>
+        <exit_code range="1:" />
+    </stdio>
+    <command><![CDATA[
+        #set input_name = str( $input1.name )
+        $__tool_directory__/./filter_bam.bash "$input1" "$input2" "$input3" "$output1" "$output2" "$output3" "$input_name"		
+    ]]></command>
+    <inputs>
+        <param type="data" name="input1" format="bam" label="Bam File"/>
+        <param type="data" name="input2" format="bed" label="Peak Bed File"/>
+        <param type="data" name="input3" format="tabular" label="chrom.sizes"/> 
+    </inputs>
+    <outputs>
+        <data name="output1" format="bed" label="Extended Peak File"/>
+        <data name="output2" format="bam" label="Filtered Bam File"/>
+        <data name="output3" format="tabular" label="Read Counts" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input1" value="test.bam"/>
+            <param name="input2" value="test.bed"/>
+            <param name="input3" value="mm9.chrom.sizes.txt"/>
+            <output name="output1" file="ext_peak"/>
+            <output name="output2" file="test.filter.bam"/>
+            <output name="output3" file="test.readcounts.txt"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+        This tools takes a bam file and filters to reads mapping to regions specified by input bed file.  Outputs include filtered bam file and count of total numbers of reads in original bam file.
+    ]]></help>
+    <citations>
+        <citation type="doi">doi:10.1038/nmeth.4663</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/find_qPCR_regions.R	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,121 @@
+## Command to run tool:
+# Rscript --vanilla find_qPCR_regions.R o.coverage.bed f9.coverage.bed lib_sizes.txt cor_cutoff cov_cutoff output_file
+
+# Set up R error handling to go to stderr
+options(show.error.messages=F, error=function(){cat(geterrmessage(),file=stderr());q("no",1,F)})
+
+# Avoid crashing Galaxy with an UTF8 error on German LC settings
+loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
+
+args <- commandArgs(TRUE)
+
+o.coverage <- args[1]
+f9.coverage <- args[2]
+lib_sizes <- args[3]
+corr_cutoff <- as.numeric(args[4])
+cov_cutoff <- as.numeric(args[5])
+output_file <- args[6]
+
+o.coverage.data <- read.delim(o.coverage, header=FALSE)
+f9.coverage.data <- read.delim(f9.coverage, header=FALSE)
+lib.sizes.data <- read.delim(lib_sizes, header=FALSE)
+
+m <- ncol(o.coverage.data)
+
+#normalize library sizes to 50 mil reads
+lib.sizes.data <- lib.sizes.data/50000000
+#normalize peak reads and spanning reads by library size
+o.coverage.data[,5:m] <- t(apply(o.coverage.data[,5:m], 1, function(x) x/t(lib.sizes.data)))
+f9.coverage.data[,5:m] <- t(apply(f9.coverage.data[,5:m], 1, function(x) x/t(lib.sizes.data)))
+
+#returns list of dataframes containing windows for each peak
+split_coverage <- function(a) {
+  returnlist <- list()
+  temp <- a[1,]
+  for (i in 2:nrow(a)) {
+    if (temp[1,4] == strsplit(as.character(a[i,4]),"_window")[[1]][1]){
+      temp <- rbind(temp, a[i,])
+    }else{
+      returnlist[[length(returnlist)+1]] <- temp
+      temp <- a[i,]
+    }
+  }
+  returnlist[[length(returnlist)+1]] <- temp
+  return(returnlist)
+}
+
+make_cor_plot <- function(a,b, corr_cut, cov_cut, output_file) { #a=o.coverage b=f9.coverage
+  
+  asplit <- split_coverage(a)
+  bsplit <- split_coverage(b)
+  
+  combined_regions <- data.frame()
+
+  for (i in 1:length(asplit)){
+    n <- nrow(asplit[[i]])-1
+    m <- ncol(asplit[[i]])
+	
+	a_split <- asplit[[i]]
+	b_split <- bsplit[[i]]
+
+	#calculate correlation between total peak reads and spanning reads in each window
+    corb <- data.frame(cor(t(a_split[1,5:m])
+                           , t(b_split[-1,5:m])
+						   , method = "pearson"))
+    
+    data <- data.frame(t(corb), row.names = NULL, stringsAsFactors = FALSE)
+    
+    data <- cbind(rep(c(1:n))
+                  , a_split[-1,1:4]
+                  , data)
+    colnames(data)<-c("position","chr", "start", "stop", "name", "correlation")
+    rownames(data)<-NULL
+    a_split$average <- rowMeans(a_split[,5:m])
+    b_split$average <- rowMeans(b_split[,5:m])
+    data2 <- data.frame(cbind(c(1:n), a_split[-1,m+1]), stringsAsFactors=FALSE)
+    data3 <- data.frame(cbind(c(1:n), b_split[-1,m+1]), stringsAsFactors=FALSE)
+    colnames(data2)<-c("position","averageReadDepth")
+    colnames(data3)<-c("position","averageReadDepth")
+    
+	#keep windows for which correlation with total peak reads is above threshold and 
+	#number of spanning reads is above cutoff
+    regions <- data[which(data$correlation > corr_cut & data3$averageReadDepth > cov_cut),]
+    regions <- regions[,2:4]
+	
+	#collapse windows to non-overlappin regions
+    if (nrow(regions)>0){
+                regions$V4 <- paste(as.character(a_split[1,4]),"_region1",sep="")
+    collapsed_regions <- regions[1,]
+    nregion <- 1
+    if (nrow(regions)>=2){
+		for (j in 2:nrow(regions)) {
+			if (as.numeric(regions[j,2]) <= (as.numeric(regions[j-1,3]))) {
+				collapsed_regions[nrow(collapsed_regions),3] <- regions[j,3]
+			}else{
+				collapsed_regions <- rbind(collapsed_regions, regions[j,])
+				nregion <- nregion + 1
+				collapsed_regions[nrow(collapsed_regions),4] <- paste(as.character(a_split[1,4])
+																	,"_region"
+																	, as.character(nregion)
+																	,sep="")	
+			}
+		}
+	}	
+	rownames(collapsed_regions) <- NULL
+		
+	combined_regions <- rbind(combined_regions, collapsed_regions)
+}
+    
+
+ }
+  
+  write.table(combined_regions
+              , output_file
+              , sep = "\t"
+              , col.names = FALSE
+              , row.names = FALSE
+              , quote = FALSE)	
+  print("Successfully found optimal ATAC-qPCR regions.")		  
+}
+
+make_cor_plot(o.coverage.data, f9.coverage.data, corr_cutoff, cov_cutoff, output_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/find_qPCR_regions.xml	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,35 @@
+<tool id="find_qPCR_regions" name="Find ATAC qPCR regions" version="0.1.0">
+    <description> Determines optimal regions for designing ATAC-qPCR primers.</description>
+    <requirements>
+        <requirement type="package" version="3.4.2" >r-base</requirement>
+    </requirements>
+    <command><![CDATA[
+        Rscript --vanilla $__tool_directory__/find_qPCR_regions.R $input1 $input2 $input3 $input4 $input5 $output
+    ]]></command>
+    <inputs>
+        <param type="data" name="input1" format="tabular" label="Coverage Bed File"/>
+        <param type="data" name="input2" format="tabular" label="Spanning Fragment Coverage Bed File"/>
+        <param type="data" name="input3" format="tabular" label="Total Read Counts"/>
+        <param type="float" name="input4" value="0.8" label="Correlation Cutoff"/>
+        <param type="integer" name="input5" value="3" label="Coverage Cutoff"/>
+    </inputs>
+    <outputs>
+	<data name="output" format="bed" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input1" value="combined.o.bed.coverage"/>
+            <param name="input2" value="combined.f9.bed.coverage"/>
+            <param name="input3" value="lib_sizes.txt"/>
+            <param name="input4" value="0.7"/>
+            <param name="input5" value="2"/>
+            <output name="output" file="qPCR_regions.bed"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+        Determines optimal regions for designing ATAC-qPCR primers based on correlation between spanning fragments and total peak height. 
+    ]]></help>
+    <citations>
+        <citation type="doi">doi:10.1038/nmeth.4663</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make_window_bed.R	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,64 @@
+## Command to run tool:
+# Rscript --vanilla make_window_bed.R qPCR_peaks.bed window_size output_file
+
+# Set up R error handling to go to stderr
+options(show.error.messages=F, error=function(){cat(geterrmessage(),file=stderr());q("no",1,F)})
+
+# Avoid crashing Galaxy with an UTF8 error on German LC settings
+loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
+
+args <- commandArgs(TRUE)
+
+qPCR_bed <- args[1]
+window_size <- strtoi(args[2])
+output_file <- args[3]
+
+qPCR_table <- read.delim(qPCR_bed, header=FALSE, stringsAsFactors=FALSE)
+
+make_windows_bed <- function(a, size) { #a is a bed file containing peaks of interest and coordinates
+  #generates bed file with overlapping windows spanning each peak of specified size
+  return_bed <- data.frame()
+  for (i in 1:nrow(a)) {
+    line <- data.frame(a[i,],stringsAsFactors=FALSE)
+    peak_name <- as.character(line[1,4])
+    line <- rbind(line
+                  , data.frame(V1=as.character(line[1,1])
+                               , V2=line[1,2]
+                               , V3=line[1,2]+size
+                               , V4=as.character(paste(as.character(line[1,4])
+                                                       , "_window1"
+                                                       , sep = "")
+                               )
+                  )
+    )
+    count <- as.numeric(line[1,2])+size
+    nline <- 2
+    while (count < as.numeric(line[1,3])) {
+      line <- rbind(line
+					, data.frame(V1=as.character(line[nline,1])
+								, V2=line[nline,2]+floor(size/4)
+								, V3=line[nline,2]+floor(size/4)+size
+								, V4=as.character(paste(as.character(line[1,4])
+												 , "_window"
+												 , as.character(nline)
+												 , sep = "")
+												 )
+								)
+                    )
+      nline <- nline + 1
+      count <- as.numeric(line[nline,3])
+    }
+    return_bed <- rbind(return_bed,line)
+  }
+  return(return_bed)
+}
+
+output <- make_windows_bed(qPCR_table, window_size)
+
+
+write.table(output
+            , output_file
+            , sep = "\t"
+			, col.names = FALSE
+			, row.names = FALSE
+            , quote = FALSE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make_window_bed.xml	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,29 @@
+<tool id="make_window_bed" name="Create bed file of qPCR windows" version="0.1.0">
+    <description> Creates bed file of windows spanning peaks of interest.</description>
+        <requirements>
+            <requirement type="package" version="3.4.2">r-base</requirement>
+    </requirements>
+    <command><![CDATA[
+        Rscript --vanilla $__tool_directory__/make_window_bed.R $input1 $input2 $output
+    ]]></command>
+    <inputs>
+        <param type="data" name="input1" format="bed" label="Peak Bed File"/>
+        <param type="integer" name="input2" value="100" label="Window Size"/>
+    </inputs>
+    <outputs>
+	<data name="output" format="bed" label="qPCR Window Bed File"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input1" value="RAMA_peaks.bed"/>
+            <param name="input2" value="100"/>
+            <output name="output" file="qPCR_windows.bed"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+        Generates bed file containing overlapping windows of specified size spanning peaks in input bed file. 
+    ]]></help>
+    <citations>
+        <citation type="doi">doi:10.1038/nmeth.4663</citation>
+    </citations>
+</tool>
Binary file test-data/Ch1-1.pe.q10.sort.bam.rmdup.filter.bam has changed
Binary file test-data/Ch1-1.pe.q10.sort.bam.rmdup.filter.bam.bai has changed
Binary file test-data/Ch13-1.pe.q10.sort.rmdup.filter.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/RAMA_peaks.bed	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,7 @@
+chr15	95484290	95485433	Dbx2
+chr10	20444676	20445116	Pde7b
+chr18	58715130	58715849	Slc27a6
+chr2	32816762	32817713	Rpl12
+chr9	106331200	106332399	Rpl29
+chr2	153116826	153117777	Kif3b
+chr1	133049497	133050192	Eif2d
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/combined.f9.bed.coverage	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,125 @@
+chr15	95484290	95485433	Dbx2	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+chr15	95484290	95484390	Dbx2_window1	0	2	7	0	5	1	0	1	2	1	0	0	0	1	0	0
+chr15	95484340	95484440	Dbx2_window2	0	3	12	2	4	2	0	1	0	1	1	1	0	1	1	2
+chr15	95484390	95484490	Dbx2_window3	0	1	11	3	5	1	1	0	1	2	1	3	1	1	1	2
+chr15	95484440	95484540	Dbx2_window4	0	1	9	2	4	1	1	0	2	2	0	4	1	1	2	2
+chr15	95484490	95484590	Dbx2_window5	0	0	7	2	4	1	0	0	4	1	0	3	1	3	2	2
+chr15	95484540	95484640	Dbx2_window6	0	5	15	2	3	2	0	0	7	0	2	5	1	2	2	3
+chr15	95484590	95484690	Dbx2_window7	1	8	16	2	2	2	0	0	9	3	4	4	1	0	1	3
+chr15	95484640	95484740	Dbx2_window8	1	8	15	0	1	1	0	0	9	3	4	4	1	0	1	1
+chr15	95484690	95484790	Dbx2_window9	1	6	16	2	3	1	0	0	6	3	4	4	3	1	0	1
+chr15	95484740	95484840	Dbx2_window10	1	8	19	5	5	1	0	0	6	3	4	4	2	2	1	1
+chr15	95484790	95484890	Dbx2_window11	2	13	33	6	3	0	0	0	7	5	7	9	5	5	2	3
+chr15	95484840	95484940	Dbx2_window12	1	20	32	9	1	0	0	0	9	5	8	10	5	6	3	4
+chr15	95484890	95484990	Dbx2_window13	1	14	27	8	2	0	0	0	7	4	11	8	4	9	4	5
+chr15	95484940	95485040	Dbx2_window14	1	12	21	10	2	0	1	0	9	4	9	6	5	7	3	6
+chr15	95484990	95485090	Dbx2_window15	0	9	27	8	3	0	1	0	11	7	6	7	7	7	2	4
+chr15	95485040	95485140	Dbx2_window16	0	9	30	7	4	0	1	0	7	6	6	8	7	6	1	2
+chr15	95485090	95485190	Dbx2_window17	0	11	31	8	2	1	1	0	6	5	8	7	7	5	0	2
+chr15	95485140	95485240	Dbx2_window18	0	10	24	6	5	1	0	0	5	8	6	7	5	1	1	2
+chr15	95485190	95485290	Dbx2_window19	2	5	19	4	5	1	0	0	2	6	9	4	6	1	1	3
+chr15	95485240	95485340	Dbx2_window20	1	5	7	1	1	0	0	0	1	4	7	4	3	0	0	1
+chr15	95485290	95485390	Dbx2_window21	0	2	3	1	0	0	0	0	1	1	4	4	2	0	0	0
+chr15	95485340	95485440	Dbx2_window22	0	2	1	1	0	1	0	0	1	0	4	2	2	0	0	0
+chr10	20444676	20445116	Pde7b	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+chr10	20444676	20444776	Pde7b_window1	2	6	10	2	1	1	0	1	5	7	5	6	3	2	2	0
+chr10	20444726	20444826	Pde7b_window2	5	8	12	1	1	2	0	2	4	7	4	4	4	1	1	1
+chr10	20444776	20444876	Pde7b_window3	1	7	8	0	0	1	1	1	2	3	3	0	2	0	1	1
+chr10	20444826	20444926	Pde7b_window4	1	7	16	1	4	1	3	1	5	3	4	5	3	2	3	0
+chr10	20444876	20444976	Pde7b_window5	4	3	17	1	2	1	2	0	7	5	4	4	2	1	1	0
+chr10	20444926	20445026	Pde7b_window6	3	6	15	1	2	1	3	0	6	2	5	1	4	2	0	1
+chr10	20444976	20445076	Pde7b_window7	0	4	7	1	1	0	1	0	2	1	3	0	1	0	0	0
+chr10	20445026	20445126	Pde7b_window8	0	2	3	1	0	0	1	0	1	1	3	0	0	0	0	0
+chr18	58715130	58715849	Slc27a6	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+chr18	58715130	58715230	Slc27a6_window1	0	3	2	1	2	2	1	1	1	2	4	1	1	1	2	0
+chr18	58715180	58715280	Slc27a6_window2	0	3	3	2	2	3	1	2	4	3	8	2	4	1	1	0
+chr18	58715230	58715330	Slc27a6_window3	1	7	10	2	3	2	1	1	5	6	10	4	7	3	4	2
+chr18	58715280	58715380	Slc27a6_window4	1	9	13	2	3	7	1	3	9	9	14	8	11	5	7	0
+chr18	58715330	58715430	Slc27a6_window5	0	7	16	2	2	4	1	4	9	8	13	11	10	6	3	3
+chr18	58715380	58715480	Slc27a6_window6	0	13	19	3	1	6	2	4	12	8	11	10	7	8	3	4
+chr18	58715430	58715530	Slc27a6_window7	0	15	9	0	1	7	4	5	14	7	9	8	2	5	1	4
+chr18	58715480	58715580	Slc27a6_window8	1	11	11	1	2	6	3	7	11	9	7	7	2	2	0	4
+chr18	58715530	58715630	Slc27a6_window9	1	12	9	3	1	4	3	5	9	10	8	10	4	4	0	5
+chr18	58715580	58715680	Slc27a6_window10	0	9	6	4	1	5	1	4	8	9	8	7	3	2	0	4
+chr18	58715630	58715730	Slc27a6_window11	0	7	8	3	0	4	1	3	7	9	7	7	2	2	0	3
+chr18	58715680	58715780	Slc27a6_window12	1	3	6	1	0	2	2	2	6	6	1	4	2	1	0	0
+chr18	58715730	58715830	Slc27a6_window13	1	1	1	0	0	0	1	0	5	2	3	2	0	0	0	0
+chr18	58715780	58715880	Slc27a6_window14	1	0	1	0	2	0	1	0	6	3	3	1	0	0	0	0
+chr2	32816762	32817713	Rpl12	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+chr2	32816762	32816862	Rpl12_window1	0	6	1	0	3	2	3	0	3	1	2	2	0	0	0	0
+chr2	32816812	32816912	Rpl12_window2	0	3	1	0	1	3	3	0	7	2	1	2	0	0	0	0
+chr2	32816862	32816962	Rpl12_window3	0	2	2	2	0	4	4	1	6	3	1	2	0	0	0	0
+chr2	32816912	32817012	Rpl12_window4	1	8	11	3	1	9	5	1	10	6	2	4	3	1	0	1
+chr2	32816962	32817062	Rpl12_window5	3	25	24	3	5	12	7	3	17	8	11	8	6	1	0	2
+chr2	32817012	32817112	Rpl12_window6	3	26	22	4	6	13	7	4	14	8	13	8	6	0	2	2
+chr2	32817062	32817162	Rpl12_window7	1	10	18	5	2	4	3	3	8	1	7	8	4	1	2	0
+chr2	32817112	32817212	Rpl12_window8	1	20	18	5	2	7	4	1	7	4	7	10	5	2	3	0
+chr2	32817162	32817262	Rpl12_window9	4	24	24	7	7	8	10	5	11	12	8	11	3	3	3	2
+chr2	32817212	32817312	Rpl12_window10	2	20	15	4	8	8	9	5	14	9	9	10	3	3	1	1
+chr2	32817262	32817362	Rpl12_window11	2	19	21	3	4	15	8	5	19	9	13	11	4	6	1	3
+chr2	32817312	32817412	Rpl12_window12	1	22	18	3	5	13	9	6	21	10	13	11	4	4	2	4
+chr2	32817362	32817462	Rpl12_window13	1	15	10	2	3	8	5	3	9	7	7	7	2	3	1	3
+chr2	32817412	32817512	Rpl12_window14	0	10	5	0	1	6	2	1	6	4	4	3	2	2	1	2
+chr2	32817462	32817562	Rpl12_window15	1	11	6	0	2	6	4	1	7	5	4	4	2	3	2	1
+chr2	32817512	32817612	Rpl12_window16	2	9	6	1	1	4	5	0	6	7	1	5	2	4	2	0
+chr2	32817562	32817662	Rpl12_window17	2	9	8	1	2	2	5	1	7	6	1	5	2	2	1	0
+chr2	32817612	32817712	Rpl12_window18	2	5	7	1	2	2	4	1	4	4	1	4	1	2	0	0
+chr2	32817662	32817762	Rpl12_window19	2	6	8	0	0	1	2	1	3	3	2	2	0	3	0	0
+chr9	106331200	106332399	Rpl29	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+chr9	106331200	106331300	Rpl29_window1	1	4	5	3	0	3	3	1	7	6	2	3	1	1	0	0
+chr9	106331250	106331350	Rpl29_window2	1	5	6	2	2	4	6	0	6	5	3	2	2	0	0	0
+chr9	106331300	106331400	Rpl29_window3	1	8	5	1	1	2	7	2	9	5	6	3	1	0	0	0
+chr9	106331350	106331450	Rpl29_window4	2	8	7	1	2	5	9	4	13	9	7	3	2	0	0	0
+chr9	106331400	106331500	Rpl29_window5	1	8	11	2	2	7	7	5	17	9	6	5	4	1	0	0
+chr9	106331450	106331550	Rpl29_window6	3	8	18	2	3	10	10	4	18	10	7	7	5	2	0	1
+chr9	106331500	106331600	Rpl29_window7	5	8	24	3	2	15	11	2	16	9	8	7	5	2	0	2
+chr9	106331550	106331650	Rpl29_window8	4	5	23	4	1	13	9	3	13	9	7	5	4	4	0	2
+chr9	106331600	106331700	Rpl29_window9	2	4	14	5	2	9	5	3	6	5	5	7	2	2	0	2
+chr9	106331650	106331750	Rpl29_window10	2	33	46	11	7	12	6	5	6	9	8	9	7	4	1	2
+chr9	106331700	106331800	Rpl29_window11	5	29	31	8	6	15	3	4	9	10	9	9	6	8	1	4
+chr9	106331750	106331850	Rpl29_window12	5	30	37	3	3	13	6	4	13	11	11	13	4	9	1	2
+chr9	106331800	106331900	Rpl29_window13	3	18	27	2	4	12	6	5	5	8	11	12	4	8	1	3
+chr9	106331850	106331950	Rpl29_window14	1	12	23	2	3	12	7	4	7	11	12	6	5	6	1	2
+chr9	106331900	106332000	Rpl29_window15	0	13	27	3	6	11	9	3	9	14	15	8	3	5	1	2
+chr9	106331950	106332050	Rpl29_window16	1	10	22	2	3	10	8	0	10	13	13	9	3	6	1	2
+chr9	106332000	106332100	Rpl29_window17	3	9	16	0	4	8	5	0	10	9	13	6	2	5	0	1
+chr9	106332050	106332150	Rpl29_window18	1	3	10	0	4	6	8	1	12	6	9	6	4	1	0	1
+chr9	106332100	106332200	Rpl29_window19	1	4	10	1	4	6	9	1	11	7	9	7	5	2	0	1
+chr9	106332150	106332250	Rpl29_window20	0	3	6	4	4	6	7	1	10	6	7	6	3	2	0	1
+chr9	106332200	106332300	Rpl29_window21	0	1	0	2	3	3	4	1	4	3	2	1	2	1	0	0
+chr9	106332250	106332350	Rpl29_window22	0	0	2	2	2	2	5	2	6	2	2	1	3	1	0	0
+chr9	106332300	106332400	Rpl29_window23	0	0	2	2	1	1	5	2	3	0	2	2	2	0	0	0
+chr2	153116826	153117777	Kif3b	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+chr2	153116826	153116926	Kif3b_window1	1	1	5	1	1	6	5	0	10	1	5	1	1	1	0	0
+chr2	153116876	153116976	Kif3b_window2	2	6	14	3	4	13	5	2	14	2	7	2	1	1	0	0
+chr2	153116926	153117026	Kif3b_window3	1	7	18	2	3	12	6	1	12	3	6	4	1	2	0	0
+chr2	153116976	153117076	Kif3b_window4	0	7	14	1	3	9	5	1	8	3	3	2	1	2	0	0
+chr2	153117026	153117126	Kif3b_window5	1	7	14	7	9	9	7	3	9	4	6	6	3	3	0	0
+chr2	153117076	153117176	Kif3b_window6	2	14	24	6	7	6	12	1	7	6	10	9	4	2	0	1
+chr2	153117126	153117226	Kif3b_window7	0	7	12	2	3	5	8	2	3	4	6	7	2	4	1	1
+chr2	153117176	153117276	Kif3b_window8	3	20	22	5	7	12	9	5	7	9	9	7	7	6	1	5
+chr2	153117226	153117326	Kif3b_window9	4	24	22	6	9	12	10	6	11	9	9	10	9	6	1	3
+chr2	153117276	153117376	Kif3b_window10	4	23	25	4	10	12	9	5	13	7	8	7	8	5	1	3
+chr2	153117326	153117426	Kif3b_window11	2	15	21	4	9	8	7	2	13	5	8	6	4	3	2	2
+chr2	153117376	153117476	Kif3b_window12	1	17	19	4	7	8	10	2	13	5	9	6	5	2	3	2
+chr2	153117426	153117526	Kif3b_window13	1	16	17	5	6	8	8	2	9	5	9	4	4	3	3	1
+chr2	153117476	153117576	Kif3b_window14	3	7	10	3	6	4	5	1	7	2	6	1	1	1	1	0
+chr2	153117526	153117626	Kif3b_window15	3	3	8	1	5	2	4	1	7	2	2	2	1	2	0	2
+chr2	153117576	153117676	Kif3b_window16	1	4	5	0	5	2	4	0	4	1	6	3	2	1	0	1
+chr2	153117626	153117726	Kif3b_window17	0	3	3	0	2	3	1	0	3	1	5	2	2	1	0	1
+chr2	153117676	153117776	Kif3b_window18	0	1	2	0	3	1	0	0	3	0	2	2	1	1	0	0
+chr2	153117726	153117826	Kif3b_window19	1	2	3	1	2	0	0	0	4	1	2	2	1	1	0	0
+chr1	133049497	133050192	Eif2d	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+chr1	133049497	133049597	Eif2d_window1	0	3	2	3	1	4	3	1	9	1	2	1	3	1	0	0
+chr1	133049547	133049647	Eif2d_window2	1	9	5	4	2	7	3	1	10	2	2	2	4	0	0	1
+chr1	133049597	133049697	Eif2d_window3	1	14	6	2	3	6	4	1	9	2	1	3	4	0	0	1
+chr1	133049647	133049747	Eif2d_window4	1	11	6	3	0	3	4	0	4	0	0	3	2	0	0	1
+chr1	133049697	133049797	Eif2d_window5	14	36	42	10	6	4	11	5	7	2	4	4	7	0	0	1
+chr1	133049747	133049847	Eif2d_window6	6	24	18	7	4	6	10	4	6	5	6	5	4	2	1	1
+chr1	133049797	133049897	Eif2d_window7	5	19	26	4	5	9	9	4	8	6	7	7	5	2	2	0
+chr1	133049847	133049947	Eif2d_window8	5	16	32	4	7	7	12	4	9	5	6	7	5	2	1	0
+chr1	133049897	133049997	Eif2d_window9	4	13	31	3	7	5	12	2	6	3	4	5	4	1	1	0
+chr1	133049947	133050047	Eif2d_window10	2	6	19	3	4	4	9	1	4	2	1	5	3	0	0	0
+chr1	133049997	133050097	Eif2d_window11	1	4	8	2	0	4	6	0	2	3	1	3	1	0	0	0
+chr1	133050047	133050147	Eif2d_window12	1	3	9	1	1	2	5	0	2	3	1	2	2	0	0	0
+chr1	133050097	133050197	Eif2d_window13	0	2	4	1	2	1	3	0	3	2	1	1	1	0	0	0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/combined.f9.coverage	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,233 @@
+chr15	95484290	95485433	Dbx2	0	0
+chr15	95484290	95484390	Dbx2_window1	0	2
+chr15	95484315	95484415	Dbx2_window2	0	2
+chr15	95484340	95484440	Dbx2_window3	0	3
+chr15	95484365	95484465	Dbx2_window4	0	3
+chr15	95484390	95484490	Dbx2_window5	0	1
+chr15	95484415	95484515	Dbx2_window6	0	1
+chr15	95484440	95484540	Dbx2_window7	0	1
+chr15	95484465	95484565	Dbx2_window8	0	0
+chr15	95484490	95484590	Dbx2_window9	0	0
+chr15	95484515	95484615	Dbx2_window10	0	2
+chr15	95484540	95484640	Dbx2_window11	0	5
+chr15	95484565	95484665	Dbx2_window12	1	6
+chr15	95484590	95484690	Dbx2_window13	1	8
+chr15	95484615	95484715	Dbx2_window14	1	9
+chr15	95484640	95484740	Dbx2_window15	1	8
+chr15	95484665	95484765	Dbx2_window16	1	6
+chr15	95484690	95484790	Dbx2_window17	1	6
+chr15	95484715	95484815	Dbx2_window18	1	6
+chr15	95484740	95484840	Dbx2_window19	1	8
+chr15	95484765	95484865	Dbx2_window20	1	11
+chr15	95484790	95484890	Dbx2_window21	2	13
+chr15	95484815	95484915	Dbx2_window22	1	17
+chr15	95484840	95484940	Dbx2_window23	1	20
+chr15	95484865	95484965	Dbx2_window24	1	19
+chr15	95484890	95484990	Dbx2_window25	1	14
+chr15	95484915	95485015	Dbx2_window26	0	14
+chr15	95484940	95485040	Dbx2_window27	1	12
+chr15	95484965	95485065	Dbx2_window28	1	9
+chr15	95484990	95485090	Dbx2_window29	0	9
+chr15	95485015	95485115	Dbx2_window30	0	9
+chr15	95485040	95485140	Dbx2_window31	0	9
+chr15	95485065	95485165	Dbx2_window32	0	10
+chr15	95485090	95485190	Dbx2_window33	0	11
+chr15	95485115	95485215	Dbx2_window34	0	7
+chr15	95485140	95485240	Dbx2_window35	0	10
+chr15	95485165	95485265	Dbx2_window36	1	9
+chr15	95485190	95485290	Dbx2_window37	2	5
+chr15	95485215	95485315	Dbx2_window38	1	4
+chr15	95485240	95485340	Dbx2_window39	1	5
+chr15	95485265	95485365	Dbx2_window40	0	5
+chr15	95485290	95485390	Dbx2_window41	0	2
+chr15	95485315	95485415	Dbx2_window42	0	2
+chr15	95485340	95485440	Dbx2_window43	0	2
+chr10	20444676	20445116	Pde7b	0	0
+chr10	20444676	20444776	Pde7b_window1	2	6
+chr10	20444701	20444801	Pde7b_window2	3	5
+chr10	20444726	20444826	Pde7b_window3	5	8
+chr10	20444751	20444851	Pde7b_window4	1	6
+chr10	20444776	20444876	Pde7b_window5	1	7
+chr10	20444801	20444901	Pde7b_window6	1	6
+chr10	20444826	20444926	Pde7b_window7	1	7
+chr10	20444851	20444951	Pde7b_window8	1	11
+chr10	20444876	20444976	Pde7b_window9	4	3
+chr10	20444901	20445001	Pde7b_window10	3	5
+chr10	20444926	20445026	Pde7b_window11	3	6
+chr10	20444951	20445051	Pde7b_window12	2	6
+chr10	20444976	20445076	Pde7b_window13	0	4
+chr10	20445001	20445101	Pde7b_window14	0	4
+chr10	20445026	20445126	Pde7b_window15	0	2
+chr18	58715130	58715849	Slc27a6	0	0
+chr18	58715130	58715230	Slc27a6_window1	0	3
+chr18	58715155	58715255	Slc27a6_window2	0	2
+chr18	58715180	58715280	Slc27a6_window3	0	3
+chr18	58715205	58715305	Slc27a6_window4	1	5
+chr18	58715230	58715330	Slc27a6_window5	1	7
+chr18	58715255	58715355	Slc27a6_window6	1	7
+chr18	58715280	58715380	Slc27a6_window7	1	9
+chr18	58715305	58715405	Slc27a6_window8	1	7
+chr18	58715330	58715430	Slc27a6_window9	0	7
+chr18	58715355	58715455	Slc27a6_window10	0	10
+chr18	58715380	58715480	Slc27a6_window11	0	13
+chr18	58715405	58715505	Slc27a6_window12	0	20
+chr18	58715430	58715530	Slc27a6_window13	0	15
+chr18	58715455	58715555	Slc27a6_window14	0	11
+chr18	58715480	58715580	Slc27a6_window15	1	11
+chr18	58715505	58715605	Slc27a6_window16	1	13
+chr18	58715530	58715630	Slc27a6_window17	1	12
+chr18	58715555	58715655	Slc27a6_window18	1	11
+chr18	58715580	58715680	Slc27a6_window19	0	9
+chr18	58715605	58715705	Slc27a6_window20	0	9
+chr18	58715630	58715730	Slc27a6_window21	0	7
+chr18	58715655	58715755	Slc27a6_window22	0	4
+chr18	58715680	58715780	Slc27a6_window23	1	3
+chr18	58715705	58715805	Slc27a6_window24	1	0
+chr18	58715730	58715830	Slc27a6_window25	1	1
+chr18	58715755	58715855	Slc27a6_window26	1	0
+chr2	32816762	32817713	Rpl12	0	0
+chr2	32816762	32816862	Rpl12_window1	0	6
+chr2	32816787	32816887	Rpl12_window2	0	5
+chr2	32816812	32816912	Rpl12_window3	0	3
+chr2	32816837	32816937	Rpl12_window4	0	2
+chr2	32816862	32816962	Rpl12_window5	0	2
+chr2	32816887	32816987	Rpl12_window6	1	1
+chr2	32816912	32817012	Rpl12_window7	1	8
+chr2	32816937	32817037	Rpl12_window8	3	14
+chr2	32816962	32817062	Rpl12_window9	3	25
+chr2	32816987	32817087	Rpl12_window10	3	26
+chr2	32817012	32817112	Rpl12_window11	3	26
+chr2	32817037	32817137	Rpl12_window12	3	22
+chr2	32817062	32817162	Rpl12_window13	1	10
+chr2	32817087	32817187	Rpl12_window14	1	13
+chr2	32817112	32817212	Rpl12_window15	1	20
+chr2	32817137	32817237	Rpl12_window16	4	20
+chr2	32817162	32817262	Rpl12_window17	4	24
+chr2	32817187	32817287	Rpl12_window18	2	18
+chr2	32817212	32817312	Rpl12_window19	2	20
+chr2	32817237	32817337	Rpl12_window20	1	17
+chr2	32817262	32817362	Rpl12_window21	2	19
+chr2	32817287	32817387	Rpl12_window22	1	20
+chr2	32817312	32817412	Rpl12_window23	1	22
+chr2	32817337	32817437	Rpl12_window24	1	18
+chr2	32817362	32817462	Rpl12_window25	1	15
+chr2	32817387	32817487	Rpl12_window26	2	14
+chr2	32817412	32817512	Rpl12_window27	0	10
+chr2	32817437	32817537	Rpl12_window28	1	11
+chr2	32817462	32817562	Rpl12_window29	1	11
+chr2	32817487	32817587	Rpl12_window30	1	11
+chr2	32817512	32817612	Rpl12_window31	2	9
+chr2	32817537	32817637	Rpl12_window32	2	8
+chr2	32817562	32817662	Rpl12_window33	2	9
+chr2	32817587	32817687	Rpl12_window34	2	7
+chr2	32817612	32817712	Rpl12_window35	2	5
+chr2	32817637	32817737	Rpl12_window36	2	6
+chr9	106331200	106332399	Rpl29	0	0
+chr9	106331200	106331300	Rpl29_window1	1	4
+chr9	106331225	106331325	Rpl29_window2	1	5
+chr9	106331250	106331350	Rpl29_window3	1	5
+chr9	106331275	106331375	Rpl29_window4	1	7
+chr9	106331300	106331400	Rpl29_window5	1	8
+chr9	106331325	106331425	Rpl29_window6	2	8
+chr9	106331350	106331450	Rpl29_window7	2	8
+chr9	106331375	106331475	Rpl29_window8	1	8
+chr9	106331400	106331500	Rpl29_window9	1	8
+chr9	106331425	106331525	Rpl29_window10	3	8
+chr9	106331450	106331550	Rpl29_window11	3	8
+chr9	106331475	106331575	Rpl29_window12	4	11
+chr9	106331500	106331600	Rpl29_window13	5	8
+chr9	106331525	106331625	Rpl29_window14	6	10
+chr9	106331550	106331650	Rpl29_window15	4	5
+chr9	106331575	106331675	Rpl29_window16	3	3
+chr9	106331600	106331700	Rpl29_window17	2	4
+chr9	106331625	106331725	Rpl29_window18	2	21
+chr9	106331650	106331750	Rpl29_window19	2	33
+chr9	106331675	106331775	Rpl29_window20	4	34
+chr9	106331700	106331800	Rpl29_window21	5	29
+chr9	106331725	106331825	Rpl29_window22	4	27
+chr9	106331750	106331850	Rpl29_window23	5	30
+chr9	106331775	106331875	Rpl29_window24	5	23
+chr9	106331800	106331900	Rpl29_window25	3	18
+chr9	106331825	106331925	Rpl29_window26	2	13
+chr9	106331850	106331950	Rpl29_window27	1	12
+chr9	106331875	106331975	Rpl29_window28	1	13
+chr9	106331900	106332000	Rpl29_window29	0	13
+chr9	106331925	106332025	Rpl29_window30	1	11
+chr9	106331950	106332050	Rpl29_window31	1	10
+chr9	106331975	106332075	Rpl29_window32	1	8
+chr9	106332000	106332100	Rpl29_window33	3	9
+chr9	106332025	106332125	Rpl29_window34	2	7
+chr9	106332050	106332150	Rpl29_window35	1	3
+chr9	106332075	106332175	Rpl29_window36	1	2
+chr9	106332100	106332200	Rpl29_window37	1	4
+chr9	106332125	106332225	Rpl29_window38	0	3
+chr9	106332150	106332250	Rpl29_window39	0	3
+chr9	106332175	106332275	Rpl29_window40	0	2
+chr9	106332200	106332300	Rpl29_window41	0	1
+chr9	106332225	106332325	Rpl29_window42	0	0
+chr9	106332250	106332350	Rpl29_window43	0	0
+chr9	106332275	106332375	Rpl29_window44	0	0
+chr9	106332300	106332400	Rpl29_window45	0	0
+chr2	153116826	153117777	Kif3b	0	0
+chr2	153116826	153116926	Kif3b_window1	1	1
+chr2	153116851	153116951	Kif3b_window2	2	5
+chr2	153116876	153116976	Kif3b_window3	2	6
+chr2	153116901	153117001	Kif3b_window4	2	7
+chr2	153116926	153117026	Kif3b_window5	1	7
+chr2	153116951	153117051	Kif3b_window6	1	7
+chr2	153116976	153117076	Kif3b_window7	0	7
+chr2	153117001	153117101	Kif3b_window8	1	7
+chr2	153117026	153117126	Kif3b_window9	1	7
+chr2	153117051	153117151	Kif3b_window10	5	13
+chr2	153117076	153117176	Kif3b_window11	2	14
+chr2	153117101	153117201	Kif3b_window12	1	8
+chr2	153117126	153117226	Kif3b_window13	0	7
+chr2	153117151	153117251	Kif3b_window14	2	12
+chr2	153117176	153117276	Kif3b_window15	3	20
+chr2	153117201	153117301	Kif3b_window16	4	23
+chr2	153117226	153117326	Kif3b_window17	4	24
+chr2	153117251	153117351	Kif3b_window18	5	24
+chr2	153117276	153117376	Kif3b_window19	4	23
+chr2	153117301	153117401	Kif3b_window20	2	17
+chr2	153117326	153117426	Kif3b_window21	2	15
+chr2	153117351	153117451	Kif3b_window22	1	14
+chr2	153117376	153117476	Kif3b_window23	1	17
+chr2	153117401	153117501	Kif3b_window24	1	18
+chr2	153117426	153117526	Kif3b_window25	1	16
+chr2	153117451	153117551	Kif3b_window26	1	12
+chr2	153117476	153117576	Kif3b_window27	3	7
+chr2	153117501	153117601	Kif3b_window28	3	5
+chr2	153117526	153117626	Kif3b_window29	3	3
+chr2	153117551	153117651	Kif3b_window30	2	4
+chr2	153117576	153117676	Kif3b_window31	1	4
+chr2	153117601	153117701	Kif3b_window32	1	4
+chr2	153117626	153117726	Kif3b_window33	0	3
+chr2	153117651	153117751	Kif3b_window34	0	3
+chr2	153117676	153117776	Kif3b_window35	0	1
+chr2	153117701	153117801	Kif3b_window36	1	2
+chr1	133049497	133050192	Eif2d	0	0
+chr1	133049497	133049597	Eif2d_window1	0	3
+chr1	133049522	133049622	Eif2d_window2	0	4
+chr1	133049547	133049647	Eif2d_window3	1	9
+chr1	133049572	133049672	Eif2d_window4	1	13
+chr1	133049597	133049697	Eif2d_window5	1	14
+chr1	133049622	133049722	Eif2d_window6	1	11
+chr1	133049647	133049747	Eif2d_window7	1	11
+chr1	133049672	133049772	Eif2d_window8	6	19
+chr1	133049697	133049797	Eif2d_window9	14	36
+chr1	133049722	133049822	Eif2d_window10	4	27
+chr1	133049747	133049847	Eif2d_window11	6	24
+chr1	133049772	133049872	Eif2d_window12	3	13
+chr1	133049797	133049897	Eif2d_window13	5	19
+chr1	133049822	133049922	Eif2d_window14	5	16
+chr1	133049847	133049947	Eif2d_window15	5	16
+chr1	133049872	133049972	Eif2d_window16	5	15
+chr1	133049897	133049997	Eif2d_window17	4	13
+chr1	133049922	133050022	Eif2d_window18	3	8
+chr1	133049947	133050047	Eif2d_window19	2	6
+chr1	133049972	133050072	Eif2d_window20	1	4
+chr1	133049997	133050097	Eif2d_window21	1	4
+chr1	133050022	133050122	Eif2d_window22	1	4
+chr1	133050047	133050147	Eif2d_window23	1	3
+chr1	133050072	133050172	Eif2d_window24	1	3
+chr1	133050097	133050197	Eif2d_window25	0	2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/combined.o.bed.coverage	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,125 @@
+chr15	95484290	95485433	Dbx2	29	170	406	83	70	23	6	6	104	63	125	63	55	78	34	44
+chr15	95484290	95484390	Dbx2_window1	1	3	43	3	14	4	3	1	9	2	1	5	3	3	1	2
+chr15	95484340	95484440	Dbx2_window2	1	4	39	5	11	5	3	4	7	6	1	6	3	2	2	2
+chr15	95484390	95484490	Dbx2_window3	0	4	35	8	8	7	4	3	7	5	2	5	3	7	4	1
+chr15	95484440	95484540	Dbx2_window4	0	9	35	7	10	8	1	1	6	7	4	4	2	7	3	1
+chr15	95484490	95484590	Dbx2_window5	1	10	41	6	6	6	1	0	9	5	6	4	3	9	5	3
+chr15	95484540	95484640	Dbx2_window6	1	14	31	4	6	9	1	0	15	7	12	7	5	5	4	5
+chr15	95484590	95484690	Dbx2_window7	1	18	26	7	4	3	0	0	14	10	12	8	7	6	4	4
+chr15	95484640	95484740	Dbx2_window8	0	24	30	8	11	3	0	0	16	11	13	8	8	8	1	6
+chr15	95484690	95484790	Dbx2_window9	1	29	50	11	16	4	0	0	18	11	10	9	6	7	4	6
+chr15	95484740	95484840	Dbx2_window10	2	36	50	10	15	3	0	0	19	11	16	13	6	8	10	7
+chr15	95484790	95484890	Dbx2_window11	2	35	59	11	12	3	0	0	17	8	18	11	5	15	10	5
+chr15	95484840	95484940	Dbx2_window12	7	43	59	18	6	0	0	0	16	8	19	14	7	24	12	12
+chr15	95484890	95484990	Dbx2_window13	13	43	61	21	8	0	1	2	18	10	21	11	10	30	14	14
+chr15	95484940	95485040	Dbx2_window14	17	48	82	21	7	0	1	2	18	13	24	12	14	26	11	16
+chr15	95484990	95485090	Dbx2_window15	15	39	80	20	6	0	1	2	24	11	32	15	15	29	6	13
+chr15	95485040	95485140	Dbx2_window16	5	35	76	18	9	1	1	0	25	13	26	9	18	23	4	10
+chr15	95485090	95485190	Dbx2_window17	3	31	95	24	7	1	1	0	29	16	27	15	18	19	3	10
+chr15	95485140	95485240	Dbx2_window18	3	31	114	17	14	1	1	0	29	17	35	15	14	7	3	9
+chr15	95485190	95485290	Dbx2_window19	6	35	117	20	14	1	0	0	22	15	40	14	11	6	2	8
+chr15	95485240	95485340	Dbx2_window20	5	31	91	13	11	2	0	0	11	8	39	13	11	3	3	4
+chr15	95485290	95485390	Dbx2_window21	4	19	50	11	6	2	0	0	4	7	25	8	8	3	2	3
+chr15	95485340	95485440	Dbx2_window22	1	12	21	5	2	3	0	0	0	3	15	7	6	0	2	1
+chr10	20444676	20445116	Pde7b	72	177	214	15	34	16	16	20	67	43	82	40	36	18	19	14
+chr10	20444676	20444776	Pde7b_window1	21	34	31	3	7	6	4	5	12	9	22	12	12	1	5	1
+chr10	20444726	20444826	Pde7b_window2	27	90	100	5	14	10	6	5	24	16	43	18	15	9	11	3
+chr10	20444776	20444876	Pde7b_window3	57	145	151	9	20	12	7	12	42	24	51	25	21	13	14	11
+chr10	20444826	20444926	Pde7b_window4	50	139	165	7	23	10	9	13	50	29	55	28	20	13	12	12
+chr10	20444876	20444976	Pde7b_window5	33	72	111	10	19	7	9	9	39	22	39	19	21	8	6	11
+chr10	20444926	20445026	Pde7b_window6	15	38	59	5	13	3	7	5	26	18	26	15	16	6	7	2
+chr10	20444976	20445076	Pde7b_window7	7	11	27	6	6	1	5	0	11	8	10	3	8	4	2	1
+chr10	20445026	20445126	Pde7b_window8	4	7	19	2	4	1	4	2	6	7	9	2	4	3	3	0
+chr18	58715130	58715849	Slc27a6	36	166	227	60	58	56	51	72	170	133	201	133	113	162	53	100
+chr18	58715130	58715230	Slc27a6_window1	1	16	27	2	7	4	8	10	15	10	24	13	15	18	8	6
+chr18	58715180	58715280	Slc27a6_window2	1	24	47	3	8	7	14	13	35	20	46	22	28	35	14	15
+chr18	58715230	58715330	Slc27a6_window3	7	36	60	5	7	14	16	22	47	29	70	38	40	58	21	27
+chr18	58715280	58715380	Slc27a6_window4	10	50	80	8	8	21	12	22	56	32	78	52	52	73	25	44
+chr18	58715330	58715430	Slc27a6_window5	11	71	80	18	20	26	12	28	64	41	88	64	60	81	29	49
+chr18	58715380	58715480	Slc27a6_window6	14	75	80	22	24	20	16	31	66	37	74	59	54	63	28	56
+chr18	58715430	58715530	Slc27a6_window7	13	70	87	28	29	17	20	30	69	57	68	52	45	55	21	44
+chr18	58715480	58715580	Slc27a6_window8	16	65	75	28	25	17	18	31	63	53	59	47	30	44	14	40
+chr18	58715530	58715630	Slc27a6_window9	12	46	63	24	22	18	8	15	45	48	43	26	17	35	3	13
+chr18	58715580	58715680	Slc27a6_window10	8	32	46	19	10	15	7	9	32	35	31	25	10	20	0	8
+chr18	58715630	58715730	Slc27a6_window11	6	27	32	14	8	11	8	9	23	29	27	24	9	19	0	7
+chr18	58715680	58715780	Slc27a6_window12	5	15	24	11	5	9	8	8	21	25	21	17	8	11	2	6
+chr18	58715730	58715830	Slc27a6_window13	6	9	19	8	4	6	10	5	13	15	19	12	7	8	2	3
+chr18	58715780	58715880	Slc27a6_window14	4	2	10	5	4	5	4	3	10	9	14	6	4	4	2	0
+chr2	32816762	32817713	Rpl12	58	243	278	57	88	124	92	59	169	112	126	81	57	44	26	38
+chr2	32816762	32816862	Rpl12_window1	0	8	8	2	10	4	1	0	10	5	5	2	0	0	0	0
+chr2	32816812	32816912	Rpl12_window2	3	14	21	5	10	9	7	3	16	10	5	5	3	3	0	5
+chr2	32816862	32816962	Rpl12_window3	10	32	32	9	15	17	12	7	25	17	14	9	6	7	0	7
+chr2	32816912	32817012	Rpl12_window4	11	33	40	13	11	18	13	8	25	16	16	11	6	12	2	6
+chr2	32816962	32817062	Rpl12_window5	12	44	43	17	22	26	16	7	29	18	24	14	10	11	2	5
+chr2	32817012	32817112	Rpl12_window6	15	67	79	23	20	35	19	13	40	25	37	23	19	17	5	9
+chr2	32817062	32817162	Rpl12_window7	23	88	108	25	30	46	38	17	52	36	45	25	29	12	9	10
+chr2	32817112	32817212	Rpl12_window8	33	101	121	30	27	45	42	26	57	47	53	30	33	12	12	13
+chr2	32817162	32817262	Rpl12_window9	27	96	93	27	27	37	40	21	55	38	49	26	25	10	12	11
+chr2	32817212	32817312	Rpl12_window10	17	71	52	16	25	30	29	18	48	31	40	23	11	8	9	10
+chr2	32817262	32817362	Rpl12_window11	5	54	39	11	17	23	19	7	37	24	30	20	8	7	7	7
+chr2	32817312	32817412	Rpl12_window12	4	40	43	4	14	28	16	13	37	25	27	18	5	11	8	9
+chr2	32817362	32817462	Rpl12_window13	7	40	48	3	14	26	14	14	36	23	25	17	6	9	7	12
+chr2	32817412	32817512	Rpl12_window14	6	37	43	4	13	25	12	14	31	21	19	14	6	9	4	10
+chr2	32817462	32817562	Rpl12_window15	6	27	30	3	12	15	9	9	21	12	12	12	7	9	2	7
+chr2	32817512	32817612	Rpl12_window16	2	15	22	1	6	6	5	4	13	6	5	6	4	5	2	1
+chr2	32817562	32817662	Rpl12_window17	1	11	25	1	7	7	4	4	12	8	4	7	5	3	2	1
+chr2	32817612	32817712	Rpl12_window18	2	14	29	1	5	5	6	4	10	5	4	7	4	3	1	0
+chr2	32817662	32817762	Rpl12_window19	2	15	29	3	6	10	9	4	9	7	8	4	3	3	1	3
+chr9	106331200	106332399	Rpl29	94	304	471	97	119	193	184	89	260	178	178	117	98	101	28	50
+chr9	106331200	106331300	Rpl29_window1	4	11	12	8	5	13	13	3	20	13	11	6	5	5	0	0
+chr9	106331250	106331350	Rpl29_window2	5	15	21	10	10	20	15	8	31	15	15	5	7	5	0	0
+chr9	106331300	106331400	Rpl29_window3	6	17	27	10	9	20	23	8	32	16	18	6	5	9	0	0
+chr9	106331350	106331450	Rpl29_window4	8	18	33	7	14	19	17	5	35	12	19	9	7	10	0	1
+chr9	106331400	106331500	Rpl29_window5	12	21	35	6	12	16	24	11	37	24	16	12	6	8	0	3
+chr9	106331450	106331550	Rpl29_window6	15	22	32	7	12	19	23	11	38	23	19	14	7	7	0	6
+chr9	106331500	106331600	Rpl29_window7	14	34	70	10	14	28	38	15	45	30	25	18	12	4	4	6
+chr9	106331550	106331650	Rpl29_window8	27	73	131	19	21	40	44	22	53	35	36	26	22	15	6	7
+chr9	106331600	106331700	Rpl29_window9	32	96	173	30	30	56	50	25	56	38	41	35	30	37	11	10
+chr9	106331650	106331750	Rpl29_window10	42	120	197	33	36	66	49	32	61	51	40	42	33	48	16	25
+chr9	106331700	106331800	Rpl29_window11	36	130	200	36	48	66	50	40	69	55	46	48	35	53	19	32
+chr9	106331750	106331850	Rpl29_window12	32	119	172	30	38	59	47	31	70	48	52	47	29	36	13	28
+chr9	106331800	106331900	Rpl29_window13	14	74	141	19	34	44	37	25	62	48	44	33	25	28	9	18
+chr9	106331850	106331950	Rpl29_window14	8	62	84	17	28	31	28	11	42	36	31	22	18	19	2	8
+chr9	106331900	106332000	Rpl29_window15	9	41	61	13	22	22	25	9	36	34	27	14	14	15	3	8
+chr9	106331950	106332050	Rpl29_window16	8	29	42	9	16	16	18	11	31	25	29	8	13	9	2	7
+chr9	106332000	106332100	Rpl29_window17	6	24	40	9	15	17	14	4	24	20	29	6	10	9	1	3
+chr9	106332050	106332150	Rpl29_window18	9	23	33	9	10	22	14	3	16	13	33	7	8	8	1	0
+chr9	106332100	106332200	Rpl29_window19	5	19	29	10	7	26	15	2	21	15	24	8	8	6	0	1
+chr9	106332150	106332250	Rpl29_window20	1	18	24	9	6	20	16	1	25	13	16	12	6	2	0	1
+chr9	106332200	106332300	Rpl29_window21	0	9	18	9	9	14	17	1	24	12	13	9	6	1	0	1
+chr9	106332250	106332350	Rpl29_window22	3	12	15	6	7	8	17	3	25	9	8	10	7	2	0	1
+chr9	106332300	106332400	Rpl29_window23	3	8	10	5	6	6	12	6	16	4	6	3	6	1	2	0
+chr2	153116826	153117777	Kif3b	74	211	266	79	108	127	109	47	159	86	100	77	65	57	22	38
+chr2	153116826	153116926	Kif3b_window1	3	13	22	8	10	15	12	4	13	9	7	6	5	2	2	4
+chr2	153116876	153116976	Kif3b_window2	3	10	27	13	9	17	13	7	17	11	10	5	7	3	0	6
+chr2	153116926	153117026	Kif3b_window3	14	19	39	17	17	24	15	9	26	10	13	11	7	7	0	8
+chr2	153116976	153117076	Kif3b_window4	23	49	82	27	33	29	33	16	51	15	27	18	14	19	5	8
+chr2	153117026	153117126	Kif3b_window5	24	96	114	31	40	43	42	20	69	28	39	30	24	28	9	9
+chr2	153117076	153117176	Kif3b_window6	38	113	126	27	49	49	51	23	62	35	44	31	25	34	11	16
+chr2	153117126	153117226	Kif3b_window7	41	98	105	21	34	41	45	19	53	34	36	29	27	32	8	18
+chr2	153117176	153117276	Kif3b_window8	36	54	63	18	25	25	30	13	29	27	21	20	17	17	7	12
+chr2	153117226	153117326	Kif3b_window9	10	30	36	12	11	15	15	9	19	19	13	13	11	7	3	9
+chr2	153117276	153117376	Kif3b_window10	5	18	20	12	11	16	10	6	18	13	7	10	8	5	4	3
+chr2	153117326	153117426	Kif3b_window11	4	23	16	12	12	19	12	4	16	14	8	8	9	5	4	3
+chr2	153117376	153117476	Kif3b_window12	4	34	24	11	15	18	16	3	20	8	7	9	10	5	2	5
+chr2	153117426	153117526	Kif3b_window13	3	30	31	11	18	17	19	1	21	10	16	7	9	4	3	5
+chr2	153117476	153117576	Kif3b_window14	6	26	40	8	16	15	12	4	25	11	20	10	10	3	3	5
+chr2	153117526	153117626	Kif3b_window15	7	17	33	7	15	12	8	6	18	7	21	8	10	3	2	3
+chr2	153117576	153117676	Kif3b_window16	5	13	29	5	14	13	7	5	21	6	16	12	6	2	1	3
+chr2	153117626	153117726	Kif3b_window17	4	13	16	4	14	10	6	3	16	3	9	12	5	3	0	1
+chr2	153117676	153117776	Kif3b_window18	2	11	20	4	9	8	8	1	17	6	8	10	6	2	0	1
+chr2	153117726	153117826	Kif3b_window19	1	10	11	3	6	6	4	1	11	6	6	8	5	2	0	0
+chr1	133049497	133050192	Eif2d	146	406	445	66	96	86	114	49	125	59	72	41	65	25	14	14
+chr1	133049497	133049597	Eif2d_window1	1	15	7	5	3	8	3	0	11	1	2	3	3	3	0	1
+chr1	133049547	133049647	Eif2d_window2	3	31	25	11	12	12	11	3	16	5	4	6	6	3	0	3
+chr1	133049597	133049697	Eif2d_window3	37	112	115	22	36	25	27	16	33	16	20	12	17	2	2	5
+chr1	133049647	133049747	Eif2d_window4	74	209	224	36	54	37	54	21	52	29	35	17	31	7	6	8
+chr1	133049697	133049797	Eif2d_window5	111	295	309	41	65	43	69	29	71	37	51	23	34	16	8	10
+chr1	133049747	133049847	Eif2d_window6	115	285	297	38	51	43	64	26	72	35	42	21	35	17	8	7
+chr1	133049797	133049897	Eif2d_window7	62	197	217	25	33	34	50	22	51	24	29	16	26	11	5	1
+chr1	133049847	133049947	Eif2d_window8	28	105	113	17	19	25	30	20	34	13	21	11	19	4	2	0
+chr1	133049897	133049997	Eif2d_window9	12	35	63	10	12	13	22	10	25	9	12	8	17	2	6	0
+chr1	133049947	133050047	Eif2d_window10	10	23	39	8	12	10	19	6	15	5	9	5	10	2	5	0
+chr1	133049997	133050097	Eif2d_window11	4	16	37	7	11	7	11	6	13	1	6	5	6	1	3	0
+chr1	133050047	133050147	Eif2d_window12	1	10	21	3	7	5	9	2	10	3	4	3	6	2	0	2
+chr1	133050097	133050197	Eif2d_window13	1	6	13	1	6	6	7	3	7	7	2	2	5	2	0	2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/combined.o.coverage	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,233 @@
+chr15	95484290	95485433	Dbx2	29	170
+chr15	95484290	95484390	Dbx2_window1	1	3
+chr15	95484315	95484415	Dbx2_window2	1	4
+chr15	95484340	95484440	Dbx2_window3	1	4
+chr15	95484365	95484465	Dbx2_window4	0	5
+chr15	95484390	95484490	Dbx2_window5	0	4
+chr15	95484415	95484515	Dbx2_window6	0	6
+chr15	95484440	95484540	Dbx2_window7	0	9
+chr15	95484465	95484565	Dbx2_window8	1	10
+chr15	95484490	95484590	Dbx2_window9	1	10
+chr15	95484515	95484615	Dbx2_window10	1	14
+chr15	95484540	95484640	Dbx2_window11	1	14
+chr15	95484565	95484665	Dbx2_window12	1	16
+chr15	95484590	95484690	Dbx2_window13	1	18
+chr15	95484615	95484715	Dbx2_window14	1	21
+chr15	95484640	95484740	Dbx2_window15	0	24
+chr15	95484665	95484765	Dbx2_window16	0	26
+chr15	95484690	95484790	Dbx2_window17	1	29
+chr15	95484715	95484815	Dbx2_window18	2	31
+chr15	95484740	95484840	Dbx2_window19	2	36
+chr15	95484765	95484865	Dbx2_window20	2	36
+chr15	95484790	95484890	Dbx2_window21	2	35
+chr15	95484815	95484915	Dbx2_window22	4	42
+chr15	95484840	95484940	Dbx2_window23	7	43
+chr15	95484865	95484965	Dbx2_window24	11	46
+chr15	95484890	95484990	Dbx2_window25	13	43
+chr15	95484915	95485015	Dbx2_window26	15	40
+chr15	95484940	95485040	Dbx2_window27	17	48
+chr15	95484965	95485065	Dbx2_window28	17	40
+chr15	95484990	95485090	Dbx2_window29	15	39
+chr15	95485015	95485115	Dbx2_window30	12	41
+chr15	95485040	95485140	Dbx2_window31	5	35
+chr15	95485065	95485165	Dbx2_window32	3	28
+chr15	95485090	95485190	Dbx2_window33	3	31
+chr15	95485115	95485215	Dbx2_window34	4	33
+chr15	95485140	95485240	Dbx2_window35	3	31
+chr15	95485165	95485265	Dbx2_window36	3	34
+chr15	95485190	95485290	Dbx2_window37	6	35
+chr15	95485215	95485315	Dbx2_window38	6	33
+chr15	95485240	95485340	Dbx2_window39	5	31
+chr15	95485265	95485365	Dbx2_window40	5	27
+chr15	95485290	95485390	Dbx2_window41	4	19
+chr15	95485315	95485415	Dbx2_window42	3	14
+chr15	95485340	95485440	Dbx2_window43	1	12
+chr10	20444676	20445116	Pde7b	72	177
+chr10	20444676	20444776	Pde7b_window1	21	34
+chr10	20444701	20444801	Pde7b_window2	22	65
+chr10	20444726	20444826	Pde7b_window3	27	90
+chr10	20444751	20444851	Pde7b_window4	49	126
+chr10	20444776	20444876	Pde7b_window5	57	145
+chr10	20444801	20444901	Pde7b_window6	57	146
+chr10	20444826	20444926	Pde7b_window7	50	139
+chr10	20444851	20444951	Pde7b_window8	43	116
+chr10	20444876	20444976	Pde7b_window9	33	72
+chr10	20444901	20445001	Pde7b_window10	21	53
+chr10	20444926	20445026	Pde7b_window11	15	38
+chr10	20444951	20445051	Pde7b_window12	7	14
+chr10	20444976	20445076	Pde7b_window13	7	11
+chr10	20445001	20445101	Pde7b_window14	7	8
+chr10	20445026	20445126	Pde7b_window15	4	7
+chr18	58715130	58715849	Slc27a6	36	166
+chr18	58715130	58715230	Slc27a6_window1	1	16
+chr18	58715155	58715255	Slc27a6_window2	1	19
+chr18	58715180	58715280	Slc27a6_window3	1	24
+chr18	58715205	58715305	Slc27a6_window4	6	31
+chr18	58715230	58715330	Slc27a6_window5	7	36
+chr18	58715255	58715355	Slc27a6_window6	8	42
+chr18	58715280	58715380	Slc27a6_window7	10	50
+chr18	58715305	58715405	Slc27a6_window8	11	57
+chr18	58715330	58715430	Slc27a6_window9	11	71
+chr18	58715355	58715455	Slc27a6_window10	13	74
+chr18	58715380	58715480	Slc27a6_window11	14	75
+chr18	58715405	58715505	Slc27a6_window12	14	78
+chr18	58715430	58715530	Slc27a6_window13	13	70
+chr18	58715455	58715555	Slc27a6_window14	11	69
+chr18	58715480	58715580	Slc27a6_window15	16	65
+chr18	58715505	58715605	Slc27a6_window16	16	52
+chr18	58715530	58715630	Slc27a6_window17	12	46
+chr18	58715555	58715655	Slc27a6_window18	8	32
+chr18	58715580	58715680	Slc27a6_window19	8	32
+chr18	58715605	58715705	Slc27a6_window20	9	35
+chr18	58715630	58715730	Slc27a6_window21	6	27
+chr18	58715655	58715755	Slc27a6_window22	5	24
+chr18	58715680	58715780	Slc27a6_window23	5	15
+chr18	58715705	58715805	Slc27a6_window24	5	13
+chr18	58715730	58715830	Slc27a6_window25	6	9
+chr18	58715755	58715855	Slc27a6_window26	5	8
+chr2	32816762	32817713	Rpl12	58	243
+chr2	32816762	32816862	Rpl12_window1	0	8
+chr2	32816787	32816887	Rpl12_window2	0	9
+chr2	32816812	32816912	Rpl12_window3	3	14
+chr2	32816837	32816937	Rpl12_window4	8	20
+chr2	32816862	32816962	Rpl12_window5	10	32
+chr2	32816887	32816987	Rpl12_window6	11	34
+chr2	32816912	32817012	Rpl12_window7	11	33
+chr2	32816937	32817037	Rpl12_window8	13	39
+chr2	32816962	32817062	Rpl12_window9	12	44
+chr2	32816987	32817087	Rpl12_window10	9	58
+chr2	32817012	32817112	Rpl12_window11	15	67
+chr2	32817037	32817137	Rpl12_window12	17	67
+chr2	32817062	32817162	Rpl12_window13	23	88
+chr2	32817087	32817187	Rpl12_window14	27	97
+chr2	32817112	32817212	Rpl12_window15	33	101
+chr2	32817137	32817237	Rpl12_window16	32	107
+chr2	32817162	32817262	Rpl12_window17	27	96
+chr2	32817187	32817287	Rpl12_window18	25	83
+chr2	32817212	32817312	Rpl12_window19	17	71
+chr2	32817237	32817337	Rpl12_window20	9	60
+chr2	32817262	32817362	Rpl12_window21	5	54
+chr2	32817287	32817387	Rpl12_window22	3	46
+chr2	32817312	32817412	Rpl12_window23	4	40
+chr2	32817337	32817437	Rpl12_window24	5	41
+chr2	32817362	32817462	Rpl12_window25	7	40
+chr2	32817387	32817487	Rpl12_window26	6	41
+chr2	32817412	32817512	Rpl12_window27	6	37
+chr2	32817437	32817537	Rpl12_window28	7	32
+chr2	32817462	32817562	Rpl12_window29	6	27
+chr2	32817487	32817587	Rpl12_window30	6	19
+chr2	32817512	32817612	Rpl12_window31	2	15
+chr2	32817537	32817637	Rpl12_window32	1	11
+chr2	32817562	32817662	Rpl12_window33	1	11
+chr2	32817587	32817687	Rpl12_window34	3	12
+chr2	32817612	32817712	Rpl12_window35	2	14
+chr2	32817637	32817737	Rpl12_window36	2	15
+chr9	106331200	106332399	Rpl29	94	304
+chr9	106331200	106331300	Rpl29_window1	4	11
+chr9	106331225	106331325	Rpl29_window2	4	13
+chr9	106331250	106331350	Rpl29_window3	5	15
+chr9	106331275	106331375	Rpl29_window4	6	17
+chr9	106331300	106331400	Rpl29_window5	6	17
+chr9	106331325	106331425	Rpl29_window6	7	19
+chr9	106331350	106331450	Rpl29_window7	8	18
+chr9	106331375	106331475	Rpl29_window8	10	18
+chr9	106331400	106331500	Rpl29_window9	12	21
+chr9	106331425	106331525	Rpl29_window10	14	24
+chr9	106331450	106331550	Rpl29_window11	15	22
+chr9	106331475	106331575	Rpl29_window12	16	31
+chr9	106331500	106331600	Rpl29_window13	14	34
+chr9	106331525	106331625	Rpl29_window14	16	40
+chr9	106331550	106331650	Rpl29_window15	27	73
+chr9	106331575	106331675	Rpl29_window16	24	75
+chr9	106331600	106331700	Rpl29_window17	32	96
+chr9	106331625	106331725	Rpl29_window18	41	114
+chr9	106331650	106331750	Rpl29_window19	42	120
+chr9	106331675	106331775	Rpl29_window20	48	127
+chr9	106331700	106331800	Rpl29_window21	36	130
+chr9	106331725	106331825	Rpl29_window22	35	116
+chr9	106331750	106331850	Rpl29_window23	32	119
+chr9	106331775	106331875	Rpl29_window24	27	90
+chr9	106331800	106331900	Rpl29_window25	14	74
+chr9	106331825	106331925	Rpl29_window26	12	64
+chr9	106331850	106331950	Rpl29_window27	8	62
+chr9	106331875	106331975	Rpl29_window28	8	56
+chr9	106331900	106332000	Rpl29_window29	9	41
+chr9	106331925	106332025	Rpl29_window30	6	28
+chr9	106331950	106332050	Rpl29_window31	8	29
+chr9	106331975	106332075	Rpl29_window32	8	30
+chr9	106332000	106332100	Rpl29_window33	6	24
+chr9	106332025	106332125	Rpl29_window34	9	22
+chr9	106332050	106332150	Rpl29_window35	9	23
+chr9	106332075	106332175	Rpl29_window36	6	22
+chr9	106332100	106332200	Rpl29_window37	5	19
+chr9	106332125	106332225	Rpl29_window38	3	15
+chr9	106332150	106332250	Rpl29_window39	1	18
+chr9	106332175	106332275	Rpl29_window40	1	15
+chr9	106332200	106332300	Rpl29_window41	0	9
+chr9	106332225	106332325	Rpl29_window42	0	11
+chr9	106332250	106332350	Rpl29_window43	3	12
+chr9	106332275	106332375	Rpl29_window44	3	7
+chr9	106332300	106332400	Rpl29_window45	3	8
+chr2	153116826	153117777	Kif3b	74	211
+chr2	153116826	153116926	Kif3b_window1	3	13
+chr2	153116851	153116951	Kif3b_window2	2	11
+chr2	153116876	153116976	Kif3b_window3	3	10
+chr2	153116901	153117001	Kif3b_window4	10	18
+chr2	153116926	153117026	Kif3b_window5	14	19
+chr2	153116951	153117051	Kif3b_window6	15	37
+chr2	153116976	153117076	Kif3b_window7	23	49
+chr2	153117001	153117101	Kif3b_window8	24	66
+chr2	153117026	153117126	Kif3b_window9	24	96
+chr2	153117051	153117151	Kif3b_window10	38	104
+chr2	153117076	153117176	Kif3b_window11	38	113
+chr2	153117101	153117201	Kif3b_window12	45	112
+chr2	153117126	153117226	Kif3b_window13	41	98
+chr2	153117151	153117251	Kif3b_window14	35	76
+chr2	153117176	153117276	Kif3b_window15	36	54
+chr2	153117201	153117301	Kif3b_window16	20	40
+chr2	153117226	153117326	Kif3b_window17	10	30
+chr2	153117251	153117351	Kif3b_window18	5	22
+chr2	153117276	153117376	Kif3b_window19	5	18
+chr2	153117301	153117401	Kif3b_window20	5	18
+chr2	153117326	153117426	Kif3b_window21	4	23
+chr2	153117351	153117451	Kif3b_window22	3	28
+chr2	153117376	153117476	Kif3b_window23	4	34
+chr2	153117401	153117501	Kif3b_window24	3	32
+chr2	153117426	153117526	Kif3b_window25	3	30
+chr2	153117451	153117551	Kif3b_window26	2	28
+chr2	153117476	153117576	Kif3b_window27	6	26
+chr2	153117501	153117601	Kif3b_window28	6	23
+chr2	153117526	153117626	Kif3b_window29	7	17
+chr2	153117551	153117651	Kif3b_window30	5	12
+chr2	153117576	153117676	Kif3b_window31	5	13
+chr2	153117601	153117701	Kif3b_window32	6	13
+chr2	153117626	153117726	Kif3b_window33	4	13
+chr2	153117651	153117751	Kif3b_window34	2	11
+chr2	153117676	153117776	Kif3b_window35	2	11
+chr2	153117701	153117801	Kif3b_window36	1	11
+chr1	133049497	133050192	Eif2d	146	406
+chr1	133049497	133049597	Eif2d_window1	1	15
+chr1	133049522	133049622	Eif2d_window2	1	22
+chr1	133049547	133049647	Eif2d_window3	3	31
+chr1	133049572	133049672	Eif2d_window4	8	61
+chr1	133049597	133049697	Eif2d_window5	37	112
+chr1	133049622	133049722	Eif2d_window6	53	151
+chr1	133049647	133049747	Eif2d_window7	74	209
+chr1	133049672	133049772	Eif2d_window8	92	242
+chr1	133049697	133049797	Eif2d_window9	111	295
+chr1	133049722	133049822	Eif2d_window10	128	306
+chr1	133049747	133049847	Eif2d_window11	115	285
+chr1	133049772	133049872	Eif2d_window12	92	241
+chr1	133049797	133049897	Eif2d_window13	62	197
+chr1	133049822	133049922	Eif2d_window14	50	136
+chr1	133049847	133049947	Eif2d_window15	28	105
+chr1	133049872	133049972	Eif2d_window16	11	39
+chr1	133049897	133049997	Eif2d_window17	12	35
+chr1	133049922	133050022	Eif2d_window18	11	28
+chr1	133049947	133050047	Eif2d_window19	10	23
+chr1	133049972	133050072	Eif2d_window20	8	28
+chr1	133049997	133050097	Eif2d_window21	4	16
+chr1	133050022	133050122	Eif2d_window22	5	13
+chr1	133050047	133050147	Eif2d_window23	1	10
+chr1	133050072	133050172	Eif2d_window24	1	8
+chr1	133050097	133050197	Eif2d_window25	1	6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataset_684.dat	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+BJ-JQ1-2h.trim.sort.nuc.uniq.rmdup.filter.bam	1920
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataset_686.dat	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+BJ-JQ1-1h.trim.sort.nuc.uniq.rmdup.filter.bam	2047
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataset_688.dat	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+BJ-DMSO-6h.trim.sort.nuc.uniq.rmdup.filter.bam	615
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataset_690.dat	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+BJ-DMSO-2h.trim.sort.nuc.uniq.rmdup.filter.bam	1130
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataset_692.dat	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+BJ-DMSO-1h.trim.sort.nuc.uniq.rmdup.filter.bam	789
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataset_list	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+dataset_692.dat,dataset_684.dat,dataset_688.dat,dataset_686.dat,dataset_690.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataset_list_ordered	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+dataset_692.dat,dataset_684.dat,dataset_688.dat,dataset_686.dat,dataset_690.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/ext_peak	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,6 @@
+chr10	20442676	20447116	Pde7b
+chr15	95482290	95487433	Dbx2
+chr18	58713130	58717849	Slc27a6
+chr2	32814762	32819713	Rpl12
+chr2	153114826	153119777	Kif3b
+chr9	106329200	106334399	Rpl29
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/lib_sizes.txt	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,16 @@
+15003106
+71588566
+61590166
+24168007
+27558173
+34581324
+24494912
+31303036
+30945942
+23828468
+26987526
+14576615
+20647247
+28129346
+13608142
+21186210
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mm9.chrom.sizes.txt	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,35 @@
+chr1	197195432
+chr2	181748087
+chrX	166650296
+chr3	159599783
+chr4	155630120
+chr5	152537259
+chr7	152524553
+chr6	149517037
+chr8	131738871
+chr10	129993255
+chr14	125194864
+chr9	124076172
+chr11	121843856
+chr12	121257530
+chr13	120284312
+chr15	103494974
+chr16	98319150
+chr17	95272651
+chr18	90772031
+chr19	61342430
+chrY_random	58682461
+chrY	15902555
+chrUn_random	5900358
+chrX_random	1785075
+chr1_random	1231697
+chr8_random	849593
+chr17_random	628739
+chr9_random	449403
+chr13_random	400311
+chr7_random	362490
+chr5_random	357350
+chr4_random	160594
+chr3_random	41899
+chrM	16299
+chr16_random	3994
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/qPCR_regions.bed	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,13 @@
+chr15	95484590	95485290	Dbx2_region1
+chr10	20444726	20444826	Pde7b_region1
+chr10	20444876	20445026	Pde7b_region2
+chr18	58715230	58715730	Slc27a6_region1
+chr2	32816812	32817112	Rpl12_region1
+chr2	32817162	32817712	Rpl12_region2
+chr9	106331200	106331700	Rpl29_region1
+chr9	106331750	106332250	Rpl29_region2
+chr2	153116926	153117176	Kif3b_region1
+chr2	153117226	153117426	Kif3b_region2
+chr2	153117476	153117626	Kif3b_region3
+chr2	153117726	153117826	Kif3b_region4
+chr1	133049697	133049847	Eif2d_region1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/qPCR_windows.bed	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,233 @@
+chr15	95484290	95485433	Dbx2
+chr15	95484290	95484390	Dbx2_window1
+chr15	95484315	95484415	Dbx2_window2
+chr15	95484340	95484440	Dbx2_window3
+chr15	95484365	95484465	Dbx2_window4
+chr15	95484390	95484490	Dbx2_window5
+chr15	95484415	95484515	Dbx2_window6
+chr15	95484440	95484540	Dbx2_window7
+chr15	95484465	95484565	Dbx2_window8
+chr15	95484490	95484590	Dbx2_window9
+chr15	95484515	95484615	Dbx2_window10
+chr15	95484540	95484640	Dbx2_window11
+chr15	95484565	95484665	Dbx2_window12
+chr15	95484590	95484690	Dbx2_window13
+chr15	95484615	95484715	Dbx2_window14
+chr15	95484640	95484740	Dbx2_window15
+chr15	95484665	95484765	Dbx2_window16
+chr15	95484690	95484790	Dbx2_window17
+chr15	95484715	95484815	Dbx2_window18
+chr15	95484740	95484840	Dbx2_window19
+chr15	95484765	95484865	Dbx2_window20
+chr15	95484790	95484890	Dbx2_window21
+chr15	95484815	95484915	Dbx2_window22
+chr15	95484840	95484940	Dbx2_window23
+chr15	95484865	95484965	Dbx2_window24
+chr15	95484890	95484990	Dbx2_window25
+chr15	95484915	95485015	Dbx2_window26
+chr15	95484940	95485040	Dbx2_window27
+chr15	95484965	95485065	Dbx2_window28
+chr15	95484990	95485090	Dbx2_window29
+chr15	95485015	95485115	Dbx2_window30
+chr15	95485040	95485140	Dbx2_window31
+chr15	95485065	95485165	Dbx2_window32
+chr15	95485090	95485190	Dbx2_window33
+chr15	95485115	95485215	Dbx2_window34
+chr15	95485140	95485240	Dbx2_window35
+chr15	95485165	95485265	Dbx2_window36
+chr15	95485190	95485290	Dbx2_window37
+chr15	95485215	95485315	Dbx2_window38
+chr15	95485240	95485340	Dbx2_window39
+chr15	95485265	95485365	Dbx2_window40
+chr15	95485290	95485390	Dbx2_window41
+chr15	95485315	95485415	Dbx2_window42
+chr15	95485340	95485440	Dbx2_window43
+chr10	20444676	20445116	Pde7b
+chr10	20444676	20444776	Pde7b_window1
+chr10	20444701	20444801	Pde7b_window2
+chr10	20444726	20444826	Pde7b_window3
+chr10	20444751	20444851	Pde7b_window4
+chr10	20444776	20444876	Pde7b_window5
+chr10	20444801	20444901	Pde7b_window6
+chr10	20444826	20444926	Pde7b_window7
+chr10	20444851	20444951	Pde7b_window8
+chr10	20444876	20444976	Pde7b_window9
+chr10	20444901	20445001	Pde7b_window10
+chr10	20444926	20445026	Pde7b_window11
+chr10	20444951	20445051	Pde7b_window12
+chr10	20444976	20445076	Pde7b_window13
+chr10	20445001	20445101	Pde7b_window14
+chr10	20445026	20445126	Pde7b_window15
+chr18	58715130	58715849	Slc27a6
+chr18	58715130	58715230	Slc27a6_window1
+chr18	58715155	58715255	Slc27a6_window2
+chr18	58715180	58715280	Slc27a6_window3
+chr18	58715205	58715305	Slc27a6_window4
+chr18	58715230	58715330	Slc27a6_window5
+chr18	58715255	58715355	Slc27a6_window6
+chr18	58715280	58715380	Slc27a6_window7
+chr18	58715305	58715405	Slc27a6_window8
+chr18	58715330	58715430	Slc27a6_window9
+chr18	58715355	58715455	Slc27a6_window10
+chr18	58715380	58715480	Slc27a6_window11
+chr18	58715405	58715505	Slc27a6_window12
+chr18	58715430	58715530	Slc27a6_window13
+chr18	58715455	58715555	Slc27a6_window14
+chr18	58715480	58715580	Slc27a6_window15
+chr18	58715505	58715605	Slc27a6_window16
+chr18	58715530	58715630	Slc27a6_window17
+chr18	58715555	58715655	Slc27a6_window18
+chr18	58715580	58715680	Slc27a6_window19
+chr18	58715605	58715705	Slc27a6_window20
+chr18	58715630	58715730	Slc27a6_window21
+chr18	58715655	58715755	Slc27a6_window22
+chr18	58715680	58715780	Slc27a6_window23
+chr18	58715705	58715805	Slc27a6_window24
+chr18	58715730	58715830	Slc27a6_window25
+chr18	58715755	58715855	Slc27a6_window26
+chr2	32816762	32817713	Rpl12
+chr2	32816762	32816862	Rpl12_window1
+chr2	32816787	32816887	Rpl12_window2
+chr2	32816812	32816912	Rpl12_window3
+chr2	32816837	32816937	Rpl12_window4
+chr2	32816862	32816962	Rpl12_window5
+chr2	32816887	32816987	Rpl12_window6
+chr2	32816912	32817012	Rpl12_window7
+chr2	32816937	32817037	Rpl12_window8
+chr2	32816962	32817062	Rpl12_window9
+chr2	32816987	32817087	Rpl12_window10
+chr2	32817012	32817112	Rpl12_window11
+chr2	32817037	32817137	Rpl12_window12
+chr2	32817062	32817162	Rpl12_window13
+chr2	32817087	32817187	Rpl12_window14
+chr2	32817112	32817212	Rpl12_window15
+chr2	32817137	32817237	Rpl12_window16
+chr2	32817162	32817262	Rpl12_window17
+chr2	32817187	32817287	Rpl12_window18
+chr2	32817212	32817312	Rpl12_window19
+chr2	32817237	32817337	Rpl12_window20
+chr2	32817262	32817362	Rpl12_window21
+chr2	32817287	32817387	Rpl12_window22
+chr2	32817312	32817412	Rpl12_window23
+chr2	32817337	32817437	Rpl12_window24
+chr2	32817362	32817462	Rpl12_window25
+chr2	32817387	32817487	Rpl12_window26
+chr2	32817412	32817512	Rpl12_window27
+chr2	32817437	32817537	Rpl12_window28
+chr2	32817462	32817562	Rpl12_window29
+chr2	32817487	32817587	Rpl12_window30
+chr2	32817512	32817612	Rpl12_window31
+chr2	32817537	32817637	Rpl12_window32
+chr2	32817562	32817662	Rpl12_window33
+chr2	32817587	32817687	Rpl12_window34
+chr2	32817612	32817712	Rpl12_window35
+chr2	32817637	32817737	Rpl12_window36
+chr9	106331200	106332399	Rpl29
+chr9	106331200	106331300	Rpl29_window1
+chr9	106331225	106331325	Rpl29_window2
+chr9	106331250	106331350	Rpl29_window3
+chr9	106331275	106331375	Rpl29_window4
+chr9	106331300	106331400	Rpl29_window5
+chr9	106331325	106331425	Rpl29_window6
+chr9	106331350	106331450	Rpl29_window7
+chr9	106331375	106331475	Rpl29_window8
+chr9	106331400	106331500	Rpl29_window9
+chr9	106331425	106331525	Rpl29_window10
+chr9	106331450	106331550	Rpl29_window11
+chr9	106331475	106331575	Rpl29_window12
+chr9	106331500	106331600	Rpl29_window13
+chr9	106331525	106331625	Rpl29_window14
+chr9	106331550	106331650	Rpl29_window15
+chr9	106331575	106331675	Rpl29_window16
+chr9	106331600	106331700	Rpl29_window17
+chr9	106331625	106331725	Rpl29_window18
+chr9	106331650	106331750	Rpl29_window19
+chr9	106331675	106331775	Rpl29_window20
+chr9	106331700	106331800	Rpl29_window21
+chr9	106331725	106331825	Rpl29_window22
+chr9	106331750	106331850	Rpl29_window23
+chr9	106331775	106331875	Rpl29_window24
+chr9	106331800	106331900	Rpl29_window25
+chr9	106331825	106331925	Rpl29_window26
+chr9	106331850	106331950	Rpl29_window27
+chr9	106331875	106331975	Rpl29_window28
+chr9	106331900	106332000	Rpl29_window29
+chr9	106331925	106332025	Rpl29_window30
+chr9	106331950	106332050	Rpl29_window31
+chr9	106331975	106332075	Rpl29_window32
+chr9	106332000	106332100	Rpl29_window33
+chr9	106332025	106332125	Rpl29_window34
+chr9	106332050	106332150	Rpl29_window35
+chr9	106332075	106332175	Rpl29_window36
+chr9	106332100	106332200	Rpl29_window37
+chr9	106332125	106332225	Rpl29_window38
+chr9	106332150	106332250	Rpl29_window39
+chr9	106332175	106332275	Rpl29_window40
+chr9	106332200	106332300	Rpl29_window41
+chr9	106332225	106332325	Rpl29_window42
+chr9	106332250	106332350	Rpl29_window43
+chr9	106332275	106332375	Rpl29_window44
+chr9	106332300	106332400	Rpl29_window45
+chr2	153116826	153117777	Kif3b
+chr2	153116826	153116926	Kif3b_window1
+chr2	153116851	153116951	Kif3b_window2
+chr2	153116876	153116976	Kif3b_window3
+chr2	153116901	153117001	Kif3b_window4
+chr2	153116926	153117026	Kif3b_window5
+chr2	153116951	153117051	Kif3b_window6
+chr2	153116976	153117076	Kif3b_window7
+chr2	153117001	153117101	Kif3b_window8
+chr2	153117026	153117126	Kif3b_window9
+chr2	153117051	153117151	Kif3b_window10
+chr2	153117076	153117176	Kif3b_window11
+chr2	153117101	153117201	Kif3b_window12
+chr2	153117126	153117226	Kif3b_window13
+chr2	153117151	153117251	Kif3b_window14
+chr2	153117176	153117276	Kif3b_window15
+chr2	153117201	153117301	Kif3b_window16
+chr2	153117226	153117326	Kif3b_window17
+chr2	153117251	153117351	Kif3b_window18
+chr2	153117276	153117376	Kif3b_window19
+chr2	153117301	153117401	Kif3b_window20
+chr2	153117326	153117426	Kif3b_window21
+chr2	153117351	153117451	Kif3b_window22
+chr2	153117376	153117476	Kif3b_window23
+chr2	153117401	153117501	Kif3b_window24
+chr2	153117426	153117526	Kif3b_window25
+chr2	153117451	153117551	Kif3b_window26
+chr2	153117476	153117576	Kif3b_window27
+chr2	153117501	153117601	Kif3b_window28
+chr2	153117526	153117626	Kif3b_window29
+chr2	153117551	153117651	Kif3b_window30
+chr2	153117576	153117676	Kif3b_window31
+chr2	153117601	153117701	Kif3b_window32
+chr2	153117626	153117726	Kif3b_window33
+chr2	153117651	153117751	Kif3b_window34
+chr2	153117676	153117776	Kif3b_window35
+chr2	153117701	153117801	Kif3b_window36
+chr1	133049497	133050192	Eif2d
+chr1	133049497	133049597	Eif2d_window1
+chr1	133049522	133049622	Eif2d_window2
+chr1	133049547	133049647	Eif2d_window3
+chr1	133049572	133049672	Eif2d_window4
+chr1	133049597	133049697	Eif2d_window5
+chr1	133049622	133049722	Eif2d_window6
+chr1	133049647	133049747	Eif2d_window7
+chr1	133049672	133049772	Eif2d_window8
+chr1	133049697	133049797	Eif2d_window9
+chr1	133049722	133049822	Eif2d_window10
+chr1	133049747	133049847	Eif2d_window11
+chr1	133049772	133049872	Eif2d_window12
+chr1	133049797	133049897	Eif2d_window13
+chr1	133049822	133049922	Eif2d_window14
+chr1	133049847	133049947	Eif2d_window15
+chr1	133049872	133049972	Eif2d_window16
+chr1	133049897	133049997	Eif2d_window17
+chr1	133049922	133050022	Eif2d_window18
+chr1	133049947	133050047	Eif2d_window19
+chr1	133049972	133050072	Eif2d_window20
+chr1	133049997	133050097	Eif2d_window21
+chr1	133050022	133050122	Eif2d_window22
+chr1	133050047	133050147	Eif2d_window23
+chr1	133050072	133050172	Eif2d_window24
+chr1	133050097	133050197	Eif2d_window25
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/read_counts_ordered.txt	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,5 @@
+789
+1130
+615
+2047
+1920
Binary file test-data/test.bam has changed
Binary file test-data/test.bam.bai has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.bed	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,6 @@
+chr15	95484290	95485433	Dbx2
+chr10	20444676	20445116	Pde7b
+chr18	58715130	58715849	Slc27a6
+chr2	32816762	32817713	Rpl12
+chr9	106331200	106332399	Rpl29
+chr2	153116826	153117777	Kif3b
Binary file test-data/test.filter.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.readcounts.txt	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,1 @@
+test.bam	681
Binary file test-data/test_1.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,5 @@
+<tool_dependency>
+    <package name="r-base" version="3.4.2"></package>
+    <package name="samtools" version="1.3"></package>
+    <package name="bedtools" version="2.27.0.0"></package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/window_coverage.bash	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+#Requires bam files and bed file containing coordinates of peaks of interest
+#Determines regions within peaks where included fragement coverage best correlates
+#with total read count under peak.  Exports regions as bed file.
+
+#required arguements:
+#($1): series of bam files
+#($2): file names of bam files
+#($3): window bed file
+#($4): percent of window fragments must cover, default is 0.9
+#($5): output coverage file
+#($6): output spanning fragment coverage file
+
+#Usage: ATAC_qPCR_regions.bash bam_series name_list qPCR_windows.bed 0.9 combined.o.bed.coverage combined.f9.bed.coverage
+
+bam_series=$1
+name_list=$2
+qPCR_windows=$3
+percent_overlap=${4:-0.9}
+combined_o=$5
+combined_f9=$6
+
+COUNTER=0
+echo $bam_series |tr , '\n' > bam_series.txt
+echo $name_list | tr , '\n' > name_list.txt
+paste name_list.txt bam_series.txt > bam_name_list.txt
+sort -k1 bam_name_list.txt > sorted_bam_name_list.txt
+cut -f 2 sorted_bam_name_list.txt > sorted_bam_list.txt
+
+cat sorted_bam_list.txt | while read file
+do
+
+#create bed file of fragments for each bam file
+
+samtools sort -n -o - $file | samtools fixmate - - | bamToBed -i - -bedpe | cut -f 1,2,6 > "${file}".includeinsert.bed
+
+#determine window coverage for each bam file
+#combined_o: Total reads in peak/window
+#combined_f9: Spanning reads in window
+
+if [ $COUNTER -eq 0 ]
+then
+coverageBed -a $qPCR_windows -b $file | cut -f 1,2,3,4,5 > $combined_o
+coverageBed -a $qPCR_windows -b "${file}".includeinsert.bed -f $percent_overlap | cut -f 1,2,3,4,5 > $combined_f9
+
+else
+coverageBed -a $qPCR_windows -b $file | cut -f 5 > temp.o.bed.coverage
+coverageBed -a $qPCR_windows -b "${file}".includeinsert.bed -f $percent_overlap | cut -f 5 > temp.f9.bed.coverage
+paste $combined_o temp.o.bed.coverage > combined.temp.o.bed.coverage
+mv combined.temp.o.bed.coverage $combined_o
+paste $combined_f9 temp.f9.bed.coverage > combined.temp.f9.bed.coverage
+mv combined.temp.f9.bed.coverage $combined_f9
+
+rm temp.o.bed.coverage
+rm temp.f9.bed.coverage
+
+fi
+
+rm "${file}.includeinsert.bed"
+
+let COUNTER=COUNTER+1
+
+done
+
+
+rm *.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/window_coverage.xml	Sat Apr 28 15:07:26 2018 -0400
@@ -0,0 +1,38 @@
+<tool id="window_coverage" name="Calculate window coverage" version="0.1.0">
+    <description> Determines spanning and total read coverage for overlapping windows spanning peaks of interest. </description>
+    <requirements>
+        <requirement type="package" version="1.3">samtools</requirement>
+        <requirement type="package" version="2.27.0.0">bedtools</requirement>
+    </requirements>
+    <stdio>
+        <exit_code range="1:" />
+    </stdio>
+    <command><![CDATA[
+        #set input_list = '","'.join( [str( $input.name ) for $input in $input1 ] )
+        $__tool_directory__/./window_coverage.bash "$input1" "$input_list" "$input2" "$input3" "$output1" "$output2"
+    ]]></command>
+    <inputs>
+        <param type="data" name="input1" format="bam" multiple="true" label="Filtered Bam Files"/>
+        <param type="data" name="input2" format="bed" label="qPCR Window Bed File"/>
+        <param type="float" name="input3" value="0.9" label="Coverage Cutoff"/>
+    </inputs>
+    <outputs>
+        <data name="output1" format="bed" label="Coverage Bed File"/>
+        <data name="output2" format="bed" label="Spanning Fragment Coverage Bed File" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input1" value="Ch1-1.pe.q10.sort.bam.rmdup.filter.bam,Ch13-1.pe.q10.sort.rmdup.filter.bam"/>
+            <param name="input2" value="qPCR_windows.bed" />
+            <param name="input3" value="0.9" />
+            <output name="output1" file="combined.o.coverage"/>
+            <output name="output2" file="combined.f9.coverage"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+        This tools takes a series of bam files and a bed file of overlapping windows spanning peaks of interest and determines the read coverage and spanning fragment coverage for each window.  
+    ]]></help>
+    <citations>
+        <citation type="doi">doi:10.1038/nmeth.4663</citation>
+    </citations>
+</tool>