changeset 7:28c13c42de01 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/medaka commit ed5a3aadbecc0decf9a797447f3ac7700683ea9a"
author iuc
date Mon, 22 Feb 2021 19:59:00 +0000
parents aabb4e1c0b7b
children edf6d4003fad
files convert_VCF_info_fields.py variant.xml
diffstat 2 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/convert_VCF_info_fields.py	Wed Feb 10 08:28:04 2021 +0000
+++ b/convert_VCF_info_fields.py	Mon Feb 22 19:59:00 2021 +0000
@@ -15,7 +15,11 @@
 
 
 def pval_to_phredqual(pval):
-    return round(-10 * log10(pval))
+    try:
+        ret = round(-10 * log10(pval))
+    except ValueError:
+        ret = 2147483647  # transform pval of 0.0 to max signed 32 bit int
+    return ret
 
 
 def parseInfoField(info):
@@ -33,7 +37,7 @@
     to_skip = set(['SC', 'SR'])
     for i, line in enumerate(in_vcf):
         if i == 1:
-            out_vcf.write("##convert_VCF_info_fields=0.1\n")
+            out_vcf.write("##convert_VCF_info_fields=0.2\n")
         if line[0:2] == "##":
             if line[0:11] == "##INFO=<ID=":
                 id_ = line[11:].split(',')[0]
--- a/variant.xml	Wed Feb 10 08:28:04 2021 +0000
+++ b/variant.xml	Mon Feb 22 19:59:00 2021 +0000
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<tool id="medaka_variant" name="medaka variant tool" version="@TOOL_VERSION@+galaxy4" profile="@PROFILE@">
+<tool id="medaka_variant" name="medaka variant tool" version="@TOOL_VERSION@+galaxy5" profile="@PROFILE@">
     <description>Probability decoding</description>
     <macros>
         <import>macros.xml</import>
@@ -9,6 +9,22 @@
     </expand>
 
     <expand macro="version_command"/>
+
+    <configfiles>
+        <configfile name="convert_fasta">
+import sys
+infile = open(sys.argv[1], 'r')
+outfile = open(sys.argv[2], 'w')
+for line in infile:
+    if line[0] == '>':
+        outfile.write(line)
+    else:
+        outfile.write(line.upper())
+infile.close()
+outfile.close()
+        </configfile>
+    </configfiles>
+
     <command detect_errors="exit_code"><![CDATA[
 ## initialize
 @REF_FASTA@
@@ -48,9 +64,11 @@
 #end if
 
 #if $out_annotated:
+    ## medaka annotate errors out if the reference is lower case at a position it's annotating because it checks vs the ref base in the vcf
+    && python '$convert_fasta' reference.fa  upper_reference.fa
     && ln -s '$output_annotated.in_bam' in.bam
     && ln -s '$output_annotated.in_bam.metadata.bam_index' in.bai
-    && medaka tools annotate --pad $output_annotated.pad '$out_result' reference.fa in.bam tmp.vcf
+    && medaka tools annotate --pad $output_annotated.pad '$out_result' upper_reference.fa in.bam tmp.vcf
     && '$__tool_directory__/convert_VCF_info_fields.py' tmp.vcf '$out_annotated'
 #end if
     ]]></command>
@@ -167,8 +185,8 @@
                 <assert_contents>
                     <has_n_lines n="22"/>
                     <has_line line="##fileformat=VCFv4.1" />
-                    <has_line line="##medaka_version=1.0.3" />
                     <has_line_matching expression="##medaka_version=[0-9]+\.[0-9]+\.[0-9]+" />
+                    <has_line_matching expression="##convert_VCF_info_fields=[0-9]+\.[0-9]+" />
                 </assert_contents>
             </output>
             <output name="out_log">