changeset 10:ee29337f905c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit 8ce6fd9aee543d9e62db33a9c95f79d8dc4e6dea
author iuc
date Wed, 13 Jul 2022 15:20:33 +0000
parents 8d36959b000d
children 7f1cfa4c0e32
files ivar_removereads.xml prepare_amplicon_info.py sanitize_bed.py write_amplicon_info_file.py
diffstat 4 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ivar_removereads.xml	Fri Aug 20 20:34:11 2021 +0000
+++ b/ivar_removereads.xml	Wed Jul 13 15:20:33 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="ivar_removereads" name="ivar removereads" version="@VERSION@+galaxy2">
+<tool id="ivar_removereads" name="ivar removereads" version="@VERSION@+galaxy3" profile="21.01">
     <description>Remove reads from trimmed BAM file</description>
     <macros>
         <import>macros.xml</import>
@@ -22,7 +22,7 @@
         ln -s '$input_bam' sorted.bam &&
         ln -s '${input_bam.metadata.bam_index}' sorted.bam.bai &&
 
-        ivar removereads 
+        ivar removereads
         -i sorted.bam
         -b binding_sites.bed
         -p removed_reads.bam
@@ -109,7 +109,7 @@
    Preprocessing of the BAM input with ivar trim is essential for this tool to
    work because only ``ivar trim`` can add required primer information to the
    BAM auxillary data of every read.
-        
+
 ivar documentation can be found at `<https://andersen-lab.github.io/ivar/html/manualpage.html>`__.
     ]]></help>
     <expand macro="citations" />
--- a/prepare_amplicon_info.py	Fri Aug 20 20:34:11 2021 +0000
+++ b/prepare_amplicon_info.py	Wed Jul 13 15:20:33 2022 +0000
@@ -11,7 +11,10 @@
 primer_starts = {}
 with open(sys.argv[1]) as i:
     for line in i:
-        f = line.strip().split('\t')
+        line = line.strip()
+        if not line:
+            continue
+        f = line.split('\t')
         try:
             if f[5] == '+':
                 primer_starts[f[3]] = int(f[1])
@@ -32,8 +35,11 @@
 with open(sys.argv[2]) as i:
     ret_lines = []
     for line in i:
+        line = line.strip()
+        if not line:
+            continue
         first = last = None
-        for pname in line.strip().split('\t'):
+        for pname in line.split('\t'):
             try:
                 primer_start = primer_starts[pname]
             except KeyError:
--- a/sanitize_bed.py	Fri Aug 20 20:34:11 2021 +0000
+++ b/sanitize_bed.py	Wed Jul 13 15:20:33 2022 +0000
@@ -9,10 +9,11 @@
 sanitized_data = []
 try:
     for record in bed_data:
-        fields = record.split('\t')
-        sanitized_data.append(
-            '\t'.join(fields[:4] + ['60'] + fields[5:])
-        )
+        if record.strip():
+            fields = record.split('\t')
+            sanitized_data.append(
+                '\t'.join(fields[:4] + ['60'] + fields[5:])
+            )
 except IndexError:
     pass  # leave column number issue to getmasked
 else:
--- a/write_amplicon_info_file.py	Fri Aug 20 20:34:11 2021 +0000
+++ b/write_amplicon_info_file.py	Wed Jul 13 15:20:33 2022 +0000
@@ -10,7 +10,10 @@
 def write_amplicon_info_file(bed_file, amplicon_info_file):
     amplicon_sets = {}
     for line in bed_file:
-        fields = line.strip().split('\t')
+        line = line.strip()
+        if not line:
+            continue
+        fields = line.split('\t')
         start = int(fields[1])
         name = fields[3]
         re_match = AMPLICON_PAT.match(name)