This is an automated email from the git hooks/post-receive script. sascha-guest pushed a commit to branch master in repository fastaq.
commit 37b9b951358c9bb13e961c6c7c260d564b9158f6 Author: Sascha Steinbiss <[email protected]> Date: Wed Sep 9 18:53:07 2015 +0000 Imported Upstream version 3.7.0 --- README.md | 5 +---- pyfastaq/common.py | 2 +- pyfastaq/runners/to_boulderio.py | 12 ++++++++++++ pyfastaq/tasks.py | 13 +++++++++++++ pyfastaq/tests/data/tasks_test_to_boulderio.in.fa | 5 +++++ pyfastaq/tests/data/tasks_test_to_boulderio.out.boulder | 6 ++++++ pyfastaq/tests/tasks_test.py | 9 +++++++++ scripts/fastaq | 1 + setup.py | 2 +- 9 files changed, 49 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9e939f4..af92b95 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,7 @@ Python3 script to manipulate FASTA and FASTQ (and other format) files, plus API Installation ------------ -Dependencies: - * numpy (install with `apt-get install python3-numpy`) - -Install with pip: +Install with pip3: pip3 install pyfastaq diff --git a/pyfastaq/common.py b/pyfastaq/common.py index f157366..cef5770 100644 --- a/pyfastaq/common.py +++ b/pyfastaq/common.py @@ -1 +1 @@ -version = '3.6.1' +version = '3.7.0' diff --git a/pyfastaq/runners/to_boulderio.py b/pyfastaq/runners/to_boulderio.py new file mode 100644 index 0000000..cdb9f78 --- /dev/null +++ b/pyfastaq/runners/to_boulderio.py @@ -0,0 +1,12 @@ +import argparse +from pyfastaq import tasks + +def run(description): + parser = argparse.ArgumentParser( + description = 'Converts input sequence file into "Boulder-IO" format, which is used by primer3', + usage = 'fastaq to_boulderio <infile> <outfile>') + parser.add_argument('infile', help='Name of input file') + parser.add_argument('outfile', help='Name of output files') + options = parser.parse_args() + tasks.to_boulderio(options.infile, options.outfile) + diff --git a/pyfastaq/tasks.py b/pyfastaq/tasks.py index e77e40e..4199a9e 100644 --- a/pyfastaq/tasks.py +++ b/pyfastaq/tasks.py @@ -821,6 +821,19 @@ def strip_illumina_suffix(infile, outfile): utils.close(f_out) +def to_boulderio(infile, outfile): + '''Converts input sequence file into a "Boulder-IO format", as used by primer3''' + seq_reader = sequences.file_reader(infile) + f_out = utils.open_file_write(outfile) + + for sequence in seq_reader: + print("SEQUENCE_ID=" + sequence.id, file=f_out) + print("SEQUENCE_TEMPLATE=" + sequence.seq, file=f_out) + print("=", file=f_out) + + utils.close(f_out) + + def to_fasta(infile, outfile, line_length=60, strip_after_first_whitespace=False, check_unique=False): seq_reader = sequences.file_reader(infile) f_out = utils.open_file_write(outfile) diff --git a/pyfastaq/tests/data/tasks_test_to_boulderio.in.fa b/pyfastaq/tests/data/tasks_test_to_boulderio.in.fa new file mode 100644 index 0000000..15f4bf0 --- /dev/null +++ b/pyfastaq/tests/data/tasks_test_to_boulderio.in.fa @@ -0,0 +1,5 @@ +>one +ACGTCAGCTCTGATCGACTGATGCACTAATCATATCTCGATCGATCGATCTGACTGACT +CAGACCTCATACTACTTGCTGATAAT +>two +TGCA diff --git a/pyfastaq/tests/data/tasks_test_to_boulderio.out.boulder b/pyfastaq/tests/data/tasks_test_to_boulderio.out.boulder new file mode 100644 index 0000000..e5f404b --- /dev/null +++ b/pyfastaq/tests/data/tasks_test_to_boulderio.out.boulder @@ -0,0 +1,6 @@ +SEQUENCE_ID=one +SEQUENCE_TEMPLATE=ACGTCAGCTCTGATCGACTGATGCACTAATCATATCTCGATCGATCGATCTGACTGACTCAGACCTCATACTACTTGCTGATAAT += +SEQUENCE_ID=two +SEQUENCE_TEMPLATE=TGCA += diff --git a/pyfastaq/tests/tasks_test.py b/pyfastaq/tests/tasks_test.py index 12a9870..db367f2 100644 --- a/pyfastaq/tests/tasks_test.py +++ b/pyfastaq/tests/tasks_test.py @@ -589,6 +589,15 @@ class TestStripIlluminaSuffix(unittest.TestCase): os.unlink(tmpfile) +class TestToBoulderio(unittest.TestCase): + def test_to_boulderio(self): + '''Test task to_boulderio''' + tmpfile = 'tmp.boulder' + tasks.to_boulderio(os.path.join(data_dir, 'tasks_test_to_boulderio.in.fa'), tmpfile) + self.assertTrue(filecmp.cmp(os.path.join(data_dir, 'tasks_test_to_boulderio.out.boulder'), tmpfile, shallow=False)) + os.unlink(tmpfile) + + class TestToFasta(unittest.TestCase): def test_to_fasta(self): '''Test to_fasta''' diff --git a/scripts/fastaq b/scripts/fastaq index 9537f75..3198b2d 100755 --- a/scripts/fastaq +++ b/scripts/fastaq @@ -28,6 +28,7 @@ tasks = { 'split_by_base_count': 'Split multi sequence file into separate files', 'sort_by_size': 'Sorts sequences in length order', 'strip_illumina_suffix': 'Strips /1 or /2 off the end of every read name', + 'to_boulderio': 'Converts to Boulder-IO format, used by primer3', 'to_fasta': 'Converts a variety of input formats to nicely formatted FASTA format', 'to_fake_qual': 'Make fake quality scores file', 'to_mira_xml': 'Create an xml file from a file of reads, for use with Mira assembler', diff --git a/setup.py b/setup.py index 9c355f2..23a26e6 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages setup( name='pyfastaq', - version='3.6.1', + version='3.7.0', description='Script to manipulate FASTA and FASTQ files, plus API for developers', packages = find_packages(), author='Martin Hunt', -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/fastaq.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
