Repository 'sequence_format_converter'
hg clone https://toolshed.g2.bx.psu.edu/repos/artbio/sequence_format_converter

Changeset 1:9ce7ccd468aa (2018-02-16)
Previous changeset 0:a8aacccd79a3 (2017-09-04) Next changeset 2:f1d59113125a (2018-02-20)
Commit message:
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/sequence_format_converter commit dfecfb40f245a3cdb09dd1cfe37be4cb164ad2eb
modified:
sequence_format_converter.py
sequence_format_converter.xml
added:
test-data/input.fastqsanger.gz
b
diff -r a8aacccd79a3 -r 9ce7ccd468aa sequence_format_converter.py
--- a/sequence_format_converter.py Mon Sep 04 07:13:28 2017 -0400
+++ b/sequence_format_converter.py Fri Feb 16 04:55:44 2018 -0500
[
@@ -40,7 +40,7 @@
         try:
             for l in range(4):
                 block.append(input.readline()[:-1])
-        except:
+        except IndexError:
             logging.info("File hasn't at leat four lines !")
             sys.exit("File hasn't at leat four lines !")
         input.close()
@@ -81,7 +81,7 @@
                     if line[0] == '>':
                         int(line.split('_')[-1])
                 return 'fastaw'
-            except:
+            except ValueError:
                 return 'fasta'
         if line1[0] == '@' and line3[0] == '+':
             nucleotides = set([base for base in line2])
@@ -98,7 +98,7 @@
                 sys.exit('No valid format detected')
             try:
                 int(line.split('\t')[-1])
-            except:
+            except ValueError:
                 logging.info("No valid format detected")
                 sys.exit('No valid format detected')
             for nucleotide in line.split('\t')[0]:
@@ -112,22 +112,22 @@
         if format == 'fasta':
             try:
                 self.readfasta(input)
-            except:
+            except Exception:
                 logging.info("an error occured while reading fasta")
         elif format == 'fastaw':
             try:
                 self.readfastaw(input)
-            except:
+            except Exception:
                 logging.info("an error occured while reading fastaw")
         elif format == 'tabular':
             try:
                 self.readtabular(input)
-            except:
+            except Exception:
                 logging.info("an error occured while reading tabular")
         elif format == 'fastq':
             try:
                 self.readfastq(input)
-            except:
+            except Exception:
                 logging.info("an error occured while reading fastq")
         else:
             logging.info("no valid format detected")
b
diff -r a8aacccd79a3 -r 9ce7ccd468aa sequence_format_converter.xml
--- a/sequence_format_converter.xml Mon Sep 04 07:13:28 2017 -0400
+++ b/sequence_format_converter.xml Fri Feb 16 04:55:44 2018 -0500
[
@@ -1,10 +1,19 @@
-<tool id="sequence_format_converter" name="sequence_format_converter" version="2.0.0">
+<tool id="sequence_format_converter" name="sequence_format_converter" version="2.1.0">
   <description></description>
   <command><![CDATA[
+    #if $input.is_of_type('fastq.gz'):
+      gzip -dc $input > '${input}.tmp';
+      python '$__tool_directory__'/sequence_format_converter.py
+      --input '${input}.tmp'
+      --output '$output'
+      --format '$output_format';
+      rm '${input}.tmp';
+    #else:
       python '$__tool_directory__'/sequence_format_converter.py
       --input '$input'
       --output '$output'
       --format '$output_format'
+    #end if
   ]]></command>
 
 <inputs>
@@ -79,6 +88,24 @@
             <param ftype="fasta" name="input" value="input.fastqsanger" />
             <output file="fastqTofastaw.sorted.faw" name="output" sort="True" />
         </test>
+        <test>
+            <!-- convertion fastq.gz to tabular -->
+            <param name="output_format" value="tabular" />
+            <param ftype="fastq.gz" name="input" value="input.fastqsanger.gz" />
+            <output file="fastqTotabular.sorted.tab" name="output" sort="True" />
+        </test>
+         <test>
+            <!-- convertion fastq.gz to fasta -->
+            <param name="output_format" value="fasta" />
+            <param ftype="fastq.gz" name="input" value="input.fastqsanger.gz" />
+            <output file="fastqTofasta.sorted.fa" name="output" sort="True" />
+        </test>
+        <test>
+            <!-- convertion fastq.gz to fastaw -->
+            <param name="output_format" value="fastaw" />
+            <param ftype="fastq.gz" name="input" value="input.fastqsanger.gz" />
+            <output file="fastqTofastaw.sorted.faw" name="output" sort="True" />
+        </test>
    </tests>
 
 
b
diff -r a8aacccd79a3 -r 9ce7ccd468aa test-data/input.fastqsanger.gz
b
Binary file test-data/input.fastqsanger.gz has changed