changeset 1:7c913274e22a draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/yac_clipper commit 7edb6f8c9744ec9bccee42aecf80207f0984330c
author artbio
date Wed, 26 Jul 2017 17:12:08 -0400
parents ad6b978daa2e
children da08e89abd18
files yac.py yac.xml
diffstat 2 files changed, 25 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/yac.py	Wed Jul 26 13:35:39 2017 -0400
+++ b/yac.py	Wed Jul 26 17:12:08 2017 -0400
@@ -2,11 +2,8 @@
 # yac = yet another clipper
 # v 1.2.1 - 23-08-2014 - Support FastQ output
 # v 1.1.0 - 23-08-2014 - argparse implementation
-# Usage yac.py  $input $output $adapter_to_clip $min $max $Nmode
 # Christophe Antoniewski <drosofff@gmail.com>
 
-import sys
-import string
 import argparse
 from itertools import islice
 
@@ -16,17 +13,23 @@
     the_parser.add_argument(
         '--input', action="store", nargs='+', help="input fastq files")
     the_parser.add_argument(
-        '--output', action="store", type=str, help="output, clipped fasta file")
+        '--output', action="store", type=str,
+        help="output, clipped fasta file")
     the_parser.add_argument(
-        '--output_format', action="store", type=str, help="output format, fasta or fastq")
+        '--output_format', action="store", type=str,
+        help="output format, fasta or fastq")
     the_parser.add_argument(
-        '--adapter_to_clip', action="store", type=str, help="adapter sequence to clip")
+        '--adapter_to_clip', action="store", type=str,
+        help="adapter sequence to clip")
     the_parser.add_argument(
-        '--min', action="store", type=int, help="minimal size of clipped sequence to keep")
+        '--min', action="store", type=int,
+        help="minimal size of clipped sequence to keep")
     the_parser.add_argument(
-        '--max', action="store", type=int, help="maximal size of clipped sequence to keep")
+        '--max', action="store", type=int,
+        help="maximal size of clipped sequence to keep")
     the_parser.add_argument('--Nmode', action="store", type=str, choices=[
-                            "accept", "reject"], help="accept or reject sequences with N for clipping")
+                            "accept", "reject"],
+                            help="accept or reject Ns in clipped sequences")
     args = the_parser.parse_args()
     args.adapter_to_clip = args.adapter_to_clip.upper()
     return args
@@ -34,7 +37,8 @@
 
 class Clip:
 
-    def __init__(self, inputfile, outputfile, output_format, adapter, minsize, maxsize, Nmode):
+    def __init__(self, inputfile, outputfile, output_format,
+                 adapter, minsize, maxsize, Nmode):
         self.inputfile = inputfile
         self.outputfile = outputfile
         self.output_format = output_format
@@ -44,9 +48,12 @@
         self.Nmode = Nmode
 
         def motives(sequence):
-            '''return a list of motives for perfect (6nt) or imperfect (7nt with one mismatch) search on import string module'''
+            '''
+            return a list of motives for perfect (6nt) or
+            imperfect (7nt with one mismatch) search on import string module
+            '''
             sequencevariants = [
-                sequence[0:6]]  # initializes the list with the 6mer perfect match
+                sequence[0:6]]  # initializes list with 6mer perfect match
             dicsubst = {"A": "TGCN", "T": "AGCN", "G": "TACN", "C": "GATN"}
             for pos in enumerate(sequence[:6]):
                 for subst in dicsubst[pos[1]]:
@@ -100,6 +107,7 @@
     instanceClip = Clip(*argv)
     instanceClip.handle_io()
 
+
 if __name__ == "__main__":
     args = Parser()
     id = 0
--- a/yac.xml	Wed Jul 26 13:35:39 2017 -0400
+++ b/yac.xml	Wed Jul 26 17:12:08 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="yac" name="Clip adapter" version="2.0.0">
+<tool id="yac" name="Clip adapter" version="2.0.1">
     <description />
     <command interpreter="python">yac.py --input $input
                                        --output $output
@@ -14,7 +14,7 @@
         <param label="max size" name="max" size="4" type="integer" value="36" />
         <param label="Select output format" name="out_format" type="select">
             <option selected="true" value="fasta">Fasta format</option>
-            <option value="fastq">Fastq format</option>
+            <option value="fastq">Fastq (Sanger) format</option>
         </param>
         <param label="Accept reads containing N?" name="Nmode" type="select">
             <option selected="True" value="accept">accept</option>
@@ -39,9 +39,9 @@
         </conditional>
     </inputs>
     <outputs>
-        <data format="fasta" metadata_source="input" name="output" label="Clipping of ${input.name}">
+        <data format_source="input" metadata_source="input" name="output" label="Clipping of ${input.name}">
           <change_format>
-              <when input="out_format" value="fastq" format="fastq" />
+              <when input="out_format" value="fasta" format="fasta" />
           </change_format>
         </data>
     </outputs>
@@ -92,4 +92,5 @@
 A fastq or fasta file containing clipped sequences satisfying the selected criteria.
 
   </help>
+  <citations />
 </tool>