Mercurial > repos > peterjc > seq_primer_clip
changeset 23:0c79302b2c15 draft default tip
planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/tools/seq_primer_clip commit d67596914a7bbe183851437eaafe8c7305877e5a-dirty
author | peterjc |
---|---|
date | Fri, 22 Feb 2019 10:25:29 -0500 |
parents | 3c37b27efa2f |
children | |
files | tools/seq_primer_clip/seq_primer_clip.py tools/seq_primer_clip/tool_dependencies.xml |
diffstat | 2 files changed, 47 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- 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:
--- 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 @@ -<?xml version="1.0"?> +<?xml version="1.0" ?> <tool_dependency> <package name="biopython" version="1.67"> - <repository changeset_revision="fc45a61abc2f" name="package_biopython_1_67" owner="biopython" toolshed="https://testtoolshed.g2.bx.psu.edu" /> + <repository changeset_revision="fc45a61abc2f" name="package_biopython_1_67" owner="biopython" toolshed="https://testtoolshed.g2.bx.psu.edu"/> </package> <package name="galaxy_sequence_utils" version="1.0.1"> - <repository changeset_revision="c38bd3fe9da6" name="package_galaxy_sequence_utils_1_0_1" owner="iuc" toolshed="https://testtoolshed.g2.bx.psu.edu" /> + <repository changeset_revision="c38bd3fe9da6" name="package_galaxy_sequence_utils_1_0_1" owner="iuc" toolshed="https://testtoolshed.g2.bx.psu.edu"/> </package> -</tool_dependency> +</tool_dependency> \ No newline at end of file