diff yac.py @ 3:6b8adacd4750 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit fa65a844f9041a83767f5305ab360abfdf68f59f
author artbio
date Wed, 26 Jul 2017 19:15:08 -0400
parents da29af78a960
children ffcd42f85b61
line wrap: on
line diff
--- a/yac.py	Tue Jul 25 11:04:28 2017 -0400
+++ b/yac.py	Wed Jul 26 19:15: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