changeset 0:8600bfe7ed52 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cwpair2 commit e96df94dba60050fa28aaf55b5bb095717a5f260
author iuc
date Tue, 22 Dec 2015 17:03:46 -0500
parents
children d4db13c9dd7f
files cwpair2.py cwpair2.xml cwpair2_macros.xml cwpair2_util.py static/images/cwpair2.png test-data/closest_d_output2.tabular test-data/closest_f_output2.pdf test-data/closest_mp_output1.gff test-data/closest_mp_output2.gff test-data/closest_o_output2.tabular test-data/cwpair2_input1.gff test-data/largest_d_output2.tabular test-data/largest_f_output2.pdf test-data/largest_mp_output1.gff test-data/largest_mp_output2.gff test-data/largest_o_output2.tabular test-data/mode_c_output2.pdf test-data/mode_d_output2.tabular test-data/mode_f_output2.pdf test-data/mode_mp_output1.gff test-data/mode_mp_output2.gff test-data/mode_o_output2.tabular test-data/mode_p_output2.pdf test-data/statistics1.tabular test-data/statistics2.tabular tool_dependencies.xml
diffstat 26 files changed, 2044 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cwpair2.py	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,68 @@
+"""
+cwpair2.py
+
+Takes a list of called peaks on both strands and produces a list of matched pairs and a list
+of unmatched orphans using a specified method for finding matched pairs.  Methods for finding
+matched pairs are mode, closest, largest or all, where the analysis is run for each method
+
+Input: list of one or more gff format files
+
+Output: files produced for each input/mode combination:
+MP (matched_pair), D (details), O (orphans), P (frequency preview plot), F (frequency final plot),
+C (statistics graph), statistics.tabular
+"""
+
+import argparse
+import csv
+import cwpair2_util
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--input', dest='inputs', action='append', nargs=2, help="Input datasets")
+    parser.add_argument('--method', dest='method', default='mode', help='Method of finding match.')
+    parser.add_argument('--up_distance', dest='up_distance', type=int, default=50, help='Distance upstream from a pair.')
+    parser.add_argument('--down_distance', dest='down_distance', type=int, default=100, help='Distance downstream of a pair.')
+    parser.add_argument('--binsize', dest='binsize', type=int, default=1, help='Width of bins for plots and mode.')
+    parser.add_argument('--threshold_format', dest='threshold_format', help='Percentage to filter the 95th percentile.')
+    parser.add_argument('--relative_threshold', dest='relative_threshold', type=float, default=0.0, help='Percentage to filter the 95th percentile.')
+    parser.add_argument('--absolute_threshold', dest='absolute_threshold', type=float, default=0.0, help='Absolute value to filter.')
+    parser.add_argument('--output_files', dest='output_files', default='matched_pair', help='Restrict output dataset collections.')
+    parser.add_argument('--statistics_output', dest='statistics_output', help='Statistics output file.')
+    args = parser.parse_args()
+
+    cwpair2_util.create_directories()
+
+    statistics = []
+    if args.absolute_threshold > 0:
+        threshold = args.absolute_threshold
+    elif args.relative_threshold > 0:
+        threshold = args.relative_threshold / 100.0
+    else:
+        threshold = 0
+    for (dataset_path, hid) in args.inputs:
+        stats = cwpair2_util.process_file(dataset_path,
+                                          hid,
+                                          args.method,
+                                          threshold,
+                                          args.up_distance,
+                                          args.down_distance,
+                                          args.binsize,
+                                          args.output_files)
+        statistics.extend(stats)
+    # Accumulate statistics.
+    by_file = {}
+    for stats in statistics:
+        # Skip "None" statistics from failed files
+        if not stats:
+            continue
+        path = stats['stats_path']
+        if path not in by_file:
+            by_file[path] = []
+        by_file[path].append(stats)
+    # Write tabular statistics file.
+    keys = ['fname', 'final_mode', 'preview_mode', 'perc95', 'paired', 'orphans']
+    statistics_out = csv.writer(open(args.statistics_output, 'wt'), delimiter='\t')
+    statistics_out.writerow(keys)
+    for file_path, statistics in by_file.items():
+        for stats in statistics:
+            statistics_out.writerow([stats[key] for key in keys])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cwpair2.xml	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,185 @@
+<?xml version="1.0"?>
+<tool id="cwpair2" name="CWPair2" version="@WRAPPER_VERSION@.0">
+    <description>find matched pairs and unmatched orphans</description>
+    <macros>
+        <import>cwpair2_macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <command>
+        <![CDATA[
+            python $__tool_directory__/cwpair2.py
+            #for $i in $input:
+                 --input "${i}" "${i.hid}"
+            #end for
+            --up_distance $up_distance
+            --down_distance $down_distance
+            --method $method
+            --binsize $binsize
+            --threshold_format $threshold_format_cond.threshold_format
+            #if str($threshold_format_cond.threshold_format) == "absolute_threshold":
+                --absolute_threshold $threshold_format_cond.absolute_threshold
+            #elif str($threshold_format_cond.threshold_format) == "relative_threshold":
+                --relative_threshold $threshold_format_cond.relative_threshold
+            #end if
+            --output_files $output_files
+            --statistics_output "$statistics_output"
+        ]]>
+    </command>
+    <inputs>
+        <param  name="input" type="data" format="gff" multiple="True" label="Find matched pairs on" />
+        <param name="up_distance" type="integer" value="50" min="0" label="Distance upstream from a peak to allow a pair" help="The maximum distance upstream or 5’ to the primary peak"/>
+        <param name="down_distance" type="integer" value="100" min="0" label="Distance downstream from a peak to allow a pair" help="The maximum distance downstream or 3’ to the primary peak"/>
+        <param name="method" type="select" label="Method of finding a match">
+            <option value="mode" selected="True">Mode</option>
+            <option value="closest">Closest</option>
+            <option value="largest">Largest</option>
+            <option value="all">All</option>
+        </param>
+        <param name="binsize" type="integer" value="1" min="0" label="Width of bins for frequency plots and mode calculation" help="Value 1 implies no bins" />
+        <conditional name="threshold_format_cond">
+            <param name="threshold_format" type="select" label="Filter using">
+                <option value="relative_threshold" selected="True">Relative threshold</option>
+                <option value="absolute_threshold">Absolute threshold</option>
+            </param>
+            <when value="relative_threshold">
+                <param  name="relative_threshold" type="float" value="0.0" min="0.0" label="Percentage of the 95 percentile value to filter below" help="Value 0 results in no filtering" />
+            </when>
+            <when value="absolute_threshold">
+                <param name="absolute_threshold" type="float" value="0.0" min="0.0" label="Absolute value to filter below" />
+            </when>
+        </conditional>
+        <param name="output_files" type="select" label="Please select the output you want to have" help="Statistics will always be generated." >
+            <option value="all" selected="True">no restrictions (output everything: C,D,F,O,P,MP)</option>
+            <option value="matched_pair">matched pairs only (MP)</option>
+            <option value="matched_pair_orphan">matched pairs and orphans only (O,MP)</option>
+            <option value="matched_pair_orphan_detail">matched pairs, orphans and details only (D,O,MP)</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data name="statistics_output" format="tabular" label="Statistics Table: ${tool.name} on ${on_string}" />
+        <collection name="H" type="list" label="Statistics Histogram: ${tool.name} on ${on_string}">
+            <filter>output_files == "all"</filter>
+            <discover_datasets pattern="(?P&lt;designation&gt;.*)" directory="H" ext="pdf" visible="false" />
+        </collection>
+        <collection name="D" type="list" label="Data D: ${tool.name} on ${on_string}">
+            <filter>output_files in ["all", "matched_pair_orphan_detail"]</filter>
+            <discover_datasets pattern="(?P&lt;designation&gt;.*)" directory="data_D" ext="tabular" visible="false" />
+        </collection>
+        <collection name="O" type="list" label="Data O: ${tool.name} on ${on_string}">
+            <filter>output_files in ["all", "matched_pair_orphan", "matched_pair_orphan_detail"]</filter>
+            <discover_datasets pattern="(?P&lt;designation&gt;.*)" directory="data_O" ext="tabular" visible="false" />
+        </collection>
+        <collection name="MP" type="list" label="Data MP: ${tool.name} on ${on_string}">
+            <discover_datasets pattern="(?P&lt;designation&gt;.*)" directory="data_MP" ext="gff" visible="false" />
+        </collection>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input" value="cwpair2_input1.gff" />
+            <param name="up_distance" value="25" />
+            <param name="down_distance" value="100" />
+            <param name="method" value="all" />
+            <param name="binsize" value="1" />
+            <param name="threshold_format" value="relative_threshold" />
+            <param name="relative_threshold" value="0.0" />
+            <param name="output_files" value="matched_pair" />
+            <output name="statistics_output" file="statistics1.tabular" ftype="tabular" />
+            <output_collection name="MP" type="list">
+                <element name="f0u25d100_on_data_1" file="closest_mp_output1.gff" ftype="gff" compare="contains"/>
+                <element name="f0u25d100_on_data_1" file="largest_mp_output1.gff" ftype="gff" compare="contains"/>
+                <element name="f0u25d100_on_data_1" file="mode_mp_output1.gff" ftype="gff" compare="contains"/>
+            </output_collection>
+        </test>
+        <test>
+            <param name="input" value="cwpair2_input1.gff" />
+            <param name="up_distance" value="50" />
+            <param name="down_distance" value="100" />
+            <param name="method" value="all" />
+            <param name="binsize" value="1" />
+            <param name="threshold_format" value="relative_threshold" />
+            <param name="relative_threshold" value="0.0" />
+            <param name="output_files" value="all" />
+            <output name="statistics_output" file="statistics2.tabular" ftype="tabular" />
+            <output_collection name="H" type="list">
+                <element name="histogram_C_mode_f0u50d100_on_data_1" file="mode_c_output2.pdf" ftype="pdf" compare="contains" lines_diff="12"/>
+                <element name="histogram_F_closest_f0u50d100_on_data_1" file="closest_f_output2.pdf" ftype="pdf" compare="contains" lines_diff="12"/>
+                <element name="histogram_F_largest_f0u50d100_on_data_1" file="largest_f_output2.pdf" ftype="pdf" compare="contains" lines_diff="12"/>
+                <element name="histogram_F_mode_f0u50d100_on_data_1" file="mode_f_output2.pdf" ftype="pdf" compare="contains" lines_diff="12"/>
+                <element name="histogram_P_mode_f0u50d100_on_data_1" file="mode_p_output2.pdf" ftype="pdf" compare="contains" lines_diff="12"/>
+            </output_collection>
+            <output_collection name="D" type="list">
+                <element name="data_D_closest_f0u50d100_on_data_1" file="closest_d_output2.tabular" ftype="tabular" compare="comntains"/>
+                <element name="data_D_largest_f0u50d100_on_data_1" file="largest_d_output2.tabular" ftype="tabular" compare="contains"/>
+                <element name="data_D_mode_f0u50d100_on_data_1" file="mode_d_output2.tabular" ftype="tabular" compare="contains"/>
+            </output_collection>
+            <output_collection name="O" type="list">
+                <element name="data_O_closest_f0u50d100_on_data_1" file="closest_o_output2.tabular" ftype="tabular" compare="contains"/>
+                <element name="data_O_largest_f0u50d100_on_data_1" file="largest_o_output2.tabular" ftype="tabular" compare="contains"/>
+                <element name="data_O_mode_f0u50d100_on_data_1" file="mode_o_output2.tabular" ftype="tabular" compare="contains"/>
+            </output_collection>
+            <output_collection name="MP" type="list">
+                <element name="data_MP_closest_f0u50d100_on_data_1" file="closest_mp_output2.gff" ftype="gff" compare="contains"/>
+                <element name="data_MP_largest_f0u50d100_on_data_1" file="largest_mp_output2.gff" ftype="gff" compare="contains"/>
+                <element name="data_MP_mode_f0u50d100_on_data_1" file="mode_mp_output2.gff" ftype="gff" compare="contains"/>
+            </output_collection>
+        </test>
+    </tests>
+    <help>
+**What it does**
+
+CWPair accepts one or more gff files as input and takes the peak location to be the midpoint between the
+exclusion zone start and end coordinate (columns D and E).  CWPair starts with the highest peak (primary peak)
+in the dataset, and then looks on the opposite strand for another peak located within the distance defined by
+a combination of the tool's **Distance upstream from a peak to allow a pair** (the distance upstream or 5’ to
+the primary peak) and **Distance downstream from a peak to allow a pair** (the distance downstream or 3’ to the
+primary peak) parameters.  So "upstream" value 30 "downstream" value 20 makes the tool look 30 bp upstream and
+20 bp downstream (inclusive).  Consequently, the search space would be 51 bp, since it includes the primary peak
+coordinate.  The use of a negative number changes the direction of the search limits.  So, "upstream" -30 and
+"downstream" 20 produces an 11 bp downstream search window (20-30 bp downstream, inclusive).
+
+.. image:: $PATH_TO_IMAGES/cwpair2.png
+
+When encountering multiple candidate peaks within the search window, CWPair uses the resolution method defined by
+the tool's **Method of finding a match** parameter as follows:
+
+
+ * **mode** - This is an iterative process in which all peak-pair distances within the search window are determined, and the mode calculated.  The pair whose distance apart is closest to the mode is then selected.
+ * **closest** - Pairs the peak that has the closest absolute distance from the primary peak.
+ * **largest** - Pairs the peak that has the highest tag count.
+ * **all** -  Runs all three methods, producing separate outputs for each.
+
+When considering the candidate peaks for pairing to a primary peak, a tag-count threshold may also be set using
+the tool's **Filter using relative/absolute threshold** parameter.  A relative threshold determines the tag counts
+at the 95th percentile of peak occupancy (i.e. top 5% in terms of tag counts), then uses a tag count threshold at
+the specified percentage of this 95th percentile.  So if the peak at the 95th percentile has 200 tags, and "relative
+threshold" 50 is used, then it will not consider any peak having less than 100 tags.
+
+-----
+
+**Options**
+
+ * **Method of finding match** - Method of finding matched pair, mode, closest, largest, or all (run with each method).
+ * **Distance upstream from a peak to allow a pair** - The maximum distance (inclusive) upstream on the opposite strand from the primary peak to locate another peak, resulting in a pair.
+ * **Distance downstream from a peak to allow a pair** - The maximum distance (inclusive) downstream on the opposite strand from the primary peak to locate another peak, resulting in a pair.
+ * **Percentage of the 95 percentile value to filter below** - Percentage of the 95 percentile value below which to filter when using a relative threshold.
+ * **Absolute value to filter below** - Absolute value below which to filter when using an absolute threshold.
+ * **Output files** - Restrict output dataset collections to matched pairs only or one of several combinations of collection types.
+ 
+-----
+
+**Output Data Files**
+
+ * **closest/largest/mode MP** - gff file containing the Matched Pairs and includes the peak-pair midpoint coordinate (column D) and the coordinate +1 (column E).  The tag count sum is reported in column F, along with the C-W distance in bp in column I.
+ * **closest/largest/mode O** - tabular file containing the Orphans (all peaks that are not in pairs).
+ * **closest/largest/mode D** - tabular file containing the Details, which lists + and – strand information separately.  The start and end represent the lower and higher coordinates of the exclusion zone from GeneTrack, and “Value” is the tag count sum within the exclusion zone.  The peak pair midpoint is calculated along with the distance between the two paired peaks (midpoint-to-midpoint or C-W distance).
+
+**Output Statistics Files**
+
+ * **closest/largest/mode C** - pdf file that provides the frequency distribution of peak pair distances.
+ * **closest/largest/mode P** - pdf file that provides the preview plots graph (the initial iteration of the process for finding the mode).
+ * **closest/largest/mode F** - pdf file that provides the final plots graph.
+ * **Statistics Table** - provides the number of peaks in pairs (dividing this by 2 provides the number of peak-pairs).
+
+    </help>
+    <expand macro="citations" />
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cwpair2_macros.xml	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,29 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<macros>
+    <token name="@WRAPPER_VERSION@">1.0</token>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="2.3.0">anaconda</requirement>
+        </requirements>
+    </xml>
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:"/>
+            <exit_code range=":-1"/>
+            <regex match="Error:"/>
+            <regex match="Exception:"/>
+        </stdio>
+    </xml>
+    <xml name="citations">
+        <citations>
+            <citation type="bibtex">
+                @unpublished{None,
+                author = {None},
+                title = {None},
+                year = {None},
+                eprint = {None},
+                url = {http://www.huck.psu.edu/content/research/independent-centers-excellence/center-for-eukaryotic-gene-regulation}
+            }</citation>
+        </citations>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cwpair2_util.py	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,393 @@
+import bisect
+import csv
+import os
+import sys
+import traceback
+import matplotlib
+matplotlib.use('Agg')
+from matplotlib import pyplot
+
+# Data outputs
+DETAILS = 'D'
+MATCHED_PAIRS = 'MP'
+ORPHANS = 'O'
+# Data output formats
+GFF_EXT = 'gff'
+TABULAR_EXT = 'tabular'
+# Statistics historgrams output directory.
+HISTOGRAM = 'H'
+# Statistics outputs
+FINAL_PLOTS = 'F'
+PREVIEW_PLOTS = 'P'
+STATS_GRAPH = 'C'
+
+# Graph settings.
+COLORS = 'krg'
+Y_LABEL = 'Peak-pair counts'
+X_LABEL = 'Peak-pair distance (bp)'
+TICK_WIDTH = 3
+ADJUST = [0.140, 0.9, 0.9, 0.1]
+PLOT_FORMAT = 'pdf'
+pyplot.rc('xtick.major', size=10.00)
+pyplot.rc('ytick.major', size=10.00)
+pyplot.rc('lines', linewidth=4.00)
+pyplot.rc('axes', linewidth=3.00)
+pyplot.rc('font', family='Bitstream Vera Sans', size=32.0)
+
+
+class FrequencyDistribution(object):
+
+    def __init__(self, start, end, binsize=10, d=None):
+        self.start = start
+        self.end = end
+        self.dist = d or {}
+        self.binsize = binsize
+
+    def get_bin(self, x):
+        """
+        Returns the bin in which a data point falls
+        """
+        return self.start + (x-self.start) // self.binsize * self.binsize + self.binsize/2.0
+
+    def add(self, x):
+        x = self.get_bin(x)
+        self.dist[x] = self.dist.get(x, 0) + 1
+
+    def graph_series(self):
+        x = []
+        y = []
+        for i in range(self.start, self.end, self.binsize):
+            center = self.get_bin(i)
+            x.append(center)
+            y.append(self.dist.get(center, 0))
+        return x, y
+
+    def mode(self):
+        return max(self.dist.items(), key=lambda data: data[1])[0]
+
+    def size(self):
+        return sum(self.dist.values())
+
+
+def stop_err(msg):
+    sys.stderr.write(msg)
+    sys.exit(1)
+
+
+def distance(peak1, peak2):
+    return (peak2[1]+peak2[2])/2 - (peak1[1]+peak1[2])/2
+
+
+def gff_row(cname, start, end, score, source, type='.', strand='.', phase='.', attrs={}):
+    return (cname, source, type, start, end, score, strand, phase, gff_attrs(attrs))
+
+
+def gff_attrs(d):
+    if not d:
+        return '.'
+    return ';'.join('%s=%s' % item for item in d.items())
+
+
+def parse_chromosomes(reader):
+    # This version of cwpair2 accepts only gff format as input.
+    chromosomes = {}
+    reader.next()
+    for line in reader:
+        cname, junk, junk, start, end, value, strand, junk, junk = line
+        start = int(start)
+        end = int(end)
+        value = float(value)
+        if cname not in chromosomes:
+            chromosomes[cname] = []
+        peaks = chromosomes[cname]
+        peaks.append((strand, start, end, value))
+    return chromosomes
+
+
+def perc95(chromosomes):
+    """
+    Returns the 95th percentile value of the given chromosomes.
+    """
+    values = []
+    for peaks in chromosomes.values():
+        for peak in peaks:
+            values.append(peak[3])
+    values.sort()
+    # Get 95% value
+    return values[int(len(values)*0.95)]
+
+
+def filter(chromosomes, threshold=0.05):
+    """
+    Filters the peaks to those above a threshold. Threshold < 1.0 is interpreted
+    as a proportion of the maximum, >=1.0 as an absolute value.
+    """
+    if threshold < 1:
+        p95 = perc95(chromosomes)
+        threshold = p95 * threshold
+        # Make the threshold a proportion of the
+    for cname, peaks in chromosomes.items():
+        chromosomes[cname] = [peak for peak in peaks if peak[3] > threshold]
+
+
+def split_strands(chromosome):
+    watson = [peak for peak in chromosome if peak[0] == '+']
+    crick = [peak for peak in chromosome if peak[0] == '-']
+    return watson, crick
+
+
+def all_pair_distribution(chromosomes, up_distance, down_distance, binsize):
+    dist = FrequencyDistribution(-up_distance, down_distance, binsize=binsize)
+    for cname, data in chromosomes.items():
+        watson, crick = split_strands(data)
+        crick.sort(key=lambda data: float(data[1]))
+        keys = make_keys(crick)
+        for peak in watson:
+            for cpeak in get_window(crick, peak, up_distance, down_distance, keys):
+                dist.add(distance(peak, cpeak))
+    return dist
+
+
+def make_keys(crick):
+    return [(data[1] + data[2])//2 for data in crick]
+
+
+def get_window(crick, peak, up_distance, down_distance, keys=None):
+    """
+    Returns a window of all crick peaks within a distance of a watson peak.
+    crick strand MUST be sorted by distance
+    """
+    strand, start, end, value = peak
+    midpoint = (start + end) // 2
+    lower = midpoint - up_distance
+    upper = midpoint + down_distance
+    keys = keys or make_keys(crick)
+    start_index = bisect.bisect_left(keys, lower)
+    end_index = bisect.bisect_right(keys, upper)
+    return [cpeak for cpeak in crick[start_index:end_index]]
+
+
+def match_largest(window, peak):
+    if not window:
+        return None
+    return max(window, key=lambda cpeak: cpeak[3])
+
+
+def match_closest(window, peak):
+    if not window:
+        return None
+
+    def key(cpeak):
+        d = distance(peak, cpeak)
+        # Search negative distances last
+        if d < 0:
+            # And then prefer less negative distances
+            d = 10000 - d
+        return d
+    return min(window, key=key)
+
+
+def match_mode(window, peak, mode):
+    if not window:
+        return None
+    return min(window, key=lambda cpeak: abs(distance(peak, cpeak)-mode))
+
+METHODS = {'mode': match_mode, 'closest': match_closest, 'largest': match_largest}
+
+
+def frequency_plot(freqs, fname, labels=[], title=''):
+    pyplot.clf()
+    pyplot.figure(figsize=(10, 10))
+    for i, freq in enumerate(freqs):
+        x, y = freq.graph_series()
+        pyplot.plot(x, y, '%s-' % COLORS[i])
+    if len(freqs) > 1:
+        pyplot.legend(labels)
+    pyplot.xlim(freq.start, freq.end)
+    pyplot.ylim(ymin=0)
+    pyplot.ylabel(Y_LABEL)
+    pyplot.xlabel(X_LABEL)
+    pyplot.subplots_adjust(left=ADJUST[0], right=ADJUST[1], top=ADJUST[2], bottom=ADJUST[3])
+    # Get the current axes
+    ax = pyplot.gca()
+    for l in ax.get_xticklines() + ax.get_yticklines():
+        l.set_markeredgewidth(TICK_WIDTH)
+    pyplot.savefig(fname)
+
+
+def create_directories():
+    # Output histograms in pdf.
+    os.mkdir(HISTOGRAM)
+    os.mkdir('data_%s' % DETAILS)
+    os.mkdir('data_%s' % ORPHANS)
+    os.mkdir('data_%s' % MATCHED_PAIRS)
+
+
+def process_file(dataset_path, galaxy_hid, method, threshold, up_distance,
+                 down_distance, binsize, output_files):
+    if method == 'all':
+        match_methods = METHODS.keys()
+    else:
+        match_methods = [method]
+    statistics = []
+    for match_method in match_methods:
+        stats = perform_process(dataset_path,
+                                galaxy_hid,
+                                match_method,
+                                threshold,
+                                up_distance,
+                                down_distance,
+                                binsize,
+                                output_files)
+        statistics.append(stats)
+    if output_files == 'all' and method == 'all':
+        frequency_plot([s['dist'] for s in statistics],
+                       statistics[0]['graph_path'],
+                       labels=METHODS.keys())
+    return statistics
+
+
+def perform_process(dataset_path, galaxy_hid, method, threshold, up_distance,
+                    down_distance, binsize, output_files):
+    output_details = output_files in ["all", "matched_pair_orphan_detail"]
+    output_plots = output_files in ["all"]
+    output_orphans = output_files in ["all", "matched_pair_orphan", "matched_pair_orphan_detail"]
+    # Keep track of statistics for the output file
+    statistics = {}
+    input = csv.reader(open(dataset_path, 'rt'), delimiter='\t')
+    fpath, fname = os.path.split(dataset_path)
+    statistics['fname'] = '%s: data %s' % (method, str(galaxy_hid))
+    statistics['dir'] = fpath
+    if threshold >= 1:
+        filter_string = 'fa%d' % threshold
+    else:
+        filter_string = 'f%d' % (threshold * 100)
+    fname = '%s_%su%dd%d_on_data_%s' % (method, filter_string, up_distance, down_distance, galaxy_hid)
+
+    def make_histogram_path(output_type, fname):
+        return os.path.join(HISTOGRAM, 'histogram_%s_%s.%s' % (output_type, fname, PLOT_FORMAT))
+
+    def make_path(output_type, extension, fname):
+        # Returns the full path for an output.
+        return os.path.join(output_type, '%s_%s.%s' % (output_type, fname, extension))
+
+    def td_writer(output_type, extension, fname):
+        # Returns a tab-delimited writer for a specified output.
+        output_file_path = make_path(output_type, extension, fname)
+        return csv.writer(open(output_file_path, 'wt'), delimiter='\t')
+
+    try:
+        chromosomes = parse_chromosomes(input)
+    except Exception:
+        stop_err('Unable to parse file "%s".\n%s' % (dataset_path, traceback.format_exc()))
+    if output_details:
+        # Details
+        detailed_output = td_writer('data_%s' % DETAILS, TABULAR_EXT, fname)
+        detailed_output.writerow(('chrom', 'start', 'end', 'value', 'strand') * 2 + ('midpoint', 'c-w reads sum', 'c-w distance (bp)'))
+    if output_plots:
+        # Final Plot
+        final_plot_path = make_histogram_path(FINAL_PLOTS, fname)
+    if output_orphans:
+        # Orphans
+        orphan_output = td_writer('data_%s' % ORPHANS, TABULAR_EXT, fname)
+        orphan_output.writerow(('chrom', 'strand', 'start', 'end', 'value'))
+    if output_plots:
+        # Preview Plot
+        preview_plot_path = make_histogram_path(PREVIEW_PLOTS, fname)
+    # Matched Pairs.
+    matched_pairs_output = td_writer('data_%s' % MATCHED_PAIRS, GFF_EXT, fname)
+    statistics['stats_path'] = 'statistics.%s' % TABULAR_EXT
+    if output_plots:
+        statistics['graph_path'] = make_histogram_path(STATS_GRAPH, fname)
+    statistics['perc95'] = perc95(chromosomes)
+    if threshold > 0:
+        # Apply filter
+        filter(chromosomes, threshold)
+    if method == 'mode':
+        freq = all_pair_distribution(chromosomes, up_distance, down_distance, binsize)
+        mode = freq.mode()
+        statistics['preview_mode'] = mode
+        if output_plots:
+            frequency_plot([freq], preview_plot_path, title='Preview frequency plot')
+    else:
+        statistics['preview_mode'] = 'NA'
+    dist = FrequencyDistribution(-up_distance, down_distance, binsize=binsize)
+    orphans = 0
+    # x will be used to archive the summary dataset
+    x = []
+    for cname, chromosome in chromosomes.items():
+        # Each peak is (strand, start, end, value)
+        watson, crick = split_strands(chromosome)
+        # Sort by value of each peak
+        watson.sort(key=lambda data: -float(data[3]))
+        # Sort by position to facilitate binary search
+        crick.sort(key=lambda data: float(data[1]))
+        keys = make_keys(crick)
+        for peak in watson:
+            window = get_window(crick, peak, up_distance, down_distance, keys)
+            if method == 'mode':
+                match = match_mode(window, peak, mode)
+            else:
+                match = METHODS[method](window, peak)
+            if match:
+                midpoint = (match[1] + match[2] + peak[1] + peak[2]) // 4
+                d = distance(peak, match)
+                dist.add(d)
+                # Simple output in gff format.
+                x.append(gff_row(cname,
+                                 source='cwpair',
+                                 start=midpoint,
+                                 end=midpoint + 1,
+                                 score=peak[3] + match[3],
+                                 attrs={'cw_distance': d}))
+                if output_details:
+                    detailed_output.writerow((cname,
+                                              peak[1],
+                                              peak[2],
+                                              peak[3],
+                                              '+',
+                                              cname,
+                                              match[1],
+                                              match[2],
+                                              match[3], '-',
+                                              midpoint,
+                                              peak[3]+match[3],
+                                              d))
+                i = bisect.bisect_left(keys, (match[1]+match[2])/2)
+                del crick[i]
+                del keys[i]
+            else:
+                if output_orphans:
+                    orphan_output.writerow((cname, peak[0], peak[1], peak[2], peak[3]))
+                # Keep track of orphans for statistics.
+                orphans += 1
+        # Remaining crick peaks are orphans
+        if output_orphans:
+            for cpeak in crick:
+                orphan_output.writerow((cname, cpeak[0], cpeak[1], cpeak[2], cpeak[3]))
+        # Keep track of orphans for statistics.
+        orphans += len(crick)
+    # Sort output descending by score.
+    x.sort(key=lambda data: float(data[5]), reverse=True)
+    # Writing a summary to gff format file
+    for row in x:
+        row_tmp = list(row)
+        # Dataset in tuple cannot be modified in Python, so row will
+        # be converted to list format to add 'chr'.
+        if row_tmp[0] == "999":
+            row_tmp[0] = 'chrM'
+        elif row_tmp[0] == "998":
+            row_tmp[0] = 'chrY'
+        elif row_tmp[0] == "997":
+            row_tmp[0] = 'chrX'
+        else:
+            row_tmp[0] = row_tmp[0]
+        # Print row_tmp.
+        matched_pairs_output.writerow(row_tmp)
+    statistics['paired'] = dist.size() * 2
+    statistics['orphans'] = orphans
+    statistics['final_mode'] = dist.mode()
+    if output_plots:
+        frequency_plot([dist], final_plot_path, title='Frequency distribution')
+    statistics['dist'] = dist
+    return statistics
Binary file static/images/cwpair2.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/closest_d_output2.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,66 @@
+chrom	start	end	value	strand	chrom	start	end	value	strand	midpoint	c-w reads sum	c-w distance (bp)
+chr1	87147	87167	3492.0	+	chr1	87158	87178	2039.0	-	87162	5531.0	11
+chr1	87	107	3211.0	+	chr1	139	159	993.0	-	123	4204.0	52
+chr1	48	68	2842.0	+	chr1	50	70	39.0	-	59	2881.0	2
+chr1	255	275	2810.0	+	chr1	261	281	1278.0	-	268	4088.0	6
+chr1	117	137	2163.0	+	chr1	176	196	14.0	-	156	2177.0	59
+chr1	86954	86974	1948.0	+	chr1	86991	87011	65.0	-	86982	2013.0	37
+chr1	169107	169127	1811.0	+	chr1	169064	169084	76.0	-	169095	1887.0	-43
+chr1	87171	87191	1436.0	+	chr1	87198	87218	2207.0	-	87194	3643.0	27
+chr1	201	221	1411.0	+	chr1	215	235	2611.0	-	218	4022.0	14
+chr1	229741	229761	1380.0	+	chr1	229757	229777	3151.0	-	229759	4531.0	16
+chr1	185076	185096	1309.0	+	chr1	185122	185142	62.0	-	185109	1371.0	46
+chr1	39081	39101	1268.0	+	chr1	39052	39072	82.0	-	39076	1350.0	-29
+chr1	92411	92431	1252.0	+	chr1	92411	92431	136.0	-	92421	1388.0	0
+chr1	203872	203892	1234.0	+	chr1	203835	203855	242.0	-	203863	1476.0	-37
+chr1	70776	70796	1148.0	+	chr1	70788	70808	998.0	-	70792	2146.0	12
+chr1	231	251	1146.0	+	chr1	279	299	1328.0	-	265	2474.0	48
+chr1	87098	87118	1125.0	+	chr1	87101	87121	1134.0	-	87109	2259.0	3
+chr1	6163	6183	1049.0	+	chr1	6254	6274	1076.0	-	6218	2125.0	91
+chr1	25246	25266	995.0	+	chr1	25345	25365	188.0	-	25305	1183.0	99
+chr1	101411	101431	973.0	+	chr1	101367	101387	1388.0	-	101399	2361.0	-44
+chr1	139213	139233	965.0	+	chr1	139228	139248	214.0	-	139230	1179.0	15
+chr1	87019	87039	769.0	+	chr1	87049	87069	422.0	-	87044	1191.0	30
+chr1	124318	124338	749.0	+	chr1	124275	124295	12.0	-	124306	761.0	-43
+chr1	348	368	699.0	+	chr1	373	393	200.0	-	370	899.0	25
+chr1	92543	92563	699.0	+	chr1	92571	92591	90.0	-	92567	789.0	28
+chr1	138868	138888	698.0	+	chr1	138864	138884	13.0	-	138876	711.0	-4
+chr1	307	327	685.0	+	chr1	323	343	486.0	-	325	1171.0	16
+chr1	6413	6433	682.0	+	chr1	6476	6496	567.0	-	6454	1249.0	63
+chr1	72781	72801	657.0	+	chr1	72810	72830	212.0	-	72805	869.0	29
+chr1	22571	22591	609.0	+	chr1	22569	22589	254.0	-	22580	863.0	-2
+chr1	65152	65172	575.0	+	chr1	65148	65168	43.0	-	65160	618.0	-4
+chr1	106034	106054	558.0	+	chr1	106041	106061	14.0	-	106047	572.0	7
+chr1	155028	155048	522.0	+	chr1	155111	155131	1051.0	-	155079	1573.0	83
+chr1	32449	32469	476.0	+	chr1	32497	32517	2.0	-	32483	478.0	48
+chr1	6706	6726	431.0	+	chr1	6702	6722	2.0	-	6714	433.0	-4
+chr1	113782	113802	420.0	+	chr1	113762	113782	296.0	-	113782	716.0	-20
+chr1	228633	228653	371.0	+	chr1	228691	228711	255.0	-	228672	626.0	58
+chr1	438	458	334.0	+	chr1	446	466	170.0	-	452	504.0	8
+chr1	72671	72691	304.0	+	chr1	72771	72791	406.0	-	72731	710.0	100
+chr1	170119	170139	284.0	+	chr1	170129	170149	373.0	-	170134	657.0	10
+chr1	92631	92651	260.0	+	chr1	92639	92659	2137.0	-	92645	2397.0	8
+chr1	136366	136386	248.0	+	chr1	136352	136372	117.0	-	136369	365.0	-14
+chr1	108624	108644	206.0	+	chr1	108579	108599	367.0	-	108611	573.0	-45
+chr1	45678	45698	198.0	+	chr1	45643	45663	295.0	-	45670	493.0	-35
+chr1	368	388	192.0	+	chr1	388	408	167.0	-	388	359.0	20
+chr1	682	702	168.0	+	chr1	634	654	151.0	-	668	319.0	-48
+chr1	59190	59210	168.0	+	chr1	59246	59266	397.0	-	59228	565.0	56
+chr1	134170	134190	151.0	+	chr1	134270	134290	508.0	-	134230	659.0	100
+chr1	55495	55515	125.0	+	chr1	55581	55601	831.0	-	55548	956.0	86
+chr1	512	532	101.0	+	chr1	468	488	468.0	-	500	569.0	-44
+chr1	39197	39217	101.0	+	chr1	39258	39278	261.0	-	39237	362.0	61
+chr1	229721	229741	84.0	+	chr1	229784	229804	615.0	-	229762	699.0	63
+chr1	116660	116680	74.0	+	chr1	116619	116639	699.0	-	116649	773.0	-41
+chr1	19216	19236	42.0	+	chr1	19191	19211	736.0	-	19213	778.0	-25
+chr1	230110	230130	42.0	+	chr1	230120	230140	2.0	-	230125	44.0	10
+chr1	31627	31647	40.0	+	chr1	31693	31713	450.0	-	31670	490.0	66
+chr1	180280	180300	38.0	+	chr1	180362	180382	59.0	-	180331	97.0	82
+chr1	98528	98548	34.0	+	chr1	98555	98575	88.0	-	98551	122.0	27
+chr1	230163	230183	23.0	+	chr1	230173	230193	33.0	-	230178	56.0	10
+chr1	173262	173282	11.0	+	chr1	173270	173290	535.0	-	173276	546.0	8
+chr1	230145	230165	8.0	+	chr1	230150	230170	7.0	-	230157	15.0	5
+chr1	95920	95940	5.0	+	chr1	95971	95991	684.0	-	95955	689.0	51
+chr1	199418	199438	5.0	+	chr1	199388	199408	805.0	-	199413	810.0	-30
+chr1	197489	197509	3.0	+	chr1	197562	197582	2.0	-	197535	5.0	73
+chr1	96908	96928	2.0	+	chr1	96911	96931	10.0	-	96919	12.0	3
Binary file test-data/closest_f_output2.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/closest_mp_output1.gff	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,55 @@
+chr1	cwpair	.	87162	87163	5531.0	.	.	cw_distance=11
+chr1	cwpair	.	229759	229760	4531.0	.	.	cw_distance=16
+chr1	cwpair	.	123	124	4204.0	.	.	cw_distance=52
+chr1	cwpair	.	268	269	4088.0	.	.	cw_distance=6
+chr1	cwpair	.	218	219	4022.0	.	.	cw_distance=14
+chr1	cwpair	.	87194	87195	3643.0	.	.	cw_distance=27
+chr1	cwpair	.	59	60	2881.0	.	.	cw_distance=2
+chr1	cwpair	.	265	266	2474.0	.	.	cw_distance=48
+chr1	cwpair	.	92645	92646	2397.0	.	.	cw_distance=8
+chr1	cwpair	.	87109	87110	2259.0	.	.	cw_distance=3
+chr1	cwpair	.	156	157	2177.0	.	.	cw_distance=59
+chr1	cwpair	.	70792	70793	2146.0	.	.	cw_distance=12
+chr1	cwpair	.	6218	6219	2125.0	.	.	cw_distance=91
+chr1	cwpair	.	86982	86983	2013.0	.	.	cw_distance=37
+chr1	cwpair	.	155079	155080	1573.0	.	.	cw_distance=83
+chr1	cwpair	.	92421	92422	1388.0	.	.	cw_distance=0
+chr1	cwpair	.	185109	185110	1371.0	.	.	cw_distance=46
+chr1	cwpair	.	6454	6455	1249.0	.	.	cw_distance=63
+chr1	cwpair	.	87044	87045	1191.0	.	.	cw_distance=30
+chr1	cwpair	.	25305	25306	1183.0	.	.	cw_distance=99
+chr1	cwpair	.	139230	139231	1179.0	.	.	cw_distance=15
+chr1	cwpair	.	325	326	1171.0	.	.	cw_distance=16
+chr1	cwpair	.	55548	55549	956.0	.	.	cw_distance=86
+chr1	cwpair	.	370	371	899.0	.	.	cw_distance=25
+chr1	cwpair	.	72805	72806	869.0	.	.	cw_distance=29
+chr1	cwpair	.	22580	22581	863.0	.	.	cw_distance=-2
+chr1	cwpair	.	92567	92568	789.0	.	.	cw_distance=28
+chr1	cwpair	.	19213	19214	778.0	.	.	cw_distance=-25
+chr1	cwpair	.	113782	113783	716.0	.	.	cw_distance=-20
+chr1	cwpair	.	138876	138877	711.0	.	.	cw_distance=-4
+chr1	cwpair	.	72731	72732	710.0	.	.	cw_distance=100
+chr1	cwpair	.	229762	229763	699.0	.	.	cw_distance=63
+chr1	cwpair	.	95955	95956	689.0	.	.	cw_distance=51
+chr1	cwpair	.	134230	134231	659.0	.	.	cw_distance=100
+chr1	cwpair	.	170134	170135	657.0	.	.	cw_distance=10
+chr1	cwpair	.	228672	228673	626.0	.	.	cw_distance=58
+chr1	cwpair	.	65160	65161	618.0	.	.	cw_distance=-4
+chr1	cwpair	.	106047	106048	572.0	.	.	cw_distance=7
+chr1	cwpair	.	477	478	566.0	.	.	cw_distance=1
+chr1	cwpair	.	59228	59229	565.0	.	.	cw_distance=56
+chr1	cwpair	.	173276	173277	546.0	.	.	cw_distance=8
+chr1	cwpair	.	452	453	504.0	.	.	cw_distance=8
+chr1	cwpair	.	31670	31671	490.0	.	.	cw_distance=66
+chr1	cwpair	.	32483	32484	478.0	.	.	cw_distance=48
+chr1	cwpair	.	6714	6715	433.0	.	.	cw_distance=-4
+chr1	cwpair	.	136369	136370	365.0	.	.	cw_distance=-14
+chr1	cwpair	.	39237	39238	362.0	.	.	cw_distance=61
+chr1	cwpair	.	388	389	359.0	.	.	cw_distance=20
+chr1	cwpair	.	627	628	247.0	.	.	cw_distance=33
+chr1	cwpair	.	98551	98552	122.0	.	.	cw_distance=27
+chr1	cwpair	.	180331	180332	97.0	.	.	cw_distance=82
+chr1	cwpair	.	230178	230179	56.0	.	.	cw_distance=10
+chr1	cwpair	.	230125	230126	44.0	.	.	cw_distance=10
+chr1	cwpair	.	230157	230158	15.0	.	.	cw_distance=5
+chr1	cwpair	.	96919	96920	12.0	.	.	cw_distance=3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/closest_mp_output2.gff	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,65 @@
+chr1	cwpair	.	87162	87163	5531.0	.	.	cw_distance=11
+chr1	cwpair	.	229759	229760	4531.0	.	.	cw_distance=16
+chr1	cwpair	.	123	124	4204.0	.	.	cw_distance=52
+chr1	cwpair	.	268	269	4088.0	.	.	cw_distance=6
+chr1	cwpair	.	218	219	4022.0	.	.	cw_distance=14
+chr1	cwpair	.	87194	87195	3643.0	.	.	cw_distance=27
+chr1	cwpair	.	59	60	2881.0	.	.	cw_distance=2
+chr1	cwpair	.	265	266	2474.0	.	.	cw_distance=48
+chr1	cwpair	.	92645	92646	2397.0	.	.	cw_distance=8
+chr1	cwpair	.	101399	101400	2361.0	.	.	cw_distance=-44
+chr1	cwpair	.	87109	87110	2259.0	.	.	cw_distance=3
+chr1	cwpair	.	156	157	2177.0	.	.	cw_distance=59
+chr1	cwpair	.	70792	70793	2146.0	.	.	cw_distance=12
+chr1	cwpair	.	6218	6219	2125.0	.	.	cw_distance=91
+chr1	cwpair	.	86982	86983	2013.0	.	.	cw_distance=37
+chr1	cwpair	.	169095	169096	1887.0	.	.	cw_distance=-43
+chr1	cwpair	.	155079	155080	1573.0	.	.	cw_distance=83
+chr1	cwpair	.	203863	203864	1476.0	.	.	cw_distance=-37
+chr1	cwpair	.	92421	92422	1388.0	.	.	cw_distance=0
+chr1	cwpair	.	185109	185110	1371.0	.	.	cw_distance=46
+chr1	cwpair	.	39076	39077	1350.0	.	.	cw_distance=-29
+chr1	cwpair	.	6454	6455	1249.0	.	.	cw_distance=63
+chr1	cwpair	.	87044	87045	1191.0	.	.	cw_distance=30
+chr1	cwpair	.	25305	25306	1183.0	.	.	cw_distance=99
+chr1	cwpair	.	139230	139231	1179.0	.	.	cw_distance=15
+chr1	cwpair	.	325	326	1171.0	.	.	cw_distance=16
+chr1	cwpair	.	55548	55549	956.0	.	.	cw_distance=86
+chr1	cwpair	.	370	371	899.0	.	.	cw_distance=25
+chr1	cwpair	.	72805	72806	869.0	.	.	cw_distance=29
+chr1	cwpair	.	22580	22581	863.0	.	.	cw_distance=-2
+chr1	cwpair	.	199413	199414	810.0	.	.	cw_distance=-30
+chr1	cwpair	.	92567	92568	789.0	.	.	cw_distance=28
+chr1	cwpair	.	19213	19214	778.0	.	.	cw_distance=-25
+chr1	cwpair	.	116649	116650	773.0	.	.	cw_distance=-41
+chr1	cwpair	.	124306	124307	761.0	.	.	cw_distance=-43
+chr1	cwpair	.	113782	113783	716.0	.	.	cw_distance=-20
+chr1	cwpair	.	138876	138877	711.0	.	.	cw_distance=-4
+chr1	cwpair	.	72731	72732	710.0	.	.	cw_distance=100
+chr1	cwpair	.	229762	229763	699.0	.	.	cw_distance=63
+chr1	cwpair	.	95955	95956	689.0	.	.	cw_distance=51
+chr1	cwpair	.	134230	134231	659.0	.	.	cw_distance=100
+chr1	cwpair	.	170134	170135	657.0	.	.	cw_distance=10
+chr1	cwpair	.	228672	228673	626.0	.	.	cw_distance=58
+chr1	cwpair	.	65160	65161	618.0	.	.	cw_distance=-4
+chr1	cwpair	.	151365	151366	595.0	.	.	cw_distance=-28
+chr1	cwpair	.	108611	108612	573.0	.	.	cw_distance=-45
+chr1	cwpair	.	106047	106048	572.0	.	.	cw_distance=7
+chr1	cwpair	.	500	501	569.0	.	.	cw_distance=-44
+chr1	cwpair	.	59228	59229	565.0	.	.	cw_distance=56
+chr1	cwpair	.	173276	173277	546.0	.	.	cw_distance=8
+chr1	cwpair	.	452	453	504.0	.	.	cw_distance=8
+chr1	cwpair	.	45670	45671	493.0	.	.	cw_distance=-35
+chr1	cwpair	.	31670	31671	490.0	.	.	cw_distance=66
+chr1	cwpair	.	32483	32484	478.0	.	.	cw_distance=48
+chr1	cwpair	.	6714	6715	433.0	.	.	cw_distance=-4
+chr1	cwpair	.	136369	136370	365.0	.	.	cw_distance=-14
+chr1	cwpair	.	39237	39238	362.0	.	.	cw_distance=61
+chr1	cwpair	.	388	389	359.0	.	.	cw_distance=20
+chr1	cwpair	.	668	669	319.0	.	.	cw_distance=-48
+chr1	cwpair	.	98551	98552	122.0	.	.	cw_distance=27
+chr1	cwpair	.	180331	180332	97.0	.	.	cw_distance=82
+chr1	cwpair	.	230178	230179	56.0	.	.	cw_distance=10
+chr1	cwpair	.	230125	230126	44.0	.	.	cw_distance=10
+chr1	cwpair	.	230157	230158	15.0	.	.	cw_distance=5
+chr1	cwpair	.	96919	96920	12.0	.	.	cw_distance=3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/closest_o_output2.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,100 @@
+chrom	strand	start	end	value
+chr1	+	100364	100384	2695.0
+chr1	+	30	50	2140.0
+chr1	+	5379	5399	1572.0
+chr1	+	52440	52460	1562.0
+chr1	+	73234	73254	1492.0
+chr1	+	31096	31116	1481.0
+chr1	+	145253	145273	1394.0
+chr1	+	10641	10661	1359.0
+chr1	+	200580	200600	1298.0
+chr1	+	64772	64792	1292.0
+chr1	+	86886	86906	1253.0
+chr1	+	103207	103227	1229.0
+chr1	+	43835	43855	1173.0
+chr1	+	29570	29590	1130.0
+chr1	+	83774	83794	1125.0
+chr1	+	165827	165847	1109.0
+chr1	+	92775	92795	1105.0
+chr1	+	4748	4768	1077.0
+chr1	+	126733	126753	952.0
+chr1	+	71041	71061	881.0
+chr1	+	35773	35793	866.0
+chr1	+	53097	53117	835.0
+chr1	+	71556	71576	835.0
+chr1	+	30964	30984	829.0
+chr1	+	31019	31039	810.0
+chr1	+	55349	55369	794.0
+chr1	+	203193	203213	789.0
+chr1	+	39794	39814	780.0
+chr1	+	153928	153948	768.0
+chr1	+	179472	179492	696.0
+chr1	+	178117	178137	686.0
+chr1	+	1298	1318	684.0
+chr1	+	87085	87105	676.0
+chr1	+	192754	192774	668.0
+chr1	+	89611	89631	640.0
+chr1	+	20205	20225	634.0
+chr1	+	118428	118448	633.0
+chr1	+	110736	110756	621.0
+chr1	+	48642	48662	610.0
+chr1	+	159372	159392	605.0
+chr1	+	6453	6473	601.0
+chr1	+	112137	112157	601.0
+chr1	+	142905	142925	599.0
+chr1	+	167443	167463	597.0
+chr1	+	126073	126093	590.0
+chr1	+	6233	6253	589.0
+chr1	+	43657	43677	586.0
+chr1	+	134021	134041	572.0
+chr1	+	29864	29884	570.0
+chr1	+	70953	70973	555.0
+chr1	+	87002	87022	550.0
+chr1	+	129555	129575	536.0
+chr1	+	119754	119774	515.0
+chr1	+	43523	43543	505.0
+chr1	+	97898	97918	501.0
+chr1	+	40830	40850	491.0
+chr1	+	153095	153115	490.0
+chr1	+	7303	7323	484.0
+chr1	+	115866	115886	480.0
+chr1	+	129680	129700	464.0
+chr1	+	187155	187175	455.0
+chr1	+	192271	192291	453.0
+chr1	+	160	180	451.0
+chr1	+	150449	150469	436.0
+chr1	+	9367	9387	425.0
+chr1	+	93793	93813	415.0
+chr1	+	87572	87592	407.0
+chr1	+	124845	124865	383.0
+chr1	+	4053	4073	381.0
+chr1	+	136072	136092	380.0
+chr1	+	39942	39962	375.0
+chr1	+	61977	61997	368.0
+chr1	+	2976	2996	356.0
+chr1	+	27978	27998	354.0
+chr1	+	195756	195776	348.0
+chr1	+	172223	172243	338.0
+chr1	+	143657	143677	328.0
+chr1	+	45409	45429	307.0
+chr1	+	45248	45268	305.0
+chr1	+	68564	68584	303.0
+chr1	+	119953	119973	295.0
+chr1	+	48319	48339	290.0
+chr1	+	48772	48792	284.0
+chr1	+	126369	126389	284.0
+chr1	+	116432	116452	267.0
+chr1	+	199649	199669	264.0
+chr1	+	204126	204146	261.0
+chr1	+	130514	130534	243.0
+chr1	+	55692	55712	228.0
+chr1	+	117198	117218	228.0
+chr1	+	42843	42863	218.0
+chr1	+	59583	59603	204.0
+chr1	+	124669	124689	203.0
+chr1	+	2613	2633	202.0
+chr1	+	40264	40284	199.0
+chr1	+	21406	21426	177.0
+chr1	+	20391	20411	173.0
+chr1	+	20626	20646	171.0
+chr1	+	198594	198614	170.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/cwpair2_input1.gff	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,499 @@
+chr1	genetrack	.	11	31	414	+	.	stddev=2.26073020752
+chr1	genetrack	.	30	50	2140	+	.	stddev=4.43077587195
+chr1	genetrack	.	48	68	2842	+	.	stddev=4.88263527016
+chr1	genetrack	.	87	107	3211	+	.	stddev=5.51553909779
+chr1	genetrack	.	117	137	2163	+	.	stddev=4.21572697137
+chr1	genetrack	.	160	180	451	+	.	stddev=0.724882503432
+chr1	genetrack	.	201	221	1411	+	.	stddev=5.79752503059
+chr1	genetrack	.	231	251	1146	+	.	stddev=1.48216146131
+chr1	genetrack	.	255	275	2810	+	.	stddev=1.35163759113
+chr1	genetrack	.	307	327	685	+	.	stddev=0.0
+chr1	genetrack	.	348	368	699	+	.	stddev=2.60206286017
+chr1	genetrack	.	368	388	192	+	.	stddev=0.0
+chr1	genetrack	.	438	458	334	+	.	stddev=0.109271183179
+chr1	genetrack	.	467	487	98	+	.	stddev=0.0
+chr1	genetrack	.	512	532	101	+	.	stddev=0.792079207921
+chr1	genetrack	.	601	621	96	+	.	stddev=0.0
+chr1	genetrack	.	682	702	168	+	.	stddev=0.0
+chr1	genetrack	.	1298	1318	684	+	.	stddev=0.0
+chr1	genetrack	.	2293	2313	12	+	.	stddev=0.0
+chr1	genetrack	.	2613	2633	202	+	.	stddev=0.0
+chr1	genetrack	.	2976	2996	356	+	.	stddev=0.0
+chr1	genetrack	.	4053	4073	381	+	.	stddev=0.0
+chr1	genetrack	.	4445	4465	94	+	.	stddev=0.0
+chr1	genetrack	.	4748	4768	1077	+	.	stddev=0.0
+chr1	genetrack	.	5379	5399	1572	+	.	stddev=0.0
+chr1	genetrack	.	5750	5770	25	+	.	stddev=0.0
+chr1	genetrack	.	5794	5814	148	+	.	stddev=0.0
+chr1	genetrack	.	6163	6183	1049	+	.	stddev=0.645595472695
+chr1	genetrack	.	6233	6253	589	+	.	stddev=2.54134583729
+chr1	genetrack	.	6255	6275	26	+	.	stddev=0.0
+chr1	genetrack	.	6413	6433	682	+	.	stddev=0.0
+chr1	genetrack	.	6453	6473	601	+	.	stddev=0.0
+chr1	genetrack	.	6706	6726	431	+	.	stddev=0.0
+chr1	genetrack	.	7303	7323	484	+	.	stddev=0.0
+chr1	genetrack	.	7753	7773	14	+	.	stddev=0.0
+chr1	genetrack	.	9367	9387	425	+	.	stddev=0.0
+chr1	genetrack	.	10641	10661	1359	+	.	stddev=0.0
+chr1	genetrack	.	12305	12325	13	+	.	stddev=0.0
+chr1	genetrack	.	16173	16193	12	+	.	stddev=0.0
+chr1	genetrack	.	16501	16521	15	+	.	stddev=0.0
+chr1	genetrack	.	19216	19236	42	+	.	stddev=0.0
+chr1	genetrack	.	20117	20137	8	+	.	stddev=0.0
+chr1	genetrack	.	20205	20225	634	+	.	stddev=0.0
+chr1	genetrack	.	20391	20411	173	+	.	stddev=0.0
+chr1	genetrack	.	20626	20646	171	+	.	stddev=0.0
+chr1	genetrack	.	21406	21426	177	+	.	stddev=0.0
+chr1	genetrack	.	22268	22288	15	+	.	stddev=0.0
+chr1	genetrack	.	22571	22591	609	+	.	stddev=0.0
+chr1	genetrack	.	24765	24785	4	+	.	stddev=0.0
+chr1	genetrack	.	25246	25266	995	+	.	stddev=0.0
+chr1	genetrack	.	27978	27998	354	+	.	stddev=0.0
+chr1	genetrack	.	29570	29590	1130	+	.	stddev=0.0
+chr1	genetrack	.	29864	29884	570	+	.	stddev=0.0
+chr1	genetrack	.	30964	30984	829	+	.	stddev=0.0
+chr1	genetrack	.	31019	31039	810	+	.	stddev=0.0
+chr1	genetrack	.	31096	31116	1481	+	.	stddev=0.0
+chr1	genetrack	.	31627	31647	40	+	.	stddev=0.0
+chr1	genetrack	.	32145	32165	66	+	.	stddev=0.0
+chr1	genetrack	.	32449	32469	476	+	.	stddev=0.0
+chr1	genetrack	.	33426	33446	2	+	.	stddev=0.0
+chr1	genetrack	.	33829	33849	48	+	.	stddev=0.0
+chr1	genetrack	.	35773	35793	866	+	.	stddev=0.0
+chr1	genetrack	.	39081	39101	1268	+	.	stddev=0.0
+chr1	genetrack	.	39197	39217	101	+	.	stddev=0.0
+chr1	genetrack	.	39591	39611	10	+	.	stddev=0.0
+chr1	genetrack	.	39794	39814	780	+	.	stddev=0.0
+chr1	genetrack	.	39942	39962	375	+	.	stddev=0.0
+chr1	genetrack	.	40264	40284	199	+	.	stddev=0.0
+chr1	genetrack	.	40830	40850	491	+	.	stddev=0.0
+chr1	genetrack	.	41008	41028	132	+	.	stddev=0.0
+chr1	genetrack	.	42843	42863	218	+	.	stddev=0.0
+chr1	genetrack	.	42925	42945	77	+	.	stddev=0.0
+chr1	genetrack	.	43147	43167	9	+	.	stddev=0.0
+chr1	genetrack	.	43523	43543	505	+	.	stddev=0.0
+chr1	genetrack	.	43657	43677	586	+	.	stddev=0.0
+chr1	genetrack	.	43835	43855	1173	+	.	stddev=0.0
+chr1	genetrack	.	44687	44707	100	+	.	stddev=0.0
+chr1	genetrack	.	45248	45268	305	+	.	stddev=0.139642881568
+chr1	genetrack	.	45409	45429	307	+	.	stddev=0.0
+chr1	genetrack	.	45678	45698	198	+	.	stddev=0.0
+chr1	genetrack	.	47015	47035	133	+	.	stddev=0.0
+chr1	genetrack	.	48319	48339	290	+	.	stddev=0.0
+chr1	genetrack	.	48431	48451	57	+	.	stddev=0.0
+chr1	genetrack	.	48642	48662	610	+	.	stddev=0.0
+chr1	genetrack	.	48772	48792	284	+	.	stddev=0.0
+chr1	genetrack	.	49283	49303	2	+	.	stddev=0.0
+chr1	genetrack	.	52440	52460	1562	+	.	stddev=0.0
+chr1	genetrack	.	53097	53117	835	+	.	stddev=0.0
+chr1	genetrack	.	55349	55369	794	+	.	stddev=0.0
+chr1	genetrack	.	55495	55515	125	+	.	stddev=0.0
+chr1	genetrack	.	55692	55712	228	+	.	stddev=0.0
+chr1	genetrack	.	59190	59210	168	+	.	stddev=0.0
+chr1	genetrack	.	59248	59268	80	+	.	stddev=0.0
+chr1	genetrack	.	59583	59603	204	+	.	stddev=0.0
+chr1	genetrack	.	61977	61997	368	+	.	stddev=0.0
+chr1	genetrack	.	64772	64792	1292	+	.	stddev=0.0
+chr1	genetrack	.	65152	65172	575	+	.	stddev=0.0
+chr1	genetrack	.	68018	68038	62	+	.	stddev=0.0
+chr1	genetrack	.	68564	68584	303	+	.	stddev=0.0
+chr1	genetrack	.	70776	70796	1148	+	.	stddev=0.0
+chr1	genetrack	.	70953	70973	555	+	.	stddev=0.0
+chr1	genetrack	.	71041	71061	881	+	.	stddev=0.0
+chr1	genetrack	.	71556	71576	835	+	.	stddev=0.0345856983909
+chr1	genetrack	.	72671	72691	304	+	.	stddev=0.0572595236366
+chr1	genetrack	.	72781	72801	657	+	.	stddev=0.0
+chr1	genetrack	.	73234	73254	1492	+	.	stddev=0.0
+chr1	genetrack	.	76365	76385	47	+	.	stddev=0.0
+chr1	genetrack	.	76501	76521	33	+	.	stddev=0.0
+chr1	genetrack	.	77731	77751	113	+	.	stddev=0.0
+chr1	genetrack	.	81481	81501	5	+	.	stddev=0.0
+chr1	genetrack	.	83774	83794	1125	+	.	stddev=0.0
+chr1	genetrack	.	86865	86885	81	+	.	stddev=0.0
+chr1	genetrack	.	86886	86906	1253	+	.	stddev=0.0
+chr1	genetrack	.	86954	86974	1948	+	.	stddev=5.39208071191
+chr1	genetrack	.	87002	87022	550	+	.	stddev=0.0
+chr1	genetrack	.	87019	87039	769	+	.	stddev=0.0
+chr1	genetrack	.	87085	87105	676	+	.	stddev=0.0
+chr1	genetrack	.	87098	87118	1125	+	.	stddev=1.98839815175
+chr1	genetrack	.	87147	87167	3492	+	.	stddev=2.59487167975
+chr1	genetrack	.	87171	87191	1436	+	.	stddev=1.75985539692
+chr1	genetrack	.	87572	87592	407	+	.	stddev=0.0
+chr1	genetrack	.	89611	89631	640	+	.	stddev=0.0
+chr1	genetrack	.	89663	89683	2	+	.	stddev=0.0
+chr1	genetrack	.	90040	90060	82	+	.	stddev=0.0
+chr1	genetrack	.	90412	90432	86	+	.	stddev=0.0
+chr1	genetrack	.	91215	91235	11	+	.	stddev=0.0
+chr1	genetrack	.	91379	91399	120	+	.	stddev=0.0
+chr1	genetrack	.	92411	92431	1252	+	.	stddev=0.169502292497
+chr1	genetrack	.	92543	92563	699	+	.	stddev=0.0
+chr1	genetrack	.	92631	92651	260	+	.	stddev=0.0
+chr1	genetrack	.	92775	92795	1105	+	.	stddev=0.923076923077
+chr1	genetrack	.	92982	93002	44	+	.	stddev=0.0
+chr1	genetrack	.	93793	93813	415	+	.	stddev=0.0
+chr1	genetrack	.	95920	95940	5	+	.	stddev=0.0
+chr1	genetrack	.	96908	96928	2	+	.	stddev=0.0
+chr1	genetrack	.	97898	97918	501	+	.	stddev=0.0
+chr1	genetrack	.	97967	97987	50	+	.	stddev=0.0
+chr1	genetrack	.	98528	98548	34	+	.	stddev=0.0
+chr1	genetrack	.	100364	100384	2695	+	.	stddev=4.98845945981
+chr1	genetrack	.	101411	101431	973	+	.	stddev=0.0
+chr1	genetrack	.	102337	102357	36	+	.	stddev=0.0
+chr1	genetrack	.	103108	103128	90	+	.	stddev=0.0
+chr1	genetrack	.	103207	103227	1229	+	.	stddev=0.0
+chr1	genetrack	.	105499	105519	46	+	.	stddev=0.145830520272
+chr1	genetrack	.	105942	105962	25	+	.	stddev=0.0
+chr1	genetrack	.	106034	106054	558	+	.	stddev=0.0
+chr1	genetrack	.	108624	108644	206	+	.	stddev=0.0
+chr1	genetrack	.	110130	110150	42	+	.	stddev=0.0
+chr1	genetrack	.	110540	110560	91	+	.	stddev=0.0
+chr1	genetrack	.	110602	110622	8	+	.	stddev=0.0
+chr1	genetrack	.	110736	110756	621	+	.	stddev=0.0400962950016
+chr1	genetrack	.	111317	111337	17	+	.	stddev=0.0
+chr1	genetrack	.	112137	112157	601	+	.	stddev=0.0
+chr1	genetrack	.	112900	112920	125	+	.	stddev=0.0
+chr1	genetrack	.	113226	113246	28	+	.	stddev=0.0
+chr1	genetrack	.	113782	113802	420	+	.	stddev=0.0
+chr1	genetrack	.	115866	115886	480	+	.	stddev=0.0
+chr1	genetrack	.	116432	116452	267	+	.	stddev=0.0
+chr1	genetrack	.	116660	116680	74	+	.	stddev=0.0
+chr1	genetrack	.	117198	117218	228	+	.	stddev=0.0
+chr1	genetrack	.	118428	118448	633	+	.	stddev=0.039715023981
+chr1	genetrack	.	119155	119175	9	+	.	stddev=0.0
+chr1	genetrack	.	119736	119756	135	+	.	stddev=0.0
+chr1	genetrack	.	119754	119774	515	+	.	stddev=0.0
+chr1	genetrack	.	119953	119973	295	+	.	stddev=0.0
+chr1	genetrack	.	121016	121036	155	+	.	stddev=0.0
+chr1	genetrack	.	121289	121309	89	+	.	stddev=0.0
+chr1	genetrack	.	124318	124338	749	+	.	stddev=0.0
+chr1	genetrack	.	124669	124689	203	+	.	stddev=0.0
+chr1	genetrack	.	124845	124865	383	+	.	stddev=0.0
+chr1	genetrack	.	125727	125747	3	+	.	stddev=0.0
+chr1	genetrack	.	126073	126093	590	+	.	stddev=0.329075555241
+chr1	genetrack	.	126369	126389	284	+	.	stddev=0.0592345205678
+chr1	genetrack	.	126733	126753	952	+	.	stddev=0.484392920736
+chr1	genetrack	.	129555	129575	536	+	.	stddev=0.0431531100978
+chr1	genetrack	.	129680	129700	464	+	.	stddev=0.0
+chr1	genetrack	.	130514	130534	243	+	.	stddev=0.0
+chr1	genetrack	.	133139	133159	84	+	.	stddev=0.0
+chr1	genetrack	.	134021	134041	572	+	.	stddev=0.0
+chr1	genetrack	.	134170	134190	151	+	.	stddev=0.0
+chr1	genetrack	.	134559	134579	87	+	.	stddev=0.0
+chr1	genetrack	.	134868	134888	36	+	.	stddev=0.0
+chr1	genetrack	.	136072	136092	380	+	.	stddev=0.0
+chr1	genetrack	.	136366	136386	248	+	.	stddev=0.0
+chr1	genetrack	.	138030	138050	2	+	.	stddev=0.0
+chr1	genetrack	.	138051	138071	5	+	.	stddev=0.0
+chr1	genetrack	.	138868	138888	698	+	.	stddev=0.0
+chr1	genetrack	.	139213	139233	965	+	.	stddev=0.0
+chr1	genetrack	.	140857	140877	23	+	.	stddev=0.0
+chr1	genetrack	.	142139	142159	43	+	.	stddev=0.0
+chr1	genetrack	.	142905	142925	599	+	.	stddev=0.0
+chr1	genetrack	.	142950	142970	12	+	.	stddev=0.0
+chr1	genetrack	.	143657	143677	328	+	.	stddev=0.0
+chr1	genetrack	.	145253	145273	1394	+	.	stddev=0.0
+chr1	genetrack	.	146517	146537	69	+	.	stddev=0.0
+chr1	genetrack	.	147211	147231	130	+	.	stddev=0.0
+chr1	genetrack	.	147227	147247	101	+	.	stddev=0.0
+chr1	genetrack	.	147322	147342	15	+	.	stddev=0.0
+chr1	genetrack	.	149343	149363	159	+	.	stddev=0.0
+chr1	genetrack	.	150449	150469	436	+	.	stddev=0.0
+chr1	genetrack	.	151369	151389	2	+	.	stddev=0.0
+chr1	genetrack	.	151431	151451	38	+	.	stddev=0.0
+chr1	genetrack	.	152678	152698	135	+	.	stddev=0.0
+chr1	genetrack	.	153095	153115	490	+	.	stddev=0.0
+chr1	genetrack	.	153928	153948	768	+	.	stddev=0.0
+chr1	genetrack	.	155028	155048	522	+	.	stddev=0.0
+chr1	genetrack	.	156097	156117	2	+	.	stddev=0.0
+chr1	genetrack	.	156252	156272	133	+	.	stddev=0.0
+chr1	genetrack	.	158038	158058	2	+	.	stddev=0.0
+chr1	genetrack	.	159372	159392	605	+	.	stddev=0.0
+chr1	genetrack	.	165827	165847	1109	+	.	stddev=0.0
+chr1	genetrack	.	166238	166258	21	+	.	stddev=0.0
+chr1	genetrack	.	167443	167463	597	+	.	stddev=0.0
+chr1	genetrack	.	167652	167672	5	+	.	stddev=0.0
+chr1	genetrack	.	169107	169127	1811	+	.	stddev=0.0
+chr1	genetrack	.	169159	169179	91	+	.	stddev=0.0
+chr1	genetrack	.	169338	169358	2	+	.	stddev=0.0
+chr1	genetrack	.	170119	170139	284	+	.	stddev=0.0
+chr1	genetrack	.	172223	172243	338	+	.	stddev=0.0
+chr1	genetrack	.	173262	173282	11	+	.	stddev=0.0
+chr1	genetrack	.	175899	175919	2	+	.	stddev=0.0
+chr1	genetrack	.	176858	176878	46	+	.	stddev=0.0
+chr1	genetrack	.	177627	177647	51	+	.	stddev=0.0
+chr1	genetrack	.	178117	178137	686	+	.	stddev=0.0
+chr1	genetrack	.	179472	179492	696	+	.	stddev=0.0
+chr1	genetrack	.	179554	179574	31	+	.	stddev=0.176684695969
+chr1	genetrack	.	180280	180300	38	+	.	stddev=0.0
+chr1	genetrack	.	180652	180672	154	+	.	stddev=0.0
+chr1	genetrack	.	183610	183630	4	+	.	stddev=0.433012701892
+chr1	genetrack	.	185076	185096	1309	+	.	stddev=0.0
+chr1	genetrack	.	187009	187029	139	+	.	stddev=0.0
+chr1	genetrack	.	187155	187175	455	+	.	stddev=0.0
+chr1	genetrack	.	188920	188940	7	+	.	stddev=1.97948663722
+chr1	genetrack	.	189494	189514	70	+	.	stddev=0.0
+chr1	genetrack	.	191408	191428	50	+	.	stddev=0.0
+chr1	genetrack	.	192271	192291	453	+	.	stddev=0.0
+chr1	genetrack	.	192754	192774	668	+	.	stddev=0.0
+chr1	genetrack	.	195756	195776	348	+	.	stddev=0.0
+chr1	genetrack	.	197489	197509	3	+	.	stddev=0.0
+chr1	genetrack	.	198594	198614	170	+	.	stddev=0.0
+chr1	genetrack	.	199141	199161	2	+	.	stddev=0.0
+chr1	genetrack	.	199418	199438	5	+	.	stddev=0.0
+chr1	genetrack	.	199649	199669	264	+	.	stddev=0.0
+chr1	genetrack	.	200580	200600	1298	+	.	stddev=0.0
+chr1	genetrack	.	201841	201861	15	+	.	stddev=0.0
+chr1	genetrack	.	203193	203213	789	+	.	stddev=0.0
+chr1	genetrack	.	203872	203892	1234	+	.	stddev=0.0
+chr1	genetrack	.	204126	204146	261	+	.	stddev=0.0
+chr1	genetrack	.	204214	204234	36	+	.	stddev=0.0
+chr1	genetrack	.	206684	206704	8	+	.	stddev=0.0
+chr1	genetrack	.	210175	210195	62	+	.	stddev=0.0
+chr1	genetrack	.	219301	219321	37	+	.	stddev=0.0
+chr1	genetrack	.	227346	227366	114	+	.	stddev=0.0
+chr1	genetrack	.	228150	228170	5	+	.	stddev=0.0
+chr1	genetrack	.	228633	228653	371	+	.	stddev=0.0
+chr1	genetrack	.	229721	229741	84	+	.	stddev=0.0
+chr1	genetrack	.	229741	229761	1380	+	.	stddev=0.0
+chr1	genetrack	.	229862	229882	110	+	.	stddev=0.0
+chr1	genetrack	.	230110	230130	42	+	.	stddev=3.55113280767
+chr1	genetrack	.	230145	230165	8	+	.	stddev=3.08220700148
+chr1	genetrack	.	230163	230183	23	+	.	stddev=1.62796915016
+chr1	genetrack	.	50	70	39	-	.	stddev=1.95948442816
+chr1	genetrack	.	139	159	993	-	.	stddev=4.91699987402
+chr1	genetrack	.	176	196	14	-	.	stddev=0.0
+chr1	genetrack	.	215	235	2611	-	.	stddev=5.10619852562
+chr1	genetrack	.	261	281	1278	-	.	stddev=3.36870454509
+chr1	genetrack	.	279	299	1328	-	.	stddev=2.15740829792
+chr1	genetrack	.	323	343	486	-	.	stddev=0.0453142295176
+chr1	genetrack	.	373	393	200	-	.	stddev=0.551339278485
+chr1	genetrack	.	388	408	167	-	.	stddev=0.0
+chr1	genetrack	.	410	430	8	-	.	stddev=0.0
+chr1	genetrack	.	446	466	170	-	.	stddev=0.748724405435
+chr1	genetrack	.	468	488	468	-	.	stddev=0.0
+chr1	genetrack	.	634	654	151	-	.	stddev=0.0
+chr1	genetrack	.	1457	1477	111	-	.	stddev=0.0
+chr1	genetrack	.	1970	1990	629	-	.	stddev=0.0
+chr1	genetrack	.	3148	3168	1420	-	.	stddev=0.0265278988758
+chr1	genetrack	.	4892	4912	272	-	.	stddev=0.0
+chr1	genetrack	.	5546	5566	27	-	.	stddev=0.0
+chr1	genetrack	.	6254	6274	1076	-	.	stddev=1.26363262979
+chr1	genetrack	.	6476	6496	567	-	.	stddev=0.0
+chr1	genetrack	.	6702	6722	2	-	.	stddev=0.0
+chr1	genetrack	.	7659	7679	243	-	.	stddev=0.0
+chr1	genetrack	.	8596	8616	114	-	.	stddev=0.0
+chr1	genetrack	.	8904	8924	80	-	.	stddev=0.0
+chr1	genetrack	.	9119	9139	22	-	.	stddev=0.0
+chr1	genetrack	.	10107	10127	1622	-	.	stddev=0.0
+chr1	genetrack	.	12157	12177	40	-	.	stddev=0.0
+chr1	genetrack	.	13415	13435	634	-	.	stddev=0.0
+chr1	genetrack	.	16739	16759	3	-	.	stddev=0.0
+chr1	genetrack	.	19145	19165	618	-	.	stddev=0.0
+chr1	genetrack	.	19191	19211	736	-	.	stddev=0.0
+chr1	genetrack	.	20550	20570	865	-	.	stddev=0.0
+chr1	genetrack	.	22383	22403	141	-	.	stddev=0.0
+chr1	genetrack	.	22569	22589	254	-	.	stddev=0.0
+chr1	genetrack	.	23046	23066	213	-	.	stddev=0.0
+chr1	genetrack	.	25345	25365	188	-	.	stddev=0.0
+chr1	genetrack	.	27517	27537	1459	-	.	stddev=0.0
+chr1	genetrack	.	29325	29345	1074	-	.	stddev=0.0
+chr1	genetrack	.	30046	30066	17	-	.	stddev=0.0
+chr1	genetrack	.	31693	31713	450	-	.	stddev=0.0
+chr1	genetrack	.	31876	31896	1344	-	.	stddev=0.0
+chr1	genetrack	.	32497	32517	2	-	.	stddev=0.0
+chr1	genetrack	.	37166	37186	1000	-	.	stddev=0.0
+chr1	genetrack	.	38768	38788	1064	-	.	stddev=0.0
+chr1	genetrack	.	38799	38819	9	-	.	stddev=0.0
+chr1	genetrack	.	39000	39020	3	-	.	stddev=0.0
+chr1	genetrack	.	39052	39072	82	-	.	stddev=0.0
+chr1	genetrack	.	39258	39278	261	-	.	stddev=0.0
+chr1	genetrack	.	39293	39313	2	-	.	stddev=0.0
+chr1	genetrack	.	41867	41887	7	-	.	stddev=0.0
+chr1	genetrack	.	45565	45585	246	-	.	stddev=1.46097357384
+chr1	genetrack	.	45579	45599	78	-	.	stddev=0.0
+chr1	genetrack	.	45643	45663	295	-	.	stddev=1.27157056343
+chr1	genetrack	.	46616	46636	741	-	.	stddev=0.0
+chr1	genetrack	.	49660	49680	6	-	.	stddev=0.0
+chr1	genetrack	.	50091	50111	156	-	.	stddev=0.0
+chr1	genetrack	.	51978	51998	633	-	.	stddev=0.0
+chr1	genetrack	.	52308	52328	549	-	.	stddev=0.0
+chr1	genetrack	.	53045	53065	31	-	.	stddev=0.0
+chr1	genetrack	.	55581	55601	831	-	.	stddev=0.124372757427
+chr1	genetrack	.	55616	55636	984	-	.	stddev=0.0
+chr1	genetrack	.	56542	56562	606	-	.	stddev=0.0
+chr1	genetrack	.	56664	56684	67	-	.	stddev=0.0
+chr1	genetrack	.	56995	57015	1393	-	.	stddev=0.0
+chr1	genetrack	.	57121	57141	4	-	.	stddev=0.0
+chr1	genetrack	.	57212	57232	667	-	.	stddev=0.0
+chr1	genetrack	.	57543	57563	2	-	.	stddev=0.0
+chr1	genetrack	.	59157	59177	168	-	.	stddev=0.0
+chr1	genetrack	.	59246	59266	397	-	.	stddev=0.0
+chr1	genetrack	.	61877	61897	607	-	.	stddev=0.0
+chr1	genetrack	.	65148	65168	43	-	.	stddev=0.0
+chr1	genetrack	.	65687	65707	596	-	.	stddev=0.0
+chr1	genetrack	.	66306	66326	2	-	.	stddev=0.0
+chr1	genetrack	.	68423	68443	139	-	.	stddev=0.0
+chr1	genetrack	.	70336	70356	652	-	.	stddev=0.0
+chr1	genetrack	.	70788	70808	998	-	.	stddev=0.0
+chr1	genetrack	.	72771	72791	406	-	.	stddev=0.0
+chr1	genetrack	.	72810	72830	212	-	.	stddev=0.0
+chr1	genetrack	.	74763	74783	430	-	.	stddev=0.0
+chr1	genetrack	.	75897	75917	10	-	.	stddev=0.0
+chr1	genetrack	.	77515	77535	797	-	.	stddev=0.0
+chr1	genetrack	.	77530	77550	513	-	.	stddev=0.0
+chr1	genetrack	.	78813	78833	113	-	.	stddev=0.0
+chr1	genetrack	.	80958	80978	137	-	.	stddev=0.0
+chr1	genetrack	.	81037	81057	4	-	.	stddev=0.0
+chr1	genetrack	.	81972	81992	49	-	.	stddev=0.0
+chr1	genetrack	.	85759	85779	77	-	.	stddev=0.0
+chr1	genetrack	.	86166	86186	969	-	.	stddev=0.0
+chr1	genetrack	.	86280	86300	14	-	.	stddev=0.0
+chr1	genetrack	.	86991	87011	65	-	.	stddev=0.0
+chr1	genetrack	.	87049	87069	422	-	.	stddev=2.00428551887
+chr1	genetrack	.	87101	87121	1134	-	.	stddev=0.0296825973187
+chr1	genetrack	.	87158	87178	2039	-	.	stddev=2.64919364477
+chr1	genetrack	.	87198	87218	2207	-	.	stddev=4.88766842837
+chr1	genetrack	.	87234	87254	637	-	.	stddev=0.0
+chr1	genetrack	.	87262	87282	505	-	.	stddev=0.0
+chr1	genetrack	.	87289	87309	1270	-	.	stddev=0.0
+chr1	genetrack	.	87327	87347	729	-	.	stddev=0.517094014402
+chr1	genetrack	.	87468	87488	304	-	.	stddev=0.0
+chr1	genetrack	.	88213	88233	301	-	.	stddev=0.0
+chr1	genetrack	.	88376	88396	56	-	.	stddev=0.0
+chr1	genetrack	.	89175	89195	23	-	.	stddev=0.0
+chr1	genetrack	.	91926	91946	10	-	.	stddev=0.0
+chr1	genetrack	.	92411	92431	136	-	.	stddev=0.0
+chr1	genetrack	.	92541	92561	602	-	.	stddev=0.0
+chr1	genetrack	.	92571	92591	90	-	.	stddev=0.0
+chr1	genetrack	.	92639	92659	2137	-	.	stddev=3.28540359906
+chr1	genetrack	.	92664	92684	187	-	.	stddev=0.390044546071
+chr1	genetrack	.	94913	94933	1437	-	.	stddev=0.0
+chr1	genetrack	.	95971	95991	684	-	.	stddev=0.0
+chr1	genetrack	.	96278	96298	166	-	.	stddev=0.0
+chr1	genetrack	.	96315	96335	2	-	.	stddev=0.0
+chr1	genetrack	.	96566	96586	6	-	.	stddev=0.0
+chr1	genetrack	.	96911	96931	10	-	.	stddev=0.0
+chr1	genetrack	.	98555	98575	88	-	.	stddev=0.0
+chr1	genetrack	.	101301	101321	48	-	.	stddev=0.0
+chr1	genetrack	.	101367	101387	1388	-	.	stddev=0.0268317355181
+chr1	genetrack	.	102072	102092	14	-	.	stddev=0.0
+chr1	genetrack	.	102903	102923	846	-	.	stddev=0.0
+chr1	genetrack	.	104110	104130	117	-	.	stddev=0.0
+chr1	genetrack	.	105663	105683	417	-	.	stddev=0.0
+chr1	genetrack	.	105814	105834	529	-	.	stddev=0.0
+chr1	genetrack	.	105846	105866	177	-	.	stddev=0.0
+chr1	genetrack	.	105889	105909	84	-	.	stddev=0.0
+chr1	genetrack	.	106041	106061	14	-	.	stddev=0.0
+chr1	genetrack	.	106340	106360	421	-	.	stddev=0.0
+chr1	genetrack	.	108072	108092	72	-	.	stddev=0.0
+chr1	genetrack	.	108263	108283	145	-	.	stddev=0.0
+chr1	genetrack	.	108579	108599	367	-	.	stddev=0.0
+chr1	genetrack	.	111947	111967	585	-	.	stddev=1.43661357803
+chr1	genetrack	.	113762	113782	296	-	.	stddev=0.0
+chr1	genetrack	.	114306	114326	2	-	.	stddev=0.0
+chr1	genetrack	.	116148	116168	248	-	.	stddev=0.0
+chr1	genetrack	.	116619	116639	699	-	.	stddev=0.0
+chr1	genetrack	.	117522	117542	1573	-	.	stddev=0.0
+chr1	genetrack	.	117845	117865	16	-	.	stddev=0.0
+chr1	genetrack	.	118841	118861	7	-	.	stddev=0.0
+chr1	genetrack	.	119430	119450	1093	-	.	stddev=0.0
+chr1	genetrack	.	119596	119616	842	-	.	stddev=0.0
+chr1	genetrack	.	119657	119677	499	-	.	stddev=0.0
+chr1	genetrack	.	119669	119689	665	-	.	stddev=0.0
+chr1	genetrack	.	119866	119886	846	-	.	stddev=0.0
+chr1	genetrack	.	119880	119900	1136	-	.	stddev=0.0
+chr1	genetrack	.	120788	120808	105	-	.	stddev=0.0
+chr1	genetrack	.	122624	122644	201	-	.	stddev=0.0
+chr1	genetrack	.	122777	122797	20	-	.	stddev=0.0
+chr1	genetrack	.	123718	123738	751	-	.	stddev=0.0
+chr1	genetrack	.	124275	124295	12	-	.	stddev=0.0
+chr1	genetrack	.	125840	125860	273	-	.	stddev=0.0
+chr1	genetrack	.	127027	127047	590	-	.	stddev=0.0
+chr1	genetrack	.	130869	130889	718	-	.	stddev=0.0
+chr1	genetrack	.	133644	133664	122	-	.	stddev=0.0
+chr1	genetrack	.	134270	134290	508	-	.	stddev=0.0
+chr1	genetrack	.	135051	135071	63	-	.	stddev=0.0
+chr1	genetrack	.	136352	136372	117	-	.	stddev=0.0
+chr1	genetrack	.	137428	137448	1200	-	.	stddev=0.028855482822
+chr1	genetrack	.	137816	137836	695	-	.	stddev=0.0
+chr1	genetrack	.	138864	138884	13	-	.	stddev=0.0
+chr1	genetrack	.	139228	139248	214	-	.	stddev=0.0
+chr1	genetrack	.	139627	139647	531	-	.	stddev=0.0
+chr1	genetrack	.	140133	140153	441	-	.	stddev=0.0
+chr1	genetrack	.	140770	140790	556	-	.	stddev=0.0
+chr1	genetrack	.	141182	141202	14	-	.	stddev=0.0
+chr1	genetrack	.	143551	143571	3	-	.	stddev=0.0
+chr1	genetrack	.	144669	144689	1192	-	.	stddev=0.0959718343646
+chr1	genetrack	.	145383	145403	326	-	.	stddev=0.0
+chr1	genetrack	.	147573	147593	255	-	.	stddev=0.0
+chr1	genetrack	.	148690	148710	2	-	.	stddev=0.0
+chr1	genetrack	.	149704	149724	74	-	.	stddev=0.0
+chr1	genetrack	.	150358	150378	153	-	.	stddev=0.0
+chr1	genetrack	.	151341	151361	593	-	.	stddev=0.0
+chr1	genetrack	.	152984	153004	106	-	.	stddev=0.0
+chr1	genetrack	.	153812	153832	168	-	.	stddev=0.0
+chr1	genetrack	.	154862	154882	14	-	.	stddev=0.0
+chr1	genetrack	.	155111	155131	1051	-	.	stddev=0.0
+chr1	genetrack	.	155456	155476	23	-	.	stddev=0.0
+chr1	genetrack	.	155897	155917	10	-	.	stddev=0.0
+chr1	genetrack	.	157559	157579	337	-	.	stddev=0.0
+chr1	genetrack	.	166467	166487	582	-	.	stddev=0.0
+chr1	genetrack	.	166631	166651	173	-	.	stddev=0.0
+chr1	genetrack	.	169064	169084	76	-	.	stddev=0.0
+chr1	genetrack	.	169500	169520	814	-	.	stddev=0.0
+chr1	genetrack	.	170129	170149	373	-	.	stddev=0.0
+chr1	genetrack	.	170282	170302	63	-	.	stddev=0.0
+chr1	genetrack	.	171063	171083	212	-	.	stddev=0.0
+chr1	genetrack	.	173270	173290	535	-	.	stddev=0.0863866916508
+chr1	genetrack	.	175188	175208	117	-	.	stddev=0.0
+chr1	genetrack	.	175474	175494	1119	-	.	stddev=0.0
+chr1	genetrack	.	176004	176024	1473	-	.	stddev=0.0
+chr1	genetrack	.	177140	177160	93	-	.	stddev=0.0
+chr1	genetrack	.	177386	177406	289	-	.	stddev=0.0
+chr1	genetrack	.	178846	178866	601	-	.	stddev=0.0
+chr1	genetrack	.	178971	178991	723	-	.	stddev=0.0
+chr1	genetrack	.	179116	179136	71	-	.	stddev=0.0
+chr1	genetrack	.	180272	180292	25	-	.	stddev=0.0
+chr1	genetrack	.	180362	180382	59	-	.	stddev=0.0
+chr1	genetrack	.	180995	181015	299	-	.	stddev=0.0
+chr1	genetrack	.	182588	182608	465	-	.	stddev=0.0
+chr1	genetrack	.	182790	182810	355	-	.	stddev=0.0
+chr1	genetrack	.	185122	185142	62	-	.	stddev=0.0
+chr1	genetrack	.	185673	185693	190	-	.	stddev=0.0
+chr1	genetrack	.	187422	187442	20	-	.	stddev=0.0
+chr1	genetrack	.	187976	187996	728	-	.	stddev=0.0
+chr1	genetrack	.	196499	196519	224	-	.	stddev=0.0
+chr1	genetrack	.	197060	197080	224	-	.	stddev=0.0
+chr1	genetrack	.	197151	197171	1464	-	.	stddev=0.0
+chr1	genetrack	.	197342	197362	204	-	.	stddev=0.0
+chr1	genetrack	.	197562	197582	2	-	.	stddev=0.0
+chr1	genetrack	.	198423	198443	598	-	.	stddev=0.0
+chr1	genetrack	.	198953	198973	3	-	.	stddev=0.0
+chr1	genetrack	.	199388	199408	805	-	.	stddev=0.0
+chr1	genetrack	.	199935	199955	31	-	.	stddev=0.0
+chr1	genetrack	.	201308	201328	1287	-	.	stddev=0.0
+chr1	genetrack	.	201651	201671	892	-	.	stddev=0.0
+chr1	genetrack	.	202977	202997	163	-	.	stddev=0.0
+chr1	genetrack	.	203452	203472	76	-	.	stddev=0.0
+chr1	genetrack	.	203835	203855	242	-	.	stddev=0.0
+chr1	genetrack	.	206245	206265	22	-	.	stddev=0.0
+chr1	genetrack	.	207675	207695	313	-	.	stddev=0.0
+chr1	genetrack	.	208559	208579	121	-	.	stddev=0.89393833276
+chr1	genetrack	.	209205	209225	176	-	.	stddev=0.0
+chr1	genetrack	.	220863	220883	2	-	.	stddev=0.0
+chr1	genetrack	.	223035	223055	62	-	.	stddev=0.0
+chr1	genetrack	.	225156	225176	2	-	.	stddev=0.0
+chr1	genetrack	.	226777	226797	444	-	.	stddev=0.0
+chr1	genetrack	.	227608	227628	1311	-	.	stddev=0.0
+chr1	genetrack	.	228405	228425	1447	-	.	stddev=2.78971080368
+chr1	genetrack	.	228691	228711	255	-	.	stddev=0.0
+chr1	genetrack	.	229031	229051	6	-	.	stddev=0.0
+chr1	genetrack	.	229583	229603	62	-	.	stddev=0.0
+chr1	genetrack	.	229665	229685	131	-	.	stddev=0.0
+chr1	genetrack	.	229757	229777	3151	-	.	stddev=2.79078905805
+chr1	genetrack	.	229784	229804	615	-	.	stddev=0.0
+chr1	genetrack	.	229965	229985	13	-	.	stddev=0.0
+chr1	genetrack	.	230120	230140	2	-	.	stddev=0.0
+chr1	genetrack	.	230132	230152	2	-	.	stddev=0.0
+chr1	genetrack	.	230150	230170	7	-	.	stddev=0.699854212224
+chr1	genetrack	.	230173	230193	33	-	.	stddev=0.477212598425
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/largest_d_output2.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,64 @@
+chrom	start	end	value	strand	chrom	start	end	value	strand	midpoint	c-w reads sum	c-w distance (bp)
+chr1	87147	87167	3492.0	+	chr1	87198	87218	2207.0	-	87182	5699.0	51
+chr1	87	107	3211.0	+	chr1	139	159	993.0	-	123	4204.0	52
+chr1	48	68	2842.0	+	chr1	50	70	39.0	-	59	2881.0	2
+chr1	255	275	2810.0	+	chr1	215	235	2611.0	-	245	5421.0	-40
+chr1	117	137	2163.0	+	chr1	176	196	14.0	-	156	2177.0	59
+chr1	86954	86974	1948.0	+	chr1	87049	87069	422.0	-	87011	2370.0	95
+chr1	169107	169127	1811.0	+	chr1	169064	169084	76.0	-	169095	1887.0	-43
+chr1	87171	87191	1436.0	+	chr1	87158	87178	2039.0	-	87174	3475.0	-13
+chr1	201	221	1411.0	+	chr1	279	299	1328.0	-	250	2739.0	78
+chr1	229741	229761	1380.0	+	chr1	229757	229777	3151.0	-	229759	4531.0	16
+chr1	185076	185096	1309.0	+	chr1	185122	185142	62.0	-	185109	1371.0	46
+chr1	39081	39101	1268.0	+	chr1	39052	39072	82.0	-	39076	1350.0	-29
+chr1	92411	92431	1252.0	+	chr1	92411	92431	136.0	-	92421	1388.0	0
+chr1	203872	203892	1234.0	+	chr1	203835	203855	242.0	-	203863	1476.0	-37
+chr1	70776	70796	1148.0	+	chr1	70788	70808	998.0	-	70792	2146.0	12
+chr1	231	251	1146.0	+	chr1	261	281	1278.0	-	256	2424.0	30
+chr1	87098	87118	1125.0	+	chr1	87101	87121	1134.0	-	87109	2259.0	3
+chr1	6163	6183	1049.0	+	chr1	6254	6274	1076.0	-	6218	2125.0	91
+chr1	25246	25266	995.0	+	chr1	25345	25365	188.0	-	25305	1183.0	99
+chr1	101411	101431	973.0	+	chr1	101367	101387	1388.0	-	101399	2361.0	-44
+chr1	139213	139233	965.0	+	chr1	139228	139248	214.0	-	139230	1179.0	15
+chr1	87019	87039	769.0	+	chr1	86991	87011	65.0	-	87015	834.0	-28
+chr1	124318	124338	749.0	+	chr1	124275	124295	12.0	-	124306	761.0	-43
+chr1	348	368	699.0	+	chr1	323	343	486.0	-	345	1185.0	-25
+chr1	92543	92563	699.0	+	chr1	92639	92659	2137.0	-	92601	2836.0	96
+chr1	138868	138888	698.0	+	chr1	138864	138884	13.0	-	138876	711.0	-4
+chr1	307	327	685.0	+	chr1	373	393	200.0	-	350	885.0	66
+chr1	6413	6433	682.0	+	chr1	6476	6496	567.0	-	6454	1249.0	63
+chr1	72781	72801	657.0	+	chr1	72771	72791	406.0	-	72786	1063.0	-10
+chr1	22571	22591	609.0	+	chr1	22569	22589	254.0	-	22580	863.0	-2
+chr1	65152	65172	575.0	+	chr1	65148	65168	43.0	-	65160	618.0	-4
+chr1	106034	106054	558.0	+	chr1	106041	106061	14.0	-	106047	572.0	7
+chr1	155028	155048	522.0	+	chr1	155111	155131	1051.0	-	155079	1573.0	83
+chr1	32449	32469	476.0	+	chr1	32497	32517	2.0	-	32483	478.0	48
+chr1	6706	6726	431.0	+	chr1	6702	6722	2.0	-	6714	433.0	-4
+chr1	113782	113802	420.0	+	chr1	113762	113782	296.0	-	113782	716.0	-20
+chr1	228633	228653	371.0	+	chr1	228691	228711	255.0	-	228672	626.0	58
+chr1	438	458	334.0	+	chr1	468	488	468.0	-	463	802.0	30
+chr1	170119	170139	284.0	+	chr1	170129	170149	373.0	-	170134	657.0	10
+chr1	92631	92651	260.0	+	chr1	92664	92684	187.0	-	92657	447.0	33
+chr1	136366	136386	248.0	+	chr1	136352	136372	117.0	-	136369	365.0	-14
+chr1	108624	108644	206.0	+	chr1	108579	108599	367.0	-	108611	573.0	-45
+chr1	45678	45698	198.0	+	chr1	45643	45663	295.0	-	45670	493.0	-35
+chr1	368	388	192.0	+	chr1	446	466	170.0	-	417	362.0	78
+chr1	682	702	168.0	+	chr1	634	654	151.0	-	668	319.0	-48
+chr1	59190	59210	168.0	+	chr1	59246	59266	397.0	-	59228	565.0	56
+chr1	134170	134190	151.0	+	chr1	134270	134290	508.0	-	134230	659.0	100
+chr1	55495	55515	125.0	+	chr1	55581	55601	831.0	-	55548	956.0	86
+chr1	39197	39217	101.0	+	chr1	39258	39278	261.0	-	39237	362.0	61
+chr1	229721	229741	84.0	+	chr1	229784	229804	615.0	-	229762	699.0	63
+chr1	116660	116680	74.0	+	chr1	116619	116639	699.0	-	116649	773.0	-41
+chr1	19216	19236	42.0	+	chr1	19191	19211	736.0	-	19213	778.0	-25
+chr1	230110	230130	42.0	+	chr1	230173	230193	33.0	-	230151	75.0	63
+chr1	31627	31647	40.0	+	chr1	31693	31713	450.0	-	31670	490.0	66
+chr1	180280	180300	38.0	+	chr1	180362	180382	59.0	-	180331	97.0	82
+chr1	98528	98548	34.0	+	chr1	98555	98575	88.0	-	98551	122.0	27
+chr1	230163	230183	23.0	+	chr1	230150	230170	7.0	-	230166	30.0	-13
+chr1	173262	173282	11.0	+	chr1	173270	173290	535.0	-	173276	546.0	8
+chr1	230145	230165	8.0	+	chr1	230120	230140	2.0	-	230142	10.0	-25
+chr1	95920	95940	5.0	+	chr1	95971	95991	684.0	-	95955	689.0	51
+chr1	199418	199438	5.0	+	chr1	199388	199408	805.0	-	199413	810.0	-30
+chr1	197489	197509	3.0	+	chr1	197562	197582	2.0	-	197535	5.0	73
+chr1	96908	96928	2.0	+	chr1	96911	96931	10.0	-	96919	12.0	3
Binary file test-data/largest_f_output2.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/largest_mp_output1.gff	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,54 @@
+chr1	cwpair	.	87182	87183	5699.0	.	.	cw_distance=51
+chr1	cwpair	.	176	177	4774.0	.	.	cw_distance=98
+chr1	cwpair	.	229759	229760	4531.0	.	.	cw_distance=16
+chr1	cwpair	.	123	124	4204.0	.	.	cw_distance=52
+chr1	cwpair	.	277	278	4138.0	.	.	cw_distance=24
+chr1	cwpair	.	87174	87175	3475.0	.	.	cw_distance=-13
+chr1	cwpair	.	59	60	2881.0	.	.	cw_distance=2
+chr1	cwpair	.	92601	92602	2836.0	.	.	cw_distance=96
+chr1	cwpair	.	241	242	2689.0	.	.	cw_distance=60
+chr1	cwpair	.	87011	87012	2370.0	.	.	cw_distance=95
+chr1	cwpair	.	87109	87110	2259.0	.	.	cw_distance=3
+chr1	cwpair	.	70792	70793	2146.0	.	.	cw_distance=12
+chr1	cwpair	.	6218	6219	2125.0	.	.	cw_distance=91
+chr1	cwpair	.	287	288	1632.0	.	.	cw_distance=92
+chr1	cwpair	.	155079	155080	1573.0	.	.	cw_distance=83
+chr1	cwpair	.	92421	92422	1388.0	.	.	cw_distance=0
+chr1	cwpair	.	185109	185110	1371.0	.	.	cw_distance=46
+chr1	cwpair	.	6454	6455	1249.0	.	.	cw_distance=63
+chr1	cwpair	.	25305	25306	1183.0	.	.	cw_distance=99
+chr1	cwpair	.	139230	139231	1179.0	.	.	cw_distance=15
+chr1	cwpair	.	72786	72787	1063.0	.	.	cw_distance=-10
+chr1	cwpair	.	55548	55549	956.0	.	.	cw_distance=86
+chr1	cwpair	.	370	371	899.0	.	.	cw_distance=25
+chr1	cwpair	.	22580	22581	863.0	.	.	cw_distance=-2
+chr1	cwpair	.	357	358	852.0	.	.	cw_distance=81
+chr1	cwpair	.	463	464	802.0	.	.	cw_distance=30
+chr1	cwpair	.	19213	19214	778.0	.	.	cw_distance=-25
+chr1	cwpair	.	113782	113783	716.0	.	.	cw_distance=-20
+chr1	cwpair	.	138876	138877	711.0	.	.	cw_distance=-4
+chr1	cwpair	.	229762	229763	699.0	.	.	cw_distance=63
+chr1	cwpair	.	95955	95956	689.0	.	.	cw_distance=51
+chr1	cwpair	.	134230	134231	659.0	.	.	cw_distance=100
+chr1	cwpair	.	170134	170135	657.0	.	.	cw_distance=10
+chr1	cwpair	.	228672	228673	626.0	.	.	cw_distance=58
+chr1	cwpair	.	65160	65161	618.0	.	.	cw_distance=-4
+chr1	cwpair	.	87006	87007	615.0	.	.	cw_distance=-11
+chr1	cwpair	.	106047	106048	572.0	.	.	cw_distance=7
+chr1	cwpair	.	59228	59229	565.0	.	.	cw_distance=56
+chr1	cwpair	.	173276	173277	546.0	.	.	cw_distance=8
+chr1	cwpair	.	31670	31671	490.0	.	.	cw_distance=66
+chr1	cwpair	.	32483	32484	478.0	.	.	cw_distance=48
+chr1	cwpair	.	178	179	465.0	.	.	cw_distance=16
+chr1	cwpair	.	92657	92658	447.0	.	.	cw_distance=33
+chr1	cwpair	.	6714	6715	433.0	.	.	cw_distance=-4
+chr1	cwpair	.	136369	136370	365.0	.	.	cw_distance=-14
+chr1	cwpair	.	417	418	362.0	.	.	cw_distance=78
+chr1	cwpair	.	39237	39238	362.0	.	.	cw_distance=61
+chr1	cwpair	.	627	628	247.0	.	.	cw_distance=33
+chr1	cwpair	.	98551	98552	122.0	.	.	cw_distance=27
+chr1	cwpair	.	180331	180332	97.0	.	.	cw_distance=82
+chr1	cwpair	.	230151	230152	75.0	.	.	cw_distance=63
+chr1	cwpair	.	230166	230167	30.0	.	.	cw_distance=-13
+chr1	cwpair	.	96919	96920	12.0	.	.	cw_distance=3
+chr1	cwpair	.	230142	230143	10.0	.	.	cw_distance=-25
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/largest_mp_output2.gff	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,63 @@
+chr1	cwpair	.	87182	87183	5699.0	.	.	cw_distance=51
+chr1	cwpair	.	245	246	5421.0	.	.	cw_distance=-40
+chr1	cwpair	.	229759	229760	4531.0	.	.	cw_distance=16
+chr1	cwpair	.	123	124	4204.0	.	.	cw_distance=52
+chr1	cwpair	.	87174	87175	3475.0	.	.	cw_distance=-13
+chr1	cwpair	.	59	60	2881.0	.	.	cw_distance=2
+chr1	cwpair	.	92601	92602	2836.0	.	.	cw_distance=96
+chr1	cwpair	.	250	251	2739.0	.	.	cw_distance=78
+chr1	cwpair	.	256	257	2424.0	.	.	cw_distance=30
+chr1	cwpair	.	87011	87012	2370.0	.	.	cw_distance=95
+chr1	cwpair	.	101399	101400	2361.0	.	.	cw_distance=-44
+chr1	cwpair	.	87109	87110	2259.0	.	.	cw_distance=3
+chr1	cwpair	.	156	157	2177.0	.	.	cw_distance=59
+chr1	cwpair	.	70792	70793	2146.0	.	.	cw_distance=12
+chr1	cwpair	.	6218	6219	2125.0	.	.	cw_distance=91
+chr1	cwpair	.	169095	169096	1887.0	.	.	cw_distance=-43
+chr1	cwpair	.	155079	155080	1573.0	.	.	cw_distance=83
+chr1	cwpair	.	203863	203864	1476.0	.	.	cw_distance=-37
+chr1	cwpair	.	92421	92422	1388.0	.	.	cw_distance=0
+chr1	cwpair	.	185109	185110	1371.0	.	.	cw_distance=46
+chr1	cwpair	.	39076	39077	1350.0	.	.	cw_distance=-29
+chr1	cwpair	.	6454	6455	1249.0	.	.	cw_distance=63
+chr1	cwpair	.	345	346	1185.0	.	.	cw_distance=-25
+chr1	cwpair	.	25305	25306	1183.0	.	.	cw_distance=99
+chr1	cwpair	.	139230	139231	1179.0	.	.	cw_distance=15
+chr1	cwpair	.	72786	72787	1063.0	.	.	cw_distance=-10
+chr1	cwpair	.	55548	55549	956.0	.	.	cw_distance=86
+chr1	cwpair	.	350	351	885.0	.	.	cw_distance=66
+chr1	cwpair	.	22580	22581	863.0	.	.	cw_distance=-2
+chr1	cwpair	.	87015	87016	834.0	.	.	cw_distance=-28
+chr1	cwpair	.	199413	199414	810.0	.	.	cw_distance=-30
+chr1	cwpair	.	463	464	802.0	.	.	cw_distance=30
+chr1	cwpair	.	19213	19214	778.0	.	.	cw_distance=-25
+chr1	cwpair	.	116649	116650	773.0	.	.	cw_distance=-41
+chr1	cwpair	.	124306	124307	761.0	.	.	cw_distance=-43
+chr1	cwpair	.	113782	113783	716.0	.	.	cw_distance=-20
+chr1	cwpair	.	138876	138877	711.0	.	.	cw_distance=-4
+chr1	cwpair	.	229762	229763	699.0	.	.	cw_distance=63
+chr1	cwpair	.	95955	95956	689.0	.	.	cw_distance=51
+chr1	cwpair	.	134230	134231	659.0	.	.	cw_distance=100
+chr1	cwpair	.	170134	170135	657.0	.	.	cw_distance=10
+chr1	cwpair	.	228672	228673	626.0	.	.	cw_distance=58
+chr1	cwpair	.	65160	65161	618.0	.	.	cw_distance=-4
+chr1	cwpair	.	151365	151366	595.0	.	.	cw_distance=-28
+chr1	cwpair	.	108611	108612	573.0	.	.	cw_distance=-45
+chr1	cwpair	.	106047	106048	572.0	.	.	cw_distance=7
+chr1	cwpair	.	59228	59229	565.0	.	.	cw_distance=56
+chr1	cwpair	.	173276	173277	546.0	.	.	cw_distance=8
+chr1	cwpair	.	45670	45671	493.0	.	.	cw_distance=-35
+chr1	cwpair	.	31670	31671	490.0	.	.	cw_distance=66
+chr1	cwpair	.	32483	32484	478.0	.	.	cw_distance=48
+chr1	cwpair	.	92657	92658	447.0	.	.	cw_distance=33
+chr1	cwpair	.	6714	6715	433.0	.	.	cw_distance=-4
+chr1	cwpair	.	136369	136370	365.0	.	.	cw_distance=-14
+chr1	cwpair	.	417	418	362.0	.	.	cw_distance=78
+chr1	cwpair	.	39237	39238	362.0	.	.	cw_distance=61
+chr1	cwpair	.	668	669	319.0	.	.	cw_distance=-48
+chr1	cwpair	.	98551	98552	122.0	.	.	cw_distance=27
+chr1	cwpair	.	180331	180332	97.0	.	.	cw_distance=82
+chr1	cwpair	.	230151	230152	75.0	.	.	cw_distance=63
+chr1	cwpair	.	230166	230167	30.0	.	.	cw_distance=-13
+chr1	cwpair	.	96919	96920	12.0	.	.	cw_distance=3
+chr1	cwpair	.	230142	230143	10.0	.	.	cw_distance=-25
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/largest_o_output2.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,100 @@
+chrom	strand	start	end	value
+chr1	+	100364	100384	2695.0
+chr1	+	30	50	2140.0
+chr1	+	5379	5399	1572.0
+chr1	+	52440	52460	1562.0
+chr1	+	73234	73254	1492.0
+chr1	+	31096	31116	1481.0
+chr1	+	145253	145273	1394.0
+chr1	+	10641	10661	1359.0
+chr1	+	200580	200600	1298.0
+chr1	+	64772	64792	1292.0
+chr1	+	86886	86906	1253.0
+chr1	+	103207	103227	1229.0
+chr1	+	43835	43855	1173.0
+chr1	+	29570	29590	1130.0
+chr1	+	83774	83794	1125.0
+chr1	+	165827	165847	1109.0
+chr1	+	92775	92795	1105.0
+chr1	+	4748	4768	1077.0
+chr1	+	126733	126753	952.0
+chr1	+	71041	71061	881.0
+chr1	+	35773	35793	866.0
+chr1	+	53097	53117	835.0
+chr1	+	71556	71576	835.0
+chr1	+	30964	30984	829.0
+chr1	+	31019	31039	810.0
+chr1	+	55349	55369	794.0
+chr1	+	203193	203213	789.0
+chr1	+	39794	39814	780.0
+chr1	+	153928	153948	768.0
+chr1	+	179472	179492	696.0
+chr1	+	178117	178137	686.0
+chr1	+	1298	1318	684.0
+chr1	+	87085	87105	676.0
+chr1	+	192754	192774	668.0
+chr1	+	89611	89631	640.0
+chr1	+	20205	20225	634.0
+chr1	+	118428	118448	633.0
+chr1	+	110736	110756	621.0
+chr1	+	48642	48662	610.0
+chr1	+	159372	159392	605.0
+chr1	+	6453	6473	601.0
+chr1	+	112137	112157	601.0
+chr1	+	142905	142925	599.0
+chr1	+	167443	167463	597.0
+chr1	+	126073	126093	590.0
+chr1	+	6233	6253	589.0
+chr1	+	43657	43677	586.0
+chr1	+	134021	134041	572.0
+chr1	+	29864	29884	570.0
+chr1	+	70953	70973	555.0
+chr1	+	87002	87022	550.0
+chr1	+	129555	129575	536.0
+chr1	+	119754	119774	515.0
+chr1	+	43523	43543	505.0
+chr1	+	97898	97918	501.0
+chr1	+	40830	40850	491.0
+chr1	+	153095	153115	490.0
+chr1	+	7303	7323	484.0
+chr1	+	115866	115886	480.0
+chr1	+	129680	129700	464.0
+chr1	+	187155	187175	455.0
+chr1	+	192271	192291	453.0
+chr1	+	160	180	451.0
+chr1	+	150449	150469	436.0
+chr1	+	9367	9387	425.0
+chr1	+	93793	93813	415.0
+chr1	+	87572	87592	407.0
+chr1	+	124845	124865	383.0
+chr1	+	4053	4073	381.0
+chr1	+	136072	136092	380.0
+chr1	+	39942	39962	375.0
+chr1	+	61977	61997	368.0
+chr1	+	2976	2996	356.0
+chr1	+	27978	27998	354.0
+chr1	+	195756	195776	348.0
+chr1	+	172223	172243	338.0
+chr1	+	143657	143677	328.0
+chr1	+	45409	45429	307.0
+chr1	+	45248	45268	305.0
+chr1	+	72671	72691	304.0
+chr1	+	68564	68584	303.0
+chr1	+	119953	119973	295.0
+chr1	+	48319	48339	290.0
+chr1	+	48772	48792	284.0
+chr1	+	126369	126389	284.0
+chr1	+	116432	116452	267.0
+chr1	+	199649	199669	264.0
+chr1	+	204126	204146	261.0
+chr1	+	130514	130534	243.0
+chr1	+	55692	55712	228.0
+chr1	+	117198	117218	228.0
+chr1	+	42843	42863	218.0
+chr1	+	59583	59603	204.0
+chr1	+	124669	124689	203.0
+chr1	+	2613	2633	202.0
+chr1	+	40264	40284	199.0
+chr1	+	21406	21426	177.0
+chr1	+	20391	20411	173.0
+chr1	+	20626	20646	171.0
Binary file test-data/mode_c_output2.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mode_d_output2.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,67 @@
+chrom	start	end	value	strand	chrom	start	end	value	strand	midpoint	c-w reads sum	c-w distance (bp)
+chr1	87147	87167	3492.0	+	chr1	87198	87218	2207.0	-	87182	5699.0	51
+chr1	87	107	3211.0	+	chr1	139	159	993.0	-	123	4204.0	52
+chr1	48	68	2842.0	+	chr1	50	70	39.0	-	59	2881.0	2
+chr1	255	275	2810.0	+	chr1	323	343	486.0	-	299	3296.0	68
+chr1	117	137	2163.0	+	chr1	176	196	14.0	-	156	2177.0	59
+chr1	86954	86974	1948.0	+	chr1	86991	87011	65.0	-	86982	2013.0	37
+chr1	169107	169127	1811.0	+	chr1	169064	169084	76.0	-	169095	1887.0	-43
+chr1	87171	87191	1436.0	+	chr1	87234	87254	637.0	-	87212	2073.0	63
+chr1	201	221	1411.0	+	chr1	261	281	1278.0	-	241	2689.0	60
+chr1	229741	229761	1380.0	+	chr1	229784	229804	615.0	-	229772	1995.0	43
+chr1	185076	185096	1309.0	+	chr1	185122	185142	62.0	-	185109	1371.0	46
+chr1	39081	39101	1268.0	+	chr1	39052	39072	82.0	-	39076	1350.0	-29
+chr1	92411	92431	1252.0	+	chr1	92411	92431	136.0	-	92421	1388.0	0
+chr1	203872	203892	1234.0	+	chr1	203835	203855	242.0	-	203863	1476.0	-37
+chr1	70776	70796	1148.0	+	chr1	70788	70808	998.0	-	70792	2146.0	12
+chr1	231	251	1146.0	+	chr1	279	299	1328.0	-	265	2474.0	48
+chr1	87098	87118	1125.0	+	chr1	87158	87178	2039.0	-	87138	3164.0	60
+chr1	6163	6183	1049.0	+	chr1	6254	6274	1076.0	-	6218	2125.0	91
+chr1	25246	25266	995.0	+	chr1	25345	25365	188.0	-	25305	1183.0	99
+chr1	101411	101431	973.0	+	chr1	101367	101387	1388.0	-	101399	2361.0	-44
+chr1	139213	139233	965.0	+	chr1	139228	139248	214.0	-	139230	1179.0	15
+chr1	87019	87039	769.0	+	chr1	87101	87121	1134.0	-	87070	1903.0	82
+chr1	124318	124338	749.0	+	chr1	124275	124295	12.0	-	124306	761.0	-43
+chr1	348	368	699.0	+	chr1	410	430	8.0	-	389	707.0	62
+chr1	92543	92563	699.0	+	chr1	92639	92659	2137.0	-	92601	2836.0	96
+chr1	138868	138888	698.0	+	chr1	138864	138884	13.0	-	138876	711.0	-4
+chr1	307	327	685.0	+	chr1	373	393	200.0	-	350	885.0	66
+chr1	6413	6433	682.0	+	chr1	6476	6496	567.0	-	6454	1249.0	63
+chr1	87085	87105	676.0	+	chr1	87049	87069	422.0	-	87077	1098.0	-36
+chr1	72781	72801	657.0	+	chr1	72810	72830	212.0	-	72805	869.0	29
+chr1	22571	22591	609.0	+	chr1	22569	22589	254.0	-	22580	863.0	-2
+chr1	65152	65172	575.0	+	chr1	65148	65168	43.0	-	65160	618.0	-4
+chr1	106034	106054	558.0	+	chr1	106041	106061	14.0	-	106047	572.0	7
+chr1	155028	155048	522.0	+	chr1	155111	155131	1051.0	-	155079	1573.0	83
+chr1	32449	32469	476.0	+	chr1	32497	32517	2.0	-	32483	478.0	48
+chr1	160	180	451.0	+	chr1	215	235	2611.0	-	197	3062.0	55
+chr1	6706	6726	431.0	+	chr1	6702	6722	2.0	-	6714	433.0	-4
+chr1	113782	113802	420.0	+	chr1	113762	113782	296.0	-	113782	716.0	-20
+chr1	228633	228653	371.0	+	chr1	228691	228711	255.0	-	228672	626.0	58
+chr1	438	458	334.0	+	chr1	468	488	468.0	-	463	802.0	30
+chr1	72671	72691	304.0	+	chr1	72771	72791	406.0	-	72731	710.0	100
+chr1	170119	170139	284.0	+	chr1	170129	170149	373.0	-	170134	657.0	10
+chr1	92631	92651	260.0	+	chr1	92664	92684	187.0	-	92657	447.0	33
+chr1	136366	136386	248.0	+	chr1	136352	136372	117.0	-	136369	365.0	-14
+chr1	108624	108644	206.0	+	chr1	108579	108599	367.0	-	108611	573.0	-45
+chr1	45678	45698	198.0	+	chr1	45643	45663	295.0	-	45670	493.0	-35
+chr1	368	388	192.0	+	chr1	446	466	170.0	-	417	362.0	78
+chr1	682	702	168.0	+	chr1	634	654	151.0	-	668	319.0	-48
+chr1	59190	59210	168.0	+	chr1	59246	59266	397.0	-	59228	565.0	56
+chr1	134170	134190	151.0	+	chr1	134270	134290	508.0	-	134230	659.0	100
+chr1	55495	55515	125.0	+	chr1	55581	55601	831.0	-	55548	956.0	86
+chr1	39197	39217	101.0	+	chr1	39258	39278	261.0	-	39237	362.0	61
+chr1	229721	229741	84.0	+	chr1	229757	229777	3151.0	-	229749	3235.0	36
+chr1	116660	116680	74.0	+	chr1	116619	116639	699.0	-	116649	773.0	-41
+chr1	19216	19236	42.0	+	chr1	19191	19211	736.0	-	19213	778.0	-25
+chr1	230110	230130	42.0	+	chr1	230173	230193	33.0	-	230151	75.0	63
+chr1	31627	31647	40.0	+	chr1	31693	31713	450.0	-	31670	490.0	66
+chr1	180280	180300	38.0	+	chr1	180362	180382	59.0	-	180331	97.0	82
+chr1	98528	98548	34.0	+	chr1	98555	98575	88.0	-	98551	122.0	27
+chr1	230163	230183	23.0	+	chr1	230150	230170	7.0	-	230166	30.0	-13
+chr1	173262	173282	11.0	+	chr1	173270	173290	535.0	-	173276	546.0	8
+chr1	230145	230165	8.0	+	chr1	230132	230152	2.0	-	230148	10.0	-13
+chr1	95920	95940	5.0	+	chr1	95971	95991	684.0	-	95955	689.0	51
+chr1	199418	199438	5.0	+	chr1	199388	199408	805.0	-	199413	810.0	-30
+chr1	197489	197509	3.0	+	chr1	197562	197582	2.0	-	197535	5.0	73
+chr1	96908	96928	2.0	+	chr1	96911	96931	10.0	-	96919	12.0	3
Binary file test-data/mode_f_output2.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mode_mp_output1.gff	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,56 @@
+chr1	cwpair	.	87182	87183	5699.0	.	.	cw_distance=51
+chr1	cwpair	.	123	124	4204.0	.	.	cw_distance=52
+chr1	cwpair	.	299	300	3296.0	.	.	cw_distance=68
+chr1	cwpair	.	229749	229750	3235.0	.	.	cw_distance=36
+chr1	cwpair	.	87138	87139	3164.0	.	.	cw_distance=60
+chr1	cwpair	.	197	198	3062.0	.	.	cw_distance=55
+chr1	cwpair	.	59	60	2881.0	.	.	cw_distance=2
+chr1	cwpair	.	92601	92602	2836.0	.	.	cw_distance=96
+chr1	cwpair	.	241	242	2689.0	.	.	cw_distance=60
+chr1	cwpair	.	265	266	2474.0	.	.	cw_distance=48
+chr1	cwpair	.	156	157	2177.0	.	.	cw_distance=59
+chr1	cwpair	.	70792	70793	2146.0	.	.	cw_distance=12
+chr1	cwpair	.	6218	6219	2125.0	.	.	cw_distance=91
+chr1	cwpair	.	87212	87213	2073.0	.	.	cw_distance=63
+chr1	cwpair	.	86982	86983	2013.0	.	.	cw_distance=37
+chr1	cwpair	.	229772	229773	1995.0	.	.	cw_distance=43
+chr1	cwpair	.	87070	87071	1903.0	.	.	cw_distance=82
+chr1	cwpair	.	155079	155080	1573.0	.	.	cw_distance=83
+chr1	cwpair	.	92421	92422	1388.0	.	.	cw_distance=0
+chr1	cwpair	.	185109	185110	1371.0	.	.	cw_distance=46
+chr1	cwpair	.	6454	6455	1249.0	.	.	cw_distance=63
+chr1	cwpair	.	25305	25306	1183.0	.	.	cw_distance=99
+chr1	cwpair	.	139230	139231	1179.0	.	.	cw_distance=15
+chr1	cwpair	.	87035	87036	972.0	.	.	cw_distance=47
+chr1	cwpair	.	55548	55549	956.0	.	.	cw_distance=86
+chr1	cwpair	.	350	351	885.0	.	.	cw_distance=66
+chr1	cwpair	.	72805	72806	869.0	.	.	cw_distance=29
+chr1	cwpair	.	22580	22581	863.0	.	.	cw_distance=-2
+chr1	cwpair	.	463	464	802.0	.	.	cw_distance=30
+chr1	cwpair	.	19213	19214	778.0	.	.	cw_distance=-25
+chr1	cwpair	.	113782	113783	716.0	.	.	cw_distance=-20
+chr1	cwpair	.	138876	138877	711.0	.	.	cw_distance=-4
+chr1	cwpair	.	72731	72732	710.0	.	.	cw_distance=100
+chr1	cwpair	.	389	390	707.0	.	.	cw_distance=62
+chr1	cwpair	.	95955	95956	689.0	.	.	cw_distance=51
+chr1	cwpair	.	134230	134231	659.0	.	.	cw_distance=100
+chr1	cwpair	.	170134	170135	657.0	.	.	cw_distance=10
+chr1	cwpair	.	228672	228673	626.0	.	.	cw_distance=58
+chr1	cwpair	.	65160	65161	618.0	.	.	cw_distance=-4
+chr1	cwpair	.	106047	106048	572.0	.	.	cw_distance=7
+chr1	cwpair	.	59228	59229	565.0	.	.	cw_distance=56
+chr1	cwpair	.	173276	173277	546.0	.	.	cw_distance=8
+chr1	cwpair	.	31670	31671	490.0	.	.	cw_distance=66
+chr1	cwpair	.	32483	32484	478.0	.	.	cw_distance=48
+chr1	cwpair	.	92657	92658	447.0	.	.	cw_distance=33
+chr1	cwpair	.	6714	6715	433.0	.	.	cw_distance=-4
+chr1	cwpair	.	136369	136370	365.0	.	.	cw_distance=-14
+chr1	cwpair	.	417	418	362.0	.	.	cw_distance=78
+chr1	cwpair	.	39237	39238	362.0	.	.	cw_distance=61
+chr1	cwpair	.	627	628	247.0	.	.	cw_distance=33
+chr1	cwpair	.	98551	98552	122.0	.	.	cw_distance=27
+chr1	cwpair	.	180331	180332	97.0	.	.	cw_distance=82
+chr1	cwpair	.	230151	230152	75.0	.	.	cw_distance=63
+chr1	cwpair	.	230166	230167	30.0	.	.	cw_distance=-13
+chr1	cwpair	.	96919	96920	12.0	.	.	cw_distance=3
+chr1	cwpair	.	230148	230149	10.0	.	.	cw_distance=-13
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mode_mp_output2.gff	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,66 @@
+chr1	cwpair	.	87182	87183	5699.0	.	.	cw_distance=51
+chr1	cwpair	.	123	124	4204.0	.	.	cw_distance=52
+chr1	cwpair	.	299	300	3296.0	.	.	cw_distance=68
+chr1	cwpair	.	229749	229750	3235.0	.	.	cw_distance=36
+chr1	cwpair	.	87138	87139	3164.0	.	.	cw_distance=60
+chr1	cwpair	.	197	198	3062.0	.	.	cw_distance=55
+chr1	cwpair	.	59	60	2881.0	.	.	cw_distance=2
+chr1	cwpair	.	92601	92602	2836.0	.	.	cw_distance=96
+chr1	cwpair	.	241	242	2689.0	.	.	cw_distance=60
+chr1	cwpair	.	265	266	2474.0	.	.	cw_distance=48
+chr1	cwpair	.	101399	101400	2361.0	.	.	cw_distance=-44
+chr1	cwpair	.	156	157	2177.0	.	.	cw_distance=59
+chr1	cwpair	.	70792	70793	2146.0	.	.	cw_distance=12
+chr1	cwpair	.	6218	6219	2125.0	.	.	cw_distance=91
+chr1	cwpair	.	87212	87213	2073.0	.	.	cw_distance=63
+chr1	cwpair	.	86982	86983	2013.0	.	.	cw_distance=37
+chr1	cwpair	.	229772	229773	1995.0	.	.	cw_distance=43
+chr1	cwpair	.	87070	87071	1903.0	.	.	cw_distance=82
+chr1	cwpair	.	169095	169096	1887.0	.	.	cw_distance=-43
+chr1	cwpair	.	155079	155080	1573.0	.	.	cw_distance=83
+chr1	cwpair	.	203863	203864	1476.0	.	.	cw_distance=-37
+chr1	cwpair	.	92421	92422	1388.0	.	.	cw_distance=0
+chr1	cwpair	.	185109	185110	1371.0	.	.	cw_distance=46
+chr1	cwpair	.	39076	39077	1350.0	.	.	cw_distance=-29
+chr1	cwpair	.	6454	6455	1249.0	.	.	cw_distance=63
+chr1	cwpair	.	25305	25306	1183.0	.	.	cw_distance=99
+chr1	cwpair	.	139230	139231	1179.0	.	.	cw_distance=15
+chr1	cwpair	.	87077	87078	1098.0	.	.	cw_distance=-36
+chr1	cwpair	.	55548	55549	956.0	.	.	cw_distance=86
+chr1	cwpair	.	350	351	885.0	.	.	cw_distance=66
+chr1	cwpair	.	72805	72806	869.0	.	.	cw_distance=29
+chr1	cwpair	.	22580	22581	863.0	.	.	cw_distance=-2
+chr1	cwpair	.	199413	199414	810.0	.	.	cw_distance=-30
+chr1	cwpair	.	463	464	802.0	.	.	cw_distance=30
+chr1	cwpair	.	19213	19214	778.0	.	.	cw_distance=-25
+chr1	cwpair	.	116649	116650	773.0	.	.	cw_distance=-41
+chr1	cwpair	.	124306	124307	761.0	.	.	cw_distance=-43
+chr1	cwpair	.	113782	113783	716.0	.	.	cw_distance=-20
+chr1	cwpair	.	138876	138877	711.0	.	.	cw_distance=-4
+chr1	cwpair	.	72731	72732	710.0	.	.	cw_distance=100
+chr1	cwpair	.	389	390	707.0	.	.	cw_distance=62
+chr1	cwpair	.	95955	95956	689.0	.	.	cw_distance=51
+chr1	cwpair	.	134230	134231	659.0	.	.	cw_distance=100
+chr1	cwpair	.	170134	170135	657.0	.	.	cw_distance=10
+chr1	cwpair	.	228672	228673	626.0	.	.	cw_distance=58
+chr1	cwpair	.	65160	65161	618.0	.	.	cw_distance=-4
+chr1	cwpair	.	151365	151366	595.0	.	.	cw_distance=-28
+chr1	cwpair	.	108611	108612	573.0	.	.	cw_distance=-45
+chr1	cwpair	.	106047	106048	572.0	.	.	cw_distance=7
+chr1	cwpair	.	59228	59229	565.0	.	.	cw_distance=56
+chr1	cwpair	.	173276	173277	546.0	.	.	cw_distance=8
+chr1	cwpair	.	45670	45671	493.0	.	.	cw_distance=-35
+chr1	cwpair	.	31670	31671	490.0	.	.	cw_distance=66
+chr1	cwpair	.	32483	32484	478.0	.	.	cw_distance=48
+chr1	cwpair	.	92657	92658	447.0	.	.	cw_distance=33
+chr1	cwpair	.	6714	6715	433.0	.	.	cw_distance=-4
+chr1	cwpair	.	136369	136370	365.0	.	.	cw_distance=-14
+chr1	cwpair	.	417	418	362.0	.	.	cw_distance=78
+chr1	cwpair	.	39237	39238	362.0	.	.	cw_distance=61
+chr1	cwpair	.	668	669	319.0	.	.	cw_distance=-48
+chr1	cwpair	.	98551	98552	122.0	.	.	cw_distance=27
+chr1	cwpair	.	180331	180332	97.0	.	.	cw_distance=82
+chr1	cwpair	.	230151	230152	75.0	.	.	cw_distance=63
+chr1	cwpair	.	230166	230167	30.0	.	.	cw_distance=-13
+chr1	cwpair	.	96919	96920	12.0	.	.	cw_distance=3
+chr1	cwpair	.	230148	230149	10.0	.	.	cw_distance=-13
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mode_o_output2.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,100 @@
+chrom	strand	start	end	value
+chr1	+	100364	100384	2695.0
+chr1	+	30	50	2140.0
+chr1	+	5379	5399	1572.0
+chr1	+	52440	52460	1562.0
+chr1	+	73234	73254	1492.0
+chr1	+	31096	31116	1481.0
+chr1	+	145253	145273	1394.0
+chr1	+	10641	10661	1359.0
+chr1	+	200580	200600	1298.0
+chr1	+	64772	64792	1292.0
+chr1	+	86886	86906	1253.0
+chr1	+	103207	103227	1229.0
+chr1	+	43835	43855	1173.0
+chr1	+	29570	29590	1130.0
+chr1	+	83774	83794	1125.0
+chr1	+	165827	165847	1109.0
+chr1	+	92775	92795	1105.0
+chr1	+	4748	4768	1077.0
+chr1	+	126733	126753	952.0
+chr1	+	71041	71061	881.0
+chr1	+	35773	35793	866.0
+chr1	+	53097	53117	835.0
+chr1	+	71556	71576	835.0
+chr1	+	30964	30984	829.0
+chr1	+	31019	31039	810.0
+chr1	+	55349	55369	794.0
+chr1	+	203193	203213	789.0
+chr1	+	39794	39814	780.0
+chr1	+	153928	153948	768.0
+chr1	+	179472	179492	696.0
+chr1	+	178117	178137	686.0
+chr1	+	1298	1318	684.0
+chr1	+	192754	192774	668.0
+chr1	+	89611	89631	640.0
+chr1	+	20205	20225	634.0
+chr1	+	118428	118448	633.0
+chr1	+	110736	110756	621.0
+chr1	+	48642	48662	610.0
+chr1	+	159372	159392	605.0
+chr1	+	6453	6473	601.0
+chr1	+	112137	112157	601.0
+chr1	+	142905	142925	599.0
+chr1	+	167443	167463	597.0
+chr1	+	126073	126093	590.0
+chr1	+	6233	6253	589.0
+chr1	+	43657	43677	586.0
+chr1	+	134021	134041	572.0
+chr1	+	29864	29884	570.0
+chr1	+	70953	70973	555.0
+chr1	+	87002	87022	550.0
+chr1	+	129555	129575	536.0
+chr1	+	119754	119774	515.0
+chr1	+	43523	43543	505.0
+chr1	+	97898	97918	501.0
+chr1	+	40830	40850	491.0
+chr1	+	153095	153115	490.0
+chr1	+	7303	7323	484.0
+chr1	+	115866	115886	480.0
+chr1	+	129680	129700	464.0
+chr1	+	187155	187175	455.0
+chr1	+	192271	192291	453.0
+chr1	+	150449	150469	436.0
+chr1	+	9367	9387	425.0
+chr1	+	93793	93813	415.0
+chr1	+	87572	87592	407.0
+chr1	+	124845	124865	383.0
+chr1	+	4053	4073	381.0
+chr1	+	136072	136092	380.0
+chr1	+	39942	39962	375.0
+chr1	+	61977	61997	368.0
+chr1	+	2976	2996	356.0
+chr1	+	27978	27998	354.0
+chr1	+	195756	195776	348.0
+chr1	+	172223	172243	338.0
+chr1	+	143657	143677	328.0
+chr1	+	45409	45429	307.0
+chr1	+	45248	45268	305.0
+chr1	+	68564	68584	303.0
+chr1	+	119953	119973	295.0
+chr1	+	48319	48339	290.0
+chr1	+	48772	48792	284.0
+chr1	+	126369	126389	284.0
+chr1	+	116432	116452	267.0
+chr1	+	199649	199669	264.0
+chr1	+	204126	204146	261.0
+chr1	+	130514	130534	243.0
+chr1	+	55692	55712	228.0
+chr1	+	117198	117218	228.0
+chr1	+	42843	42863	218.0
+chr1	+	59583	59603	204.0
+chr1	+	124669	124689	203.0
+chr1	+	2613	2633	202.0
+chr1	+	40264	40284	199.0
+chr1	+	21406	21426	177.0
+chr1	+	20391	20411	173.0
+chr1	+	20626	20646	171.0
+chr1	+	198594	198614	170.0
+chr1	+	149343	149363	159.0
+chr1	+	121016	121036	155.0
Binary file test-data/mode_p_output2.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/statistics1.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,4 @@
+fname	final_mode	preview_mode	perc95	paired	orphans
+mode: data 1	63.5	63.5	1437.0	114	384
+closest: data 1	10.5	NA	1437.0	112	386
+largest: data 1	-3.5	NA	1437.0	110	388
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/statistics2.tabular	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,4 @@
+fname	final_mode	preview_mode	perc95	paired	orphans
+mode: data 1	63.5	63.5	1437.0	134	364
+closest: data 1	8.5	NA	1437.0	132	366
+largest: data 1	-24.5	NA	1437.0	128	370
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Tue Dec 22 17:03:46 2015 -0500
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="anaconda" version="2.3.0">
+        <repository changeset_revision="94d978ebbfd4" name="package_anaconda_2_3_0" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>