Mercurial > repos > peterjc > seq_primer_clip
changeset 6:b9dc7c967ee6 draft default tip
v0.0.16 Python 3 compatible print function
author | peterjc |
---|---|
date | Tue, 16 May 2017 09:36:50 -0400 |
parents | 530c8d6fedd8 |
children | |
files | tools/seq_primer_clip/README.rst tools/seq_primer_clip/seq_primer_clip.py tools/seq_primer_clip/seq_primer_clip.xml |
diffstat | 3 files changed, 17 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/seq_primer_clip/README.rst Wed May 10 13:09:52 2017 -0400 +++ b/tools/seq_primer_clip/README.rst Tue May 16 09:36:50 2017 -0400 @@ -73,6 +73,7 @@ - Explicit dependency on ``galaxy_sequence_utils``. v0.0.15 - Use ``<command detect_errors="aggressive">`` (internal change only). - Single quote command line arguments (internal change only) +v0.0.16 - Python 3 compatible print function. ======= ======================================================================
--- a/tools/seq_primer_clip/seq_primer_clip.py Wed May 10 13:09:52 2017 -0400 +++ b/tools/seq_primer_clip/seq_primer_clip.py Tue May 16 09:36:50 2017 -0400 @@ -33,13 +33,13 @@ import re import sys +if "-v" in sys.argv or "--version" in sys.argv: + print("v0.0.16") + sys.exit(0) + from galaxy_utils.sequence.fasta import fastaReader, fastaWriter from galaxy_utils.sequence.fastq import fastqReader, fastqWriter -if "-v" in sys.argv or "--version" in sys.argv: - print "v0.0.12" - sys.exit(0) - try: from Bio.Seq import reverse_complement from Bio.SeqIO.SffIO import SffIterator, SffWriter @@ -130,10 +130,12 @@ def make_reg_ex(seq): + """Make regular expression for ambiguous DNA.""" return "".join(ambiguous_dna_re[letter] for letter in seq) def make_reg_ex_mm(seq, mm): + """Make regular expression for mis-matches.""" if mm > 2: raise NotImplementedError("At most 2 mismatches allowed!") seq = seq.upper() @@ -166,7 +168,10 @@ def load_primers_as_re(primer_fasta, mm, rc=False): - # Read primer file and record all specified sequences + """Load primers as regular expressions. + + Read primer file and record all specified sequences. + """ primers = set() in_handle = open(primer_fasta, "rU") reader = fastaReader(in_handle) @@ -189,7 +194,7 @@ # Read primer file and record all specified sequences count, primer = load_primers_as_re(primer_fasta, mm, rc) -print "%i primer sequences" % count +print("%i primer sequences" % count) short_neg = 0 short_clipped = 0 @@ -350,8 +355,8 @@ in_handle.close() out_handle.close() -print "Kept %i clipped reads," % clipped -print "discarded %i short." % short_clipped +print("Kept %i clipped reads," % clipped) +print("discarded %i short." % short_clipped) if keep_negatives: - print "Kept %i non-matching reads," % negs - print "discarded %i short." % short_neg + print("Kept %i non-matching reads," % negs) + print("discarded %i short." % short_neg)
--- a/tools/seq_primer_clip/seq_primer_clip.xml Wed May 10 13:09:52 2017 -0400 +++ b/tools/seq_primer_clip/seq_primer_clip.xml Tue May 16 09:36:50 2017 -0400 @@ -1,4 +1,4 @@ -<tool id="seq_primer_clip" name="Primer clip sequences" version="0.0.15"> +<tool id="seq_primer_clip" name="Primer clip sequences" version="0.0.16"> <description>Trim off 5' or 3' primers</description> <requirements> <requirement type="package" version="1.0.1">galaxy_sequence_utils</requirement>