Mercurial > repos > peterjc > seq_filter_by_mapping
changeset 3:481b0a925e66 draft
v0.0.6 Python 3 compatible print function
author | peterjc |
---|---|
date | Wed, 17 May 2017 09:24:01 -0400 |
parents | 48e71dfd51b3 |
children | f82868a026ea |
files | tools/seq_filter_by_mapping/README.rst tools/seq_filter_by_mapping/seq_filter_by_mapping.py tools/seq_filter_by_mapping/seq_filter_by_mapping.xml tools/seq_filter_by_mapping/tool_dependencies.xml |
diffstat | 4 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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 ``<command detect_errors="aggressive">`` (internal change only). - Single quote command line arguments (internal change only). +v0.0.6 - Python 3 compatible print function. ======= ======================================================================
--- 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:
--- 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 @@ -<tool id="seq_filter_by_mapping" name="Filter sequences by mapping" version="0.0.5"> +<tool id="seq_filter_by_mapping" name="Filter sequences by mapping" version="0.0.6"> <description>from SAM/BAM file</description> <requirements> <requirement type="package" version="1.67">biopython</requirement>
--- 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 @@ <?xml version="1.0"?> <tool_dependency> <package name="biopython" version="1.67"> - <repository changeset_revision="a42f244cce44" name="package_biopython_1_67" owner="biopython" toolshed="https://toolshed.g2.bx.psu.edu" /> + <repository changeset_revision="a12f73c3b116" name="package_biopython_1_67" owner="biopython" toolshed="https://toolshed.g2.bx.psu.edu" /> </package> <package name="samtools" version="0.1.19"> <repository changeset_revision="c9bd782f5342" name="package_samtools_0_1_19" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />