changeset 0:cc18bac5afdb draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/replaceColumn/tools/replaceColumn commit 045006e0b2fe5b4fe96583949b0c757eb6a734a4
author bgruening
date Fri, 24 Feb 2017 10:14:15 -0500
parents
children d533e4b75800
files replaceColumn.xml test-data/GRCh38_ensembl2UCSC.txt test-data/empty_mapping test-data/original_file test-data/result_file test-data/result_file_empty_mapping
diffstat 6 files changed, 786 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/replaceColumn.xml	Fri Feb 24 10:14:15 2017 -0500
@@ -0,0 +1,107 @@
+<tool id="replace_column_with_key_value_file" name="Replace column" version="0.1">
+    <description>by values which are defined in a convert file</description>
+    <command>
+        <![CDATA[
+        python '$replaceColumnScript'
+        ]]>
+    </command>
+    <configfiles>
+        <configfile name="replaceColumnScript">
+            <![CDATA[
+import sys
+
+replace_file = '$replace_information'
+original_file = '$original_file'
+column = int("$column_replace") - 1
+ignore_start_lines = int("$skip_lines")
+delimiter_local = "\t" if str("$delimiter") == "" else str("$delimiter")
+
+## read conversion information to index 
+conversion = {}
+
+with open(replace_file, 'r') as conversion_file:
+    for line in conversion_file:
+        conv_key_value = line.strip().split()
+        if len(conv_key_value) == 2:
+            conversion[conv_key_value[0]] = conv_key_value[1]                
+
+## read file line by line, search for column entry if it can be replaced. Otherwise it will be skipped.
+with open("output_file", 'w') as output:
+    with open(original_file) as original:
+        for i, line in enumerate(original):
+            if i < ignore_start_lines:
+                output.write(line)
+                continue
+
+            if str("$delimiter") == "":
+                line_content = line.split()
+            else:
+                line_content = line.split(str("$delimiter"))
+
+            out = list()
+            for j, line_content_column in enumerate(line_content):
+                if j == column:
+                    if line_content_column in conversion:
+                        out.append(conversion[line_content_column])
+                else:
+                    out.append(line_content_column)
+
+            if len(out) == len(line_content):
+                output.write('%s\n' % delimiter_local.join(out))
+
+]]>
+        </configfile>
+    </configfiles>
+    <inputs>
+        <param name="original_file" type="data" format="tabular"
+               label="File in which you want to replace some values"
+               help="The entries of a specific column are replaced by the information given by the next input file." />
+        <param name="replace_information" type="data" format="tabular"
+               label="Replace information file"
+               help="This file contains in the first column the entries that should be replaced by the values of the second column." />
+        <param name="column_replace" type="data_column" data_ref="original_file" multiple="false"
+               label="Which column should be replaced?" />
+        <param name="skip_lines" type='integer' value='0' label="Skip this many starting lines" />
+        <param name="delimiter" type="select" label="Delimited by">
+            <option value="" selected="True">Tab</option>
+            <option value=" ">Whitespace</option>
+            <option value=".">Dot</option>
+            <option value=",">Comma</option>
+            <option value="-">Dash</option>
+            <option value="_">Underscore</option>
+            <option value="|">Pipe</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data  name="outfile_replace" format="txt" from_work_dir="output_file"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="replace_information" value="GRCh38_ensembl2UCSC.txt" ftype="tabular" />
+            <param name="original_file" value="original_file" ftype="tabular" />
+            <param name="column_replace" value="1"/>
+            <param name="skip_lines" value="1"/>
+            <param name="delimiter" value="" />
+            <output name="outfile_replace" file="result_file"/>
+        </test>
+        <test>
+            <param name="replace_information" value="GRCh38_ensembl2UCSC.txt" ftype="tabular" />
+            <param name="original_file" value="empty_mapping" ftype="tabular" />
+            <param name="column_replace" value="1"/>
+            <param name="skip_lines" value="1"/>
+            <param name="delimiter" value="" />
+            <output name="outfile_replace" file="result_file_empty_mapping"/>
+        </test>
+    </tests>
+    <help>
+        <![CDATA[
+**What it does**
+
+This tool replaces the entries of a defined column with entries given by a replacement file. 
+For example the replacement file holds the information of the naming scheme of ensembl annotated chromosomes in the frist column and in the second the UCSC annotation. 
+A file which is having information about chromosomes in ensembl notation in column x can now be converted to a file which holds the same information but in UCSC annotation.
+
+A useful repository for ensembl and UCSC chromosomes mapping is: https://github.com/dpryan79/ChromosomeMappings
+        ]]>
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/GRCh38_ensembl2UCSC.txt	Fri Feb 24 10:14:15 2017 -0500
@@ -0,0 +1,525 @@
+1	chr1
+10	chr10
+11	chr11
+12	chr12
+13	chr13
+14	chr14
+15	chr15
+16	chr16
+17	chr17
+18	chr18
+19	chr19
+2	chr2
+20	chr20
+21	chr21
+22	chr22
+3	chr3
+4	chr4
+5	chr5
+6	chr6
+7	chr7
+8	chr8
+9	chr9
+CHR_HG107_PATCH	
+CHR_HG126_PATCH	
+CHR_HG1311_PATCH	
+CHR_HG1342_HG2282_PATCH	
+CHR_HG1362_PATCH	
+CHR_HG142_HG150_NOVEL_TEST	chr11_JH159136v1_alt
+CHR_HG151_NOVEL_TEST	chr11_JH159137v1_alt
+CHR_HG1651_PATCH	
+CHR_HG1832_PATCH	
+CHR_HG2021_PATCH	
+CHR_HG2022_PATCH	
+CHR_HG2023_PATCH	
+CHR_HG2030_PATCH	
+CHR_HG2058_PATCH	
+CHR_HG2062_PATCH	
+CHR_HG2063_PATCH	
+CHR_HG2066_PATCH	
+CHR_HG2072_PATCH	
+CHR_HG2095_PATCH	
+CHR_HG2104_PATCH	
+CHR_HG2116_PATCH	
+CHR_HG2128_PATCH	
+CHR_HG2139_PATCH	
+CHR_HG2191_PATCH	
+CHR_HG2213_PATCH	
+CHR_HG2216_PATCH	
+CHR_HG2217_PATCH	
+CHR_HG2232_PATCH	
+CHR_HG2233_PATCH	
+CHR_HG2235_PATCH	
+CHR_HG2237_PATCH	
+CHR_HG2239_PATCH	
+CHR_HG2241_PATCH	
+CHR_HG2242_HG2243_PATCH	
+CHR_HG2244_HG2245_PATCH	
+CHR_HG2247_PATCH	
+CHR_HG2249_PATCH	
+CHR_HG2288_HG2289_PATCH	
+CHR_HG2290_PATCH	
+CHR_HG2291_PATCH	
+CHR_HG2334_PATCH	
+CHR_HG23_PATCH	
+CHR_HG26_PATCH	
+CHR_HG986_PATCH	
+CHR_HSCHR10_1_CTG1	chr10_GL383545v1_alt
+CHR_HSCHR10_1_CTG2	chr10_GL383546v1_alt
+CHR_HSCHR10_1_CTG3	chr10_KI270824v1_alt
+CHR_HSCHR10_1_CTG4	chr10_KI270825v1_alt
+CHR_HSCHR10_1_CTG6	
+CHR_HSCHR11_1_CTG1_1	chr11_GL383547v1_alt
+CHR_HSCHR11_1_CTG1_2	
+CHR_HSCHR11_1_CTG2	chr11_KI270826v1_alt
+CHR_HSCHR11_1_CTG3	chr11_KI270827v1_alt
+CHR_HSCHR11_1_CTG5	chr11_KI270829v1_alt
+CHR_HSCHR11_1_CTG6	chr11_KI270830v1_alt
+CHR_HSCHR11_1_CTG7	chr11_KI270831v1_alt
+CHR_HSCHR11_1_CTG8	chr11_KI270832v1_alt
+CHR_HSCHR11_2_CTG1	chr11_KI270902v1_alt
+CHR_HSCHR11_2_CTG1_1	chr11_KI270903v1_alt
+CHR_HSCHR11_3_CTG1	chr11_KI270927v1_alt
+CHR_HSCHR12_1_CTG1	chr12_GL877875v1_alt
+CHR_HSCHR12_1_CTG2	chr12_GL383549v1_alt
+CHR_HSCHR12_1_CTG2_1	chr12_GL383550v2_alt
+CHR_HSCHR12_2_CTG1	
+CHR_HSCHR12_2_CTG2	chr12_GL877876v1_alt
+CHR_HSCHR12_2_CTG2_1	chr12_GL383552v1_alt
+CHR_HSCHR12_3_CTG2	chr12_KI270904v1_alt
+CHR_HSCHR12_3_CTG2_1	chr12_GL383553v2_alt
+CHR_HSCHR12_4_CTG2	chr12_KI270835v1_alt
+CHR_HSCHR12_4_CTG2_1	chr12_GL383551v1_alt
+CHR_HSCHR12_5_CTG2	chr12_KI270837v1_alt
+CHR_HSCHR12_5_CTG2_1	chr12_KI270833v1_alt
+CHR_HSCHR12_6_CTG2_1	chr12_KI270834v1_alt
+CHR_HSCHR12_7_CTG2_1	chr12_KI270836v1_alt
+CHR_HSCHR13_1_CTG1	chr13_KI270838v1_alt
+CHR_HSCHR13_1_CTG2	chr13_KI270839v1_alt
+CHR_HSCHR13_1_CTG3	chr13_KI270840v1_alt
+CHR_HSCHR13_1_CTG4	chr13_KI270841v1_alt
+CHR_HSCHR13_1_CTG5	chr13_KI270842v1_alt
+CHR_HSCHR13_1_CTG6	chr13_KI270843v1_alt
+CHR_HSCHR13_1_CTG7	
+CHR_HSCHR13_1_CTG8	
+CHR_HSCHR14_1_CTG1	chr14_KI270844v1_alt
+CHR_HSCHR14_2_CTG1	chr14_KI270845v1_alt
+CHR_HSCHR14_3_CTG1	chr14_KI270846v1_alt
+CHR_HSCHR14_7_CTG1	chr14_KI270847v1_alt
+CHR_HSCHR15_1_CTG1	chr15_KI270852v1_alt
+CHR_HSCHR15_1_CTG3	chr15_KI270848v1_alt
+CHR_HSCHR15_1_CTG8	chr15_GL383554v1_alt
+CHR_HSCHR15_2_CTG3	chr15_KI270906v1_alt
+CHR_HSCHR15_2_CTG8	chr15_GL383555v2_alt
+CHR_HSCHR15_3_CTG3	chr15_KI270851v1_alt
+CHR_HSCHR15_3_CTG8	chr15_KI270849v1_alt
+CHR_HSCHR15_4_CTG8	chr15_KI270905v1_alt
+CHR_HSCHR15_5_CTG8	chr15_KI270850v1_alt
+CHR_HSCHR15_6_CTG8	
+CHR_HSCHR16_1_CTG1	chr16_KI270853v1_alt
+CHR_HSCHR16_1_CTG3_1	chr16_GL383556v1_alt
+CHR_HSCHR16_2_CTG3_1	chr16_GL383557v1_alt
+CHR_HSCHR16_3_CTG1	chr16_KI270855v1_alt
+CHR_HSCHR16_3_CTG3_1	
+CHR_HSCHR16_4_CTG1	chr16_KI270856v1_alt
+CHR_HSCHR16_4_CTG3_1	
+CHR_HSCHR16_5_CTG1	
+CHR_HSCHR16_CTG2	chr16_KI270854v1_alt
+CHR_HSCHR17_10_CTG4	chr17_KI270909v1_alt
+CHR_HSCHR17_1_CTG1	chr17_GL383563v3_alt
+CHR_HSCHR17_1_CTG2	chr17_KI270861v1_alt
+CHR_HSCHR17_1_CTG4	chr17_GL383564v2_alt
+CHR_HSCHR17_1_CTG5	chr17_GL000258v2_alt
+CHR_HSCHR17_1_CTG9	chr17_KI270860v1_alt
+CHR_HSCHR17_2_CTG1	chr17_KI270907v1_alt
+CHR_HSCHR17_2_CTG2	chr17_KI270862v1_alt
+CHR_HSCHR17_2_CTG4	chr17_GL383565v1_alt
+CHR_HSCHR17_2_CTG5	chr17_KI270908v1_alt
+CHR_HSCHR17_3_CTG2	chr17_KI270910v1_alt
+CHR_HSCHR17_3_CTG4	chr17_GL383566v1_alt
+CHR_HSCHR17_4_CTG4	chr17_JH159146v1_alt
+CHR_HSCHR17_5_CTG4	chr17_JH159147v1_alt
+CHR_HSCHR17_6_CTG4	chr17_JH159148v1_alt
+CHR_HSCHR17_7_CTG4	chr17_KI270857v1_alt
+CHR_HSCHR17_8_CTG4	chr17_KI270858v1_alt
+CHR_HSCHR17_9_CTG4	chr17_KI270859v1_alt
+CHR_HSCHR18_1_CTG1_1	chr18_GL383567v1_alt
+CHR_HSCHR18_1_CTG2	chr18_GL383568v1_alt
+CHR_HSCHR18_1_CTG2_1	chr18_GL383569v1_alt
+CHR_HSCHR18_2_CTG1_1	chr18_GL383570v1_alt
+CHR_HSCHR18_2_CTG2	chr18_GL383571v1_alt
+CHR_HSCHR18_2_CTG2_1	chr18_GL383572v1_alt
+CHR_HSCHR18_3_CTG2_1	chr18_KI270863v1_alt
+CHR_HSCHR18_4_CTG1_1	chr18_KI270864v1_alt
+CHR_HSCHR18_5_CTG1_1	
+CHR_HSCHR18_ALT21_CTG2_1	chr18_KI270912v1_alt
+CHR_HSCHR18_ALT2_CTG2_1	chr18_KI270911v1_alt
+CHR_HSCHR19_1_CTG2	chr19_GL383573v1_alt
+CHR_HSCHR19_1_CTG3_1	chr19_GL383574v1_alt
+CHR_HSCHR19_2_CTG2	chr19_GL383575v2_alt
+CHR_HSCHR19_2_CTG3_1	chr19_KI270866v1_alt
+CHR_HSCHR19_3_CTG2	chr19_GL383576v1_alt
+CHR_HSCHR19_3_CTG3_1	chr19_KI270867v1_alt
+CHR_HSCHR19_4_CTG2	chr19_KI270865v1_alt
+CHR_HSCHR19_4_CTG3_1	chr19_KI270938v1_alt
+CHR_HSCHR19_5_CTG2	chr19_KI270868v1_alt
+CHR_HSCHR19KIR_ABC08_A1_HAP_CTG3_1	chr19_KI270917v1_alt
+CHR_HSCHR19KIR_ABC08_AB_HAP_C_P_CTG3_1	chr19_KI270918v1_alt
+CHR_HSCHR19KIR_ABC08_AB_HAP_T_P_CTG3_1	chr19_KI270919v1_alt
+CHR_HSCHR19KIR_FH05_A_HAP_CTG3_1	chr19_KI270920v1_alt
+CHR_HSCHR19KIR_FH05_B_HAP_CTG3_1	chr19_KI270921v1_alt
+CHR_HSCHR19KIR_FH06_A_HAP_CTG3_1	chr19_KI270922v1_alt
+CHR_HSCHR19KIR_FH06_BA1_HAP_CTG3_1	chr19_KI270923v1_alt
+CHR_HSCHR19KIR_FH08_A_HAP_CTG3_1	chr19_KI270929v1_alt
+CHR_HSCHR19KIR_FH08_BAX_HAP_CTG3_1	chr19_KI270930v1_alt
+CHR_HSCHR19KIR_FH13_A_HAP_CTG3_1	chr19_KI270931v1_alt
+CHR_HSCHR19KIR_FH13_BA2_HAP_CTG3_1	chr19_KI270932v1_alt
+CHR_HSCHR19KIR_FH15_A_HAP_CTG3_1	chr19_KI270933v1_alt
+CHR_HSCHR19KIR_FH15_B_HAP_CTG3_1	chr19_KI270882v1_alt
+CHR_HSCHR19KIR_G085_A_HAP_CTG3_1	chr19_KI270883v1_alt
+CHR_HSCHR19KIR_G085_BA1_HAP_CTG3_1	chr19_KI270884v1_alt
+CHR_HSCHR19KIR_G248_A_HAP_CTG3_1	chr19_KI270885v1_alt
+CHR_HSCHR19KIR_G248_BA2_HAP_CTG3_1	chr19_KI270886v1_alt
+CHR_HSCHR19KIR_GRC212_AB_HAP_CTG3_1	chr19_KI270887v1_alt
+CHR_HSCHR19KIR_GRC212_BA1_HAP_CTG3_1	chr19_KI270888v1_alt
+CHR_HSCHR19KIR_LUCE_A_HAP_CTG3_1	chr19_KI270889v1_alt
+CHR_HSCHR19KIR_LUCE_BDEL_HAP_CTG3_1	chr19_KI270890v1_alt
+CHR_HSCHR19KIR_RP5_B_HAP_CTG3_1	chr19_GL000209v2_alt
+CHR_HSCHR19KIR_RSH_A_HAP_CTG3_1	chr19_KI270891v1_alt
+CHR_HSCHR19KIR_RSH_BA2_HAP_CTG3_1	chr19_KI270914v1_alt
+CHR_HSCHR19KIR_T7526_A_HAP_CTG3_1	chr19_KI270915v1_alt
+CHR_HSCHR19KIR_T7526_BDEL_HAP_CTG3_1	chr19_KI270916v1_alt
+CHR_HSCHR19LRC_COX1_CTG3_1	chr19_GL949746v1_alt
+CHR_HSCHR19LRC_COX2_CTG3_1	chr19_GL949747v2_alt
+CHR_HSCHR19LRC_LRC_I_CTG3_1	chr19_GL949748v2_alt
+CHR_HSCHR19LRC_LRC_J_CTG3_1	chr19_GL949749v2_alt
+CHR_HSCHR19LRC_LRC_S_CTG3_1	chr19_GL949750v2_alt
+CHR_HSCHR19LRC_LRC_T_CTG3_1	chr19_GL949751v2_alt
+CHR_HSCHR19LRC_PGF1_CTG3_1	chr19_GL949752v1_alt
+CHR_HSCHR19LRC_PGF2_CTG3_1	chr19_GL949753v2_alt
+CHR_HSCHR1_1_CTG11	chr1_KI270760v1_alt
+CHR_HSCHR1_1_CTG3	chr1_KI270762v1_alt
+CHR_HSCHR1_1_CTG31	chr1_GL383518v1_alt
+CHR_HSCHR1_1_CTG32_1	chr1_KI270759v1_alt
+CHR_HSCHR1_2_CTG3	chr1_KI270766v1_alt
+CHR_HSCHR1_2_CTG31	chr1_GL383519v1_alt
+CHR_HSCHR1_2_CTG32_1	chr1_KI270761v1_alt
+CHR_HSCHR1_3_CTG3	
+CHR_HSCHR1_3_CTG31	chr1_GL383520v2_alt
+CHR_HSCHR1_3_CTG32_1	chr1_KI270763v1_alt
+CHR_HSCHR1_4_CTG3	
+CHR_HSCHR1_4_CTG31	chr1_KI270765v1_alt
+CHR_HSCHR1_4_CTG32_1	chr1_KI270764v1_alt
+CHR_HSCHR1_5_CTG3	
+CHR_HSCHR1_5_CTG32_1	
+CHR_HSCHR1_ALT2_1_CTG32_1	chr1_KI270892v1_alt
+CHR_HSCHR20_1_CTG1	chr20_GL383577v2_alt
+CHR_HSCHR20_1_CTG2	chr20_KI270869v1_alt
+CHR_HSCHR20_1_CTG3	chr20_KI270870v1_alt
+CHR_HSCHR20_1_CTG4	chr20_KI270871v1_alt
+CHR_HSCHR21_1_CTG1_1	chr21_GL383578v2_alt
+CHR_HSCHR21_2_CTG1_1	chr21_GL383579v2_alt
+CHR_HSCHR21_3_CTG1_1	chr21_GL383580v2_alt
+CHR_HSCHR21_4_CTG1_1	chr21_GL383581v2_alt
+CHR_HSCHR21_5_CTG2	chr21_KI270872v1_alt
+CHR_HSCHR21_6_CTG1_1	chr21_KI270873v1_alt
+CHR_HSCHR21_8_CTG1_1	chr21_KI270874v1_alt
+CHR_HSCHR22_1_CTG1	chr22_GL383582v2_alt
+CHR_HSCHR22_1_CTG2	chr22_GL383583v2_alt
+CHR_HSCHR22_1_CTG3	chr22_KI270875v1_alt
+CHR_HSCHR22_1_CTG4	chr22_KI270876v1_alt
+CHR_HSCHR22_1_CTG5	chr22_KI270877v1_alt
+CHR_HSCHR22_1_CTG6	chr22_KI270878v1_alt
+CHR_HSCHR22_1_CTG7	chr22_KI270879v1_alt
+CHR_HSCHR22_2_CTG1	chr22_KB663609v1_alt
+CHR_HSCHR22_3_CTG1	chr22_KI270928v1_alt
+CHR_HSCHR22_4_CTG1	
+CHR_HSCHR22_5_CTG1	
+CHR_HSCHR22_6_CTG1	
+CHR_HSCHR22_7_CTG1	
+CHR_HSCHR22_8_CTG1	
+CHR_HSCHR2_1_CTG1	chr2_KI270769v1_alt
+CHR_HSCHR2_1_CTG15	chr2_KI270767v1_alt
+CHR_HSCHR2_1_CTG5	chr2_GL383521v1_alt
+CHR_HSCHR2_1_CTG7	chr2_KI270772v1_alt
+CHR_HSCHR2_1_CTG7_2	chr2_GL383522v1_alt
+CHR_HSCHR2_2_CTG1	chr2_KI270770v1_alt
+CHR_HSCHR2_2_CTG15	chr2_KI270893v1_alt
+CHR_HSCHR2_2_CTG7	chr2_KI270894v1_alt
+CHR_HSCHR2_2_CTG7_2	chr2_GL582966v2_alt
+CHR_HSCHR2_3_CTG1	chr2_KI270773v1_alt
+CHR_HSCHR2_3_CTG15	chr2_KI270776v1_alt
+CHR_HSCHR2_3_CTG7_2	chr2_KI270768v1_alt
+CHR_HSCHR2_4_CTG1	chr2_KI270774v1_alt
+CHR_HSCHR2_4_CTG7_2	chr2_KI270771v1_alt
+CHR_HSCHR2_5_CTG7_2	chr2_KI270775v1_alt
+CHR_HSCHR2_6_CTG7_2	
+CHR_HSCHR3_1_CTG1	chr3_JH636055v2_alt
+CHR_HSCHR3_1_CTG2_1	chr3_GL383526v1_alt
+CHR_HSCHR3_1_CTG3	chr3_KI270779v1_alt
+CHR_HSCHR3_2_CTG2_1	chr3_KI270777v1_alt
+CHR_HSCHR3_2_CTG3	chr3_KI270782v1_alt
+CHR_HSCHR3_3_CTG1	chr3_KI270783v1_alt
+CHR_HSCHR3_3_CTG2_1	chr3_KI270778v1_alt
+CHR_HSCHR3_3_CTG3	chr3_KI270895v1_alt
+CHR_HSCHR3_4_CTG2_1	chr3_KI270780v1_alt
+CHR_HSCHR3_4_CTG3	chr3_KI270924v1_alt
+CHR_HSCHR3_5_CTG2_1	chr3_KI270781v1_alt
+CHR_HSCHR3_5_CTG3	chr3_KI270934v1_alt
+CHR_HSCHR3_6_CTG3	chr3_KI270935v1_alt
+CHR_HSCHR3_7_CTG3	chr3_KI270936v1_alt
+CHR_HSCHR3_8_CTG3	chr3_KI270937v1_alt
+CHR_HSCHR3_9_CTG3	chr3_KI270784v1_alt
+CHR_HSCHR4_11_CTG12	
+CHR_HSCHR4_1_CTG12	chr4_GL383527v1_alt
+CHR_HSCHR4_1_CTG4	chr4_KI270790v1_alt
+CHR_HSCHR4_1_CTG6	chr4_GL383528v1_alt
+CHR_HSCHR4_1_CTG8_1	chr4_KI270787v1_alt
+CHR_HSCHR4_1_CTG9	chr4_GL000257v2_alt
+CHR_HSCHR4_2_CTG12	chr4_KI270785v1_alt
+CHR_HSCHR4_2_CTG4	
+CHR_HSCHR4_3_CTG12	chr4_KI270786v1_alt
+CHR_HSCHR4_4_CTG12	chr4_KI270788v1_alt
+CHR_HSCHR4_5_CTG12	chr4_KI270789v1_alt
+CHR_HSCHR4_6_CTG12	chr4_KI270896v1_alt
+CHR_HSCHR4_7_CTG12	chr4_KI270925v1_alt
+CHR_HSCHR4_8_CTG12	
+CHR_HSCHR4_9_CTG12	
+CHR_HSCHR5_1_CTG1	chr5_GL383532v1_alt
+CHR_HSCHR5_1_CTG1_1	chr5_KI270897v1_alt
+CHR_HSCHR5_1_CTG5	chr5_GL383531v1_alt
+CHR_HSCHR5_2_CTG1	chr5_GL949742v1_alt
+CHR_HSCHR5_2_CTG1_1	chr5_GL339449v2_alt
+CHR_HSCHR5_2_CTG5	chr5_KI270795v1_alt
+CHR_HSCHR5_3_CTG1	chr5_KI270791v1_alt
+CHR_HSCHR5_3_CTG1_1	chr5_GL383530v1_alt
+CHR_HSCHR5_3_CTG5	chr5_KI270898v1_alt
+CHR_HSCHR5_4_CTG1	chr5_KI270792v1_alt
+CHR_HSCHR5_4_CTG1_1	chr5_KI270796v1_alt
+CHR_HSCHR5_5_CTG1	chr5_KI270793v1_alt
+CHR_HSCHR5_6_CTG1	chr5_KI270794v1_alt
+CHR_HSCHR5_7_CTG1	
+CHR_HSCHR6_1_CTG10	
+CHR_HSCHR6_1_CTG2	chr6_GL383533v1_alt
+CHR_HSCHR6_1_CTG3	chr6_KB021644v2_alt
+CHR_HSCHR6_1_CTG4	chr6_KI270797v1_alt
+CHR_HSCHR6_1_CTG5	chr6_KI270798v1_alt
+CHR_HSCHR6_1_CTG6	chr6_KI270799v1_alt
+CHR_HSCHR6_1_CTG7	chr6_KI270800v1_alt
+CHR_HSCHR6_1_CTG8	chr6_KI270801v1_alt
+CHR_HSCHR6_1_CTG9	chr6_KI270802v1_alt
+CHR_HSCHR6_8_CTG1	chr6_KI270758v1_alt
+CHR_HSCHR6_MHC_APD_CTG1	chr6_GL000250v2_alt
+CHR_HSCHR6_MHC_COX_CTG1	chr6_GL000251v2_alt
+CHR_HSCHR6_MHC_DBB_CTG1	chr6_GL000252v2_alt
+CHR_HSCHR6_MHC_MANN_CTG1	chr6_GL000253v2_alt
+CHR_HSCHR6_MHC_MCF_CTG1	chr6_GL000254v2_alt
+CHR_HSCHR6_MHC_QBL_CTG1	chr6_GL000255v2_alt
+CHR_HSCHR6_MHC_SSTO_CTG1	chr6_GL000256v2_alt
+CHR_HSCHR7_1_CTG1	chr7_KI270804v1_alt
+CHR_HSCHR7_1_CTG4_4	chr7_KI270806v1_alt
+CHR_HSCHR7_1_CTG6	chr7_GL383534v2_alt
+CHR_HSCHR7_1_CTG7	chr7_KI270805v1_alt
+CHR_HSCHR7_2_CTG1	chr7_KI270899v1_alt
+CHR_HSCHR7_2_CTG4_4	chr7_KI270809v1_alt
+CHR_HSCHR7_2_CTG6	chr7_KI270803v1_alt
+CHR_HSCHR7_2_CTG7	chr7_KI270807v1_alt
+CHR_HSCHR7_3_CTG6	chr7_KI270808v1_alt
+CHR_HSCHR8_1_CTG1	chr8_KI270811v1_alt
+CHR_HSCHR8_1_CTG6	chr8_KI270814v1_alt
+CHR_HSCHR8_1_CTG7	chr8_KI270810v1_alt
+CHR_HSCHR8_2_CTG1	chr8_KI270812v1_alt
+CHR_HSCHR8_2_CTG7	chr8_KI270815v1_alt
+CHR_HSCHR8_3_CTG1	chr8_KI270813v1_alt
+CHR_HSCHR8_3_CTG7	chr8_KI270816v1_alt
+CHR_HSCHR8_4_CTG1	chr8_KI270818v1_alt
+CHR_HSCHR8_4_CTG7	chr8_KI270817v1_alt
+CHR_HSCHR8_5_CTG1	chr8_KI270900v1_alt
+CHR_HSCHR8_5_CTG7	chr8_KI270819v1_alt
+CHR_HSCHR8_6_CTG1	chr8_KI270901v1_alt
+CHR_HSCHR8_6_CTG7	chr8_KI270820v1_alt
+CHR_HSCHR8_7_CTG1	chr8_KI270926v1_alt
+CHR_HSCHR8_8_CTG1	chr8_KI270821v1_alt
+CHR_HSCHR8_9_CTG1	chr8_KI270822v1_alt
+CHR_HSCHR9_1_CTG1	chr9_GL383539v1_alt
+CHR_HSCHR9_1_CTG2	chr9_GL383540v1_alt
+CHR_HSCHR9_1_CTG3	chr9_GL383541v1_alt
+CHR_HSCHR9_1_CTG4	chr9_GL383542v1_alt
+CHR_HSCHR9_1_CTG5	chr9_KI270823v1_alt
+CHR_HSCHR9_1_CTG6	
+CHR_HSCHR9_1_CTG7	
+CHR_HSCHRX_1_CTG3	chrX_KI270880v1_alt
+CHR_HSCHRX_2_CTG12	chrX_KI270881v1_alt
+CHR_HSCHRX_2_CTG3	chrX_KI270913v1_alt
+GL000008.2	chr4_GL000008v2_random
+GL000009.2	chr14_GL000009v2_random
+GL000194.1	chr14_GL000194v1_random
+GL000195.1	chrUn_GL000195v1
+GL000205.2	chr17_GL000205v2_random
+GL000208.1	chr5_GL000208v1_random
+GL000213.1	chrUn_GL000213v1
+GL000214.1	chrUn_GL000214v1
+GL000216.2	chrUn_GL000216v2
+GL000218.1	chrUn_GL000218v1
+GL000219.1	chrUn_GL000219v1
+GL000220.1	chrUn_GL000220v1
+GL000221.1	chr3_GL000221v1_random
+GL000224.1	chrUn_GL000224v1
+GL000225.1	chr14_GL000225v1_random
+GL000226.1	chrUn_GL000226v1
+KI270302.1	chrUn_KI270302v1
+KI270303.1	chrUn_KI270303v1
+KI270304.1	chrUn_KI270304v1
+KI270305.1	chrUn_KI270305v1
+KI270310.1	chrUn_KI270310v1
+KI270311.1	chrUn_KI270311v1
+KI270312.1	chrUn_KI270312v1
+KI270315.1	chrUn_KI270315v1
+KI270316.1	chrUn_KI270316v1
+KI270317.1	chrUn_KI270317v1
+KI270320.1	chrUn_KI270320v1
+KI270322.1	chrUn_KI270322v1
+KI270329.1	chrUn_KI270329v1
+KI270330.1	chrUn_KI270330v1
+KI270333.1	chrUn_KI270333v1
+KI270334.1	chrUn_KI270334v1
+KI270335.1	chrUn_KI270335v1
+KI270336.1	chrUn_KI270336v1
+KI270337.1	chrUn_KI270337v1
+KI270338.1	chrUn_KI270338v1
+KI270340.1	chrUn_KI270340v1
+KI270362.1	chrUn_KI270362v1
+KI270363.1	chrUn_KI270363v1
+KI270364.1	chrUn_KI270364v1
+KI270366.1	chrUn_KI270366v1
+KI270371.1	chrUn_KI270371v1
+KI270372.1	chrUn_KI270372v1
+KI270373.1	chrUn_KI270373v1
+KI270374.1	chrUn_KI270374v1
+KI270375.1	chrUn_KI270375v1
+KI270376.1	chrUn_KI270376v1
+KI270378.1	chrUn_KI270378v1
+KI270379.1	chrUn_KI270379v1
+KI270381.1	chrUn_KI270381v1
+KI270382.1	chrUn_KI270382v1
+KI270383.1	chrUn_KI270383v1
+KI270384.1	chrUn_KI270384v1
+KI270385.1	chrUn_KI270385v1
+KI270386.1	chrUn_KI270386v1
+KI270387.1	chrUn_KI270387v1
+KI270388.1	chrUn_KI270388v1
+KI270389.1	chrUn_KI270389v1
+KI270390.1	chrUn_KI270390v1
+KI270391.1	chrUn_KI270391v1
+KI270392.1	chrUn_KI270392v1
+KI270393.1	chrUn_KI270393v1
+KI270394.1	chrUn_KI270394v1
+KI270395.1	chrUn_KI270395v1
+KI270396.1	chrUn_KI270396v1
+KI270411.1	chrUn_KI270411v1
+KI270412.1	chrUn_KI270412v1
+KI270414.1	chrUn_KI270414v1
+KI270417.1	chrUn_KI270417v1
+KI270418.1	chrUn_KI270418v1
+KI270419.1	chrUn_KI270419v1
+KI270420.1	chrUn_KI270420v1
+KI270422.1	chrUn_KI270422v1
+KI270423.1	chrUn_KI270423v1
+KI270424.1	chrUn_KI270424v1
+KI270425.1	chrUn_KI270425v1
+KI270429.1	chrUn_KI270429v1
+KI270435.1	chrUn_KI270435v1
+KI270438.1	chrUn_KI270438v1
+KI270442.1	chrUn_KI270442v1
+KI270448.1	chrUn_KI270448v1
+KI270465.1	chrUn_KI270465v1
+KI270466.1	chrUn_KI270466v1
+KI270467.1	chrUn_KI270467v1
+KI270468.1	chrUn_KI270468v1
+KI270507.1	chrUn_KI270507v1
+KI270508.1	chrUn_KI270508v1
+KI270509.1	chrUn_KI270509v1
+KI270510.1	chrUn_KI270510v1
+KI270511.1	chrUn_KI270511v1
+KI270512.1	chrUn_KI270512v1
+KI270515.1	chrUn_KI270515v1
+KI270516.1	chrUn_KI270516v1
+KI270517.1	chrUn_KI270517v1
+KI270518.1	chrUn_KI270518v1
+KI270519.1	chrUn_KI270519v1
+KI270521.1	chrUn_KI270521v1
+KI270522.1	chrUn_KI270522v1
+KI270528.1	chrUn_KI270528v1
+KI270529.1	chrUn_KI270529v1
+KI270530.1	chrUn_KI270530v1
+KI270538.1	chrUn_KI270538v1
+KI270539.1	chrUn_KI270539v1
+KI270544.1	chrUn_KI270544v1
+KI270548.1	chrUn_KI270548v1
+KI270579.1	chrUn_KI270579v1
+KI270580.1	chrUn_KI270580v1
+KI270581.1	chrUn_KI270581v1
+KI270582.1	chrUn_KI270582v1
+KI270583.1	chrUn_KI270583v1
+KI270584.1	chrUn_KI270584v1
+KI270587.1	chrUn_KI270587v1
+KI270588.1	chrUn_KI270588v1
+KI270589.1	chrUn_KI270589v1
+KI270590.1	chrUn_KI270590v1
+KI270591.1	chrUn_KI270591v1
+KI270593.1	chrUn_KI270593v1
+KI270706.1	chr1_KI270706v1_random
+KI270707.1	chr1_KI270707v1_random
+KI270708.1	chr1_KI270708v1_random
+KI270709.1	chr1_KI270709v1_random
+KI270710.1	chr1_KI270710v1_random
+KI270711.1	chr1_KI270711v1_random
+KI270712.1	chr1_KI270712v1_random
+KI270713.1	chr1_KI270713v1_random
+KI270714.1	chr1_KI270714v1_random
+KI270715.1	chr2_KI270715v1_random
+KI270716.1	chr2_KI270716v1_random
+KI270717.1	chr9_KI270717v1_random
+KI270718.1	chr9_KI270718v1_random
+KI270719.1	chr9_KI270719v1_random
+KI270720.1	chr9_KI270720v1_random
+KI270721.1	chr11_KI270721v1_random
+KI270722.1	chr14_KI270722v1_random
+KI270723.1	chr14_KI270723v1_random
+KI270724.1	chr14_KI270724v1_random
+KI270725.1	chr14_KI270725v1_random
+KI270726.1	chr14_KI270726v1_random
+KI270727.1	chr15_KI270727v1_random
+KI270728.1	chr16_KI270728v1_random
+KI270729.1	chr17_KI270729v1_random
+KI270730.1	chr17_KI270730v1_random
+KI270731.1	chr22_KI270731v1_random
+KI270732.1	chr22_KI270732v1_random
+KI270733.1	chr22_KI270733v1_random
+KI270734.1	chr22_KI270734v1_random
+KI270735.1	chr22_KI270735v1_random
+KI270736.1	chr22_KI270736v1_random
+KI270737.1	chr22_KI270737v1_random
+KI270738.1	chr22_KI270738v1_random
+KI270739.1	chr22_KI270739v1_random
+KI270740.1	chrY_KI270740v1_random
+KI270741.1	chrUn_KI270741v1
+KI270742.1	chrUn_KI270742v1
+KI270743.1	chrUn_KI270743v1
+KI270744.1	chrUn_KI270744v1
+KI270745.1	chrUn_KI270745v1
+KI270746.1	chrUn_KI270746v1
+KI270747.1	chrUn_KI270747v1
+KI270748.1	chrUn_KI270748v1
+KI270749.1	chrUn_KI270749v1
+KI270750.1	chrUn_KI270750v1
+KI270751.1	chrUn_KI270751v1
+KI270752.1	chrUn_KI270752v1
+KI270753.1	chrUn_KI270753v1
+KI270754.1	chrUn_KI270754v1
+KI270755.1	chrUn_KI270755v1
+KI270756.1	chrUn_KI270756v1
+KI270757.1	chrUn_KI270757v1
+MT	chrM
+X	chrX
+Y	chrY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/empty_mapping	Fri Feb 24 10:14:15 2017 -0500
@@ -0,0 +1,27 @@
+track type="bedGraph" description="BT089 CpG merged methylation fractions"
+1	92832422	92832424	0.000000
+1	244369376	244369378	0.728477
+10	113126863	113126865	0.009709
+11	78895197	78895199	0.904412
+12	74427787	74427789	1.000000
+CHR_HSCHR12_2_CTG1    11351	11353	0.071429
+13	87191374	87191376	0.976190
+15	18999871	18999873	1.000000
+16	12923268	12923270	0.900000
+17	14341606	14341608	0.666667
+18	13183090	13183092	0.825000
+19	29900920	29900922	1.000000
+2	59783044	59783046	0.964286
+2	205330110	205330112	0.916667
+20	62500278	62500280	0.000000
+3	8821953	8821955	1.000000
+3	150336614	150336616	0.891304
+4	93832475	93832477	0.315789
+5	64863618	64863620	0.936937
+6	15110182	15110184	1.000000
+6	159932526	159932528	0.000000
+7	101038815	101038817	0.980132
+8	56525279	56525281	0.687500
+9	77037217	77037219	0.916667
+X	40465092	40465094	0.419355
+CHR_HG2063_PATCH    11351	11353	0.071429
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/original_file	Fri Feb 24 10:14:15 2017 -0500
@@ -0,0 +1,51 @@
+track type="bedGraph" description="BT089 CpG merged methylation fractions"
+1       10468   10470   0.209302
+1       10470   10472   0.611111
+1       10483   10485   0.428571
+1       10488   10490   0.846154
+1       10492   10494   0.666667
+1       10496   10498   0.916667
+1       10524   10526   0.916667
+1       10541   10543   0.818182
+1       10562   10564   0.615385
+1       10570   10572   0.916667
+1       10576   10578   0.615385
+1       10578   10580   0.538462
+1       10588   10590   0.909091
+1       10608   10610   0.700000
+1       10616   10618   0.875000
+1       10619   10621   0.714286
+1       10630   10632   0.428571
+1       10632   10634   0.444444
+1       10635   10637   0.400000
+1       10637   10639   0.400000
+1       10640   10642   0.900000
+1       10643   10645   0.600000
+1       10649   10651   0.727273
+1       10659   10661   0.857143
+1       10661   10663   0.428571
+1       10664   10666   0.846154
+1       10666   10668   0.750000
+1       10669   10671   0.916667
+1       10672   10674   0.916667
+1       10678   10680   1.000000
+1       10688   10690   0.900000
+1       10690   10692   0.545455
+1       10693   10695   1.000000
+1       10695   10697   0.909091
+1       10698   10700   0.916667
+1       10701   10703   1.000000
+1       10707   10709   1.000000
+1       10717   10719   0.866667
+1       10719   10721   0.692308
+1       10722   10724   1.000000
+1       10724   10726   0.933333
+1       10727   10729   0.933333
+1       10730   10732   1.000000
+1       10736   10738   0.933333
+1       10746   10748   0.857143
+1       10748   10750   0.500000
+1       10751   10753   0.928571
+1       10753   10755   0.857143
+1       10756   10758   1.000000
+1       10759   10761   0.857143
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/result_file	Fri Feb 24 10:14:15 2017 -0500
@@ -0,0 +1,51 @@
+track type="bedGraph" description="BT089 CpG merged methylation fractions"
+chr1	10468	10470	0.209302
+chr1	10470	10472	0.611111
+chr1	10483	10485	0.428571
+chr1	10488	10490	0.846154
+chr1	10492	10494	0.666667
+chr1	10496	10498	0.916667
+chr1	10524	10526	0.916667
+chr1	10541	10543	0.818182
+chr1	10562	10564	0.615385
+chr1	10570	10572	0.916667
+chr1	10576	10578	0.615385
+chr1	10578	10580	0.538462
+chr1	10588	10590	0.909091
+chr1	10608	10610	0.700000
+chr1	10616	10618	0.875000
+chr1	10619	10621	0.714286
+chr1	10630	10632	0.428571
+chr1	10632	10634	0.444444
+chr1	10635	10637	0.400000
+chr1	10637	10639	0.400000
+chr1	10640	10642	0.900000
+chr1	10643	10645	0.600000
+chr1	10649	10651	0.727273
+chr1	10659	10661	0.857143
+chr1	10661	10663	0.428571
+chr1	10664	10666	0.846154
+chr1	10666	10668	0.750000
+chr1	10669	10671	0.916667
+chr1	10672	10674	0.916667
+chr1	10678	10680	1.000000
+chr1	10688	10690	0.900000
+chr1	10690	10692	0.545455
+chr1	10693	10695	1.000000
+chr1	10695	10697	0.909091
+chr1	10698	10700	0.916667
+chr1	10701	10703	1.000000
+chr1	10707	10709	1.000000
+chr1	10717	10719	0.866667
+chr1	10719	10721	0.692308
+chr1	10722	10724	1.000000
+chr1	10724	10726	0.933333
+chr1	10727	10729	0.933333
+chr1	10730	10732	1.000000
+chr1	10736	10738	0.933333
+chr1	10746	10748	0.857143
+chr1	10748	10750	0.500000
+chr1	10751	10753	0.928571
+chr1	10753	10755	0.857143
+chr1	10756	10758	1.000000
+chr1	10759	10761	0.857143
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/result_file_empty_mapping	Fri Feb 24 10:14:15 2017 -0500
@@ -0,0 +1,25 @@
+track type="bedGraph" description="BT089 CpG merged methylation fractions"
+chr1	92832422	92832424	0.000000
+chr1	244369376	244369378	0.728477
+chr10	113126863	113126865	0.009709
+chr11	78895197	78895199	0.904412
+chr12	74427787	74427789	1.000000
+chr13	87191374	87191376	0.976190
+chr15	18999871	18999873	1.000000
+chr16	12923268	12923270	0.900000
+chr17	14341606	14341608	0.666667
+chr18	13183090	13183092	0.825000
+chr19	29900920	29900922	1.000000
+chr2	59783044	59783046	0.964286
+chr2	205330110	205330112	0.916667
+chr20	62500278	62500280	0.000000
+chr3	8821953	8821955	1.000000
+chr3	150336614	150336616	0.891304
+chr4	93832475	93832477	0.315789
+chr5	64863618	64863620	0.936937
+chr6	15110182	15110184	1.000000
+chr6	159932526	159932528	0.000000
+chr7	101038815	101038817	0.980132
+chr8	56525279	56525281	0.687500
+chr9	77037217	77037219	0.916667
+chrX	40465092	40465094	0.419355