# HG changeset patch # User peterjc # Date 1495027441 14400 # Node ID 481b0a925e66adc1602fe1a20487d304552a2b91 # Parent 48e71dfd51b3c1363901093c72b5730c424b0e0f v0.0.6 Python 3 compatible print function diff -r 48e71dfd51b3 -r 481b0a925e66 tools/seq_filter_by_mapping/README.rst --- a/tools/seq_filter_by_mapping/README.rst Wed May 10 13:16:44 2017 -0400 +++ b/tools/seq_filter_by_mapping/README.rst Wed May 17 09:24:01 2017 -0400 @@ -70,6 +70,7 @@ - Depends on Biopython 1.67 via legacy Tool Shed package or bioconda. - Use ```` (internal change only). - Single quote command line arguments (internal change only). +v0.0.6 - Python 3 compatible print function. ======= ====================================================================== diff -r 48e71dfd51b3 -r 481b0a925e66 tools/seq_filter_by_mapping/seq_filter_by_mapping.py --- a/tools/seq_filter_by_mapping/seq_filter_by_mapping.py Wed May 10 13:16:44 2017 -0400 +++ b/tools/seq_filter_by_mapping/seq_filter_by_mapping.py Wed May 17 09:24:01 2017 -0400 @@ -19,6 +19,8 @@ Use -v or --version to get the version, -h or --help for help. """ +from __future__ import print_function + import os import re import subprocess @@ -62,7 +64,7 @@ options, args = parser.parse_args() if options.version: - print "v0.0.5" + print("v0.0.6") sys.exit(0) in_file = options.input @@ -251,7 +253,7 @@ # Doing the if statement outside the loop for speed # (with the downside of three very similar loops). if pos_file is not None and neg_file is not None: - print "Generating two FASTA files" + print("Generating two FASTA files") with open(pos_file, "w") as pos_handle: with open(neg_file, "w") as neg_handle: for identifier, record in crude_fasta_iterator(in_handle): @@ -262,7 +264,7 @@ neg_handle.write(record) neg_count += 1 elif pos_file is not None: - print "Generating matching FASTA file" + print("Generating matching FASTA file") with open(pos_file, "w") as pos_handle: for identifier, record in crude_fasta_iterator(in_handle): if clean_name(identifier) in wanted: @@ -271,7 +273,7 @@ else: neg_count += 1 else: - print "Generating non-matching FASTA file" + print("Generating non-matching FASTA file") assert neg_file is not None with open(neg_file, "w") as neg_handle: for identifier, record in crude_fasta_iterator(in_handle): @@ -289,10 +291,10 @@ pos_count = neg_count = 0 handle = open(in_file, "r") if pos_file is not None and neg_file is not None: - print "Generating two FASTQ files" + print("Generating two FASTQ files") positive_handle = open(pos_file, "w") negative_handle = open(neg_file, "w") - print in_file + print(in_file) for title, seq, qual in FastqGeneralIterator(handle): # print("%s --> %s" % (title, clean_name(title.split(None, 1)[0]))) if clean_name(title.split(None, 1)[0]) in wanted: @@ -304,7 +306,7 @@ positive_handle.close() negative_handle.close() elif pos_file is not None: - print "Generating matching FASTQ file" + print("Generating matching FASTQ file") positive_handle = open(pos_file, "w") for title, seq, qual in FastqGeneralIterator(handle): if clean_name(title.split(None, 1)[0]) in wanted: @@ -314,7 +316,7 @@ neg_count += 1 positive_handle.close() elif neg_file is not None: - print "Generating non-matching FASTQ file" + print("Generating non-matching FASTQ file") negative_handle = open(neg_file, "w") for title, seq, qual in FastqGeneralIterator(handle): if clean_name(title.split(None, 1)[0]) in wanted: diff -r 48e71dfd51b3 -r 481b0a925e66 tools/seq_filter_by_mapping/seq_filter_by_mapping.xml --- a/tools/seq_filter_by_mapping/seq_filter_by_mapping.xml Wed May 10 13:16:44 2017 -0400 +++ b/tools/seq_filter_by_mapping/seq_filter_by_mapping.xml Wed May 17 09:24:01 2017 -0400 @@ -1,4 +1,4 @@ - + from SAM/BAM file biopython diff -r 48e71dfd51b3 -r 481b0a925e66 tools/seq_filter_by_mapping/tool_dependencies.xml --- a/tools/seq_filter_by_mapping/tool_dependencies.xml Wed May 10 13:16:44 2017 -0400 +++ b/tools/seq_filter_by_mapping/tool_dependencies.xml Wed May 17 09:24:01 2017 -0400 @@ -1,7 +1,7 @@ - +