changeset 1:6c0373cc070f draft default tip

planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/replace_chromosome_names/ commit c8418d1d7657dacae7f81fe4aa0aba051873d4ad
author earlhaminst
date Tue, 13 Jun 2017 14:43:07 -0400
parents 97c11d04cd4c
children
files replace_chromosome_names.py replace_chromosome_names.xml test-data/gemini_load_input.vcf
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/replace_chromosome_names.py	Thu May 18 14:17:48 2017 -0400
+++ b/replace_chromosome_names.py	Tue Jun 13 14:43:07 2017 -0400
@@ -32,9 +32,14 @@
             line_cols = line.split('\t')
             for col_to_map in cols_to_map:
                 old_value = line_cols[col_to_map]
-                line_cols[col_to_map] = map_dict.get(old_value, old_value)
-            mapped_line = '\t'.join(line_cols)
-            print(mapped_line, file=args.output)
+                new_value = map_dict.get(old_value, '')
+                if not new_value:
+                    print('%s has no valid mapping, skipping line: %s' % (old_value, line), file=sys.stderr)
+                    break
+                line_cols[col_to_map] = new_value
+            else:
+                mapped_line = '\t'.join(line_cols)
+                print(mapped_line, file=args.output)
 
 
 if __name__ == "__main__":
--- a/replace_chromosome_names.xml	Thu May 18 14:17:48 2017 -0400
+++ b/replace_chromosome_names.xml	Tue Jun 13 14:43:07 2017 -0400
@@ -28,6 +28,9 @@
             <param name="mapping" ftype="tabular" value="GRCh37_ensembl2UCSC.txt" />
             <param name="comment_char" value="#" />
             <output name="output" ftype="vcf" file="replace_chromosome_names_output.vcf" />
+            <assert_stderr>
+                <has_text text="HG1007_PATCH" />
+            </assert_stderr>
         </test>
     </tests>
     <help><![CDATA[
--- a/test-data/gemini_load_input.vcf	Thu May 18 14:17:48 2017 -0400
+++ b/test-data/gemini_load_input.vcf	Tue Jun 13 14:43:07 2017 -0400
@@ -68,3 +68,4 @@
 1	55816	rs187434873	G	A	100.0	PASS	AN=2184;THETA=0.0119;VT=SNP;AC=10;RSQ=0.4578;AA=A;SNPSOURCE=LOWCOV;AVGPOST=0.9844;LDAF=0.0108;ERATE=0.0007;AF=0.0046;AMR_AF=0.01;EUR_AF=0.01;EFF=INTERGENIC(MODIFIER|||||||||)
 1	55850	rs191890754	C	G	100.0	PASS	AVGPOST=0.9921;AA=G;AN=2184;VT=SNP;RSQ=0.4083;THETA=0.0045;LDAF=0.0056;AC=5;SNPSOURCE=LOWCOV;ERATE=0.0006;AF=0.0023;EUR_AF=0.01;EFF=INTERGENIC(MODIFIER|||||||||)
 1	55852	rs184233019	G	C	100.0	PASS	THETA=0.0137;AA=G;AN=2184;RSQ=0.5433;ERATE=0.0009;LDAF=0.0046;VT=SNP;AVGPOST=0.9953;AC=5;SNPSOURCE=LOWCOV;AF=0.0023;AMR_AF=0.01;EUR_AF=0.0013;EFF=INTERGENIC(MODIFIER|||||||||)
+HG1007_PATCH	55852	rs184233019	G	C	100.0	PASS	THETA=0.0137;AA=G;AN=2184;RSQ=0.5433;ERATE=0.0009;LDAF=0.0046;VT=SNP;AVGPOST=0.9953;AC=5;SNPSOURCE=LOWCOV;AF=0.0023;AMR_AF=0.01;EUR_AF=0.0013;EFF=INTERGENIC(MODIFIER|||||||||)