# HG changeset patch # User peterjc # Date 1550849129 18000 # Node ID 0c79302b2c156f01852d95c7520aba226f15cb31 # Parent 3c37b27efa2fe39b98192d853fb551780f881bcc planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/tools/seq_primer_clip commit d67596914a7bbe183851437eaafe8c7305877e5a-dirty diff -r 3c37b27efa2f -r 0c79302b2c15 tools/seq_primer_clip/seq_primer_clip.py --- a/tools/seq_primer_clip/seq_primer_clip.py Fri Nov 09 11:10:32 2018 -0500 +++ b/tools/seq_primer_clip/seq_primer_clip.py Fri Feb 22 10:25:29 2019 -0500 @@ -53,9 +53,20 @@ # Parse Command Line try: - in_file, seq_format, primer_fasta, primer_type, mm, min_len, keep_negatives, out_file = sys.argv[1:] + ( + in_file, + seq_format, + primer_fasta, + primer_type, + mm, + min_len, + keep_negatives, + out_file, + ) = sys.argv[1:] except ValueError: - sys.exit("Expected 8 arguments, got %i:\n%s" % (len(sys.argv) - 1, " ".join(sys.argv))) + sys.exit( + "Expected 8 arguments, got %i:\n%s" % (len(sys.argv) - 1, " ".join(sys.argv)) + ) if in_file == primer_fasta: sys.exit("Same file given as both primer sequences and sequences to clip!") @@ -67,9 +78,13 @@ try: mm = int(mm) except ValueError: - sys.exit("Expected non-negative integer number of mismatches (e.g. 0 or 1), not %r" % mm) + sys.exit( + "Expected non-negative integer number of mismatches (e.g. 0 or 1), not %r" % mm + ) if mm < 0: - sys.exit("Expected non-negtive integer number of mismatches (e.g. 0 or 1), not %r" % mm) + sys.exit( + "Expected non-negtive integer number of mismatches (e.g. 0 or 1), not %r" % mm + ) if mm not in [0, 1, 2]: raise NotImplementedError @@ -86,7 +101,10 @@ elif keep_negatives.lower() in ["false", "no", "off"]: keep_negatives = False else: - sys.exit("Expected boolean for keep_negatives (e.g. true or false), not %r" % keep_negatives) + sys.exit( + "Expected boolean for keep_negatives (e.g. true or false), not %r" + % keep_negatives + ) if primer_type.lower() == "forward": @@ -150,20 +168,30 @@ for i, letter in enumerate(seq): # We'll use a set to remove any duplicate patterns # if letter not in "NX": - pattern = seq[:i] + "N" + seq[i + 1:] - assert len(pattern) == len(seq), ("Len %s is %i, len %s is %i" - % (pattern, len(pattern), seq, len(seq))) + pattern = seq[:i] + "N" + seq[i + 1 :] + assert len(pattern) == len(seq), "Len %s is %i, len %s is %i" % ( + pattern, + len(pattern), + seq, + len(seq), + ) yield make_reg_ex(pattern) if mm >= 2: for i, letter in enumerate(seq): # We'll use a set to remove any duplicate patterns # if letter not in "NX": - for k, letter in enumerate(seq[i + 1:]): + for k, letter in enumerate(seq[i + 1 :]): # We'll use a set to remove any duplicate patterns # if letter not in "NX": - pattern = seq[:i] + "N" + seq[i + 1:i + 1 + k] + "N" + seq[i + k + 2:] - assert len(pattern) == len(seq), ("Len %s is %i, len %s is %i" - % (pattern, len(pattern), seq, len(seq))) + pattern = ( + seq[:i] + "N" + seq[i + 1 : i + 1 + k] + "N" + seq[i + k + 2 :] + ) + assert len(pattern) == len(seq), "Len %s is %i, len %s is %i" % ( + pattern, + len(pattern), + seq, + len(seq), + ) yield make_reg_ex(pattern) @@ -204,6 +232,7 @@ if seq_format.lower() == "sff": # SFF is different because we just change the trim points if forward: + def process(records): global short_clipped, short_neg, clipped, negs for record in records: @@ -226,7 +255,9 @@ yield record else: short_neg += 1 + else: + def process(records): global short_clipped, short_neg, clipped, negs for record in records: diff -r 3c37b27efa2f -r 0c79302b2c15 tools/seq_primer_clip/tool_dependencies.xml --- a/tools/seq_primer_clip/tool_dependencies.xml Fri Nov 09 11:10:32 2018 -0500 +++ b/tools/seq_primer_clip/tool_dependencies.xml Fri Feb 22 10:25:29 2019 -0500 @@ -1,9 +1,9 @@ - + - + - + - + \ No newline at end of file