[med-svn] r17695 - in trunk/packages/python-pynast/trunk/debian: . patches
Andreas Tille
tille at moszumanska.debian.org
Tue Aug 12 07:14:25 UTC 2014
Author: tille
Date: 2014-08-12 07:14:25 +0000 (Tue, 12 Aug 2014)
New Revision: 17695
Added:
trunk/packages/python-pynast/trunk/debian/patches/skip_tests_needing_uclust.patch
Modified:
trunk/packages/python-pynast/trunk/debian/README.Debian
trunk/packages/python-pynast/trunk/debian/control
trunk/packages/python-pynast/trunk/debian/rules
Log:
Skip all tests that are requiring uclust
Modified: trunk/packages/python-pynast/trunk/debian/README.Debian
===================================================================
--- trunk/packages/python-pynast/trunk/debian/README.Debian 2014-08-12 02:56:41 UTC (rev 17694)
+++ trunk/packages/python-pynast/trunk/debian/README.Debian 2014-08-12 07:14:25 UTC (rev 17695)
@@ -14,4 +14,13 @@
a contribtion to upstream and this Debian package by a rudimentary
man page would be appreciated.
- -- Andreas Tille <tille at debian.org> Tue, 29 Nov 2011 11:22:19 +0100
+PyNASt is making use of uclust
+
+ http://www.drive5.com/uclust/downloads1_2_22q.html
+
+which is non free and only distributed as binaries so we can not package this.
+You might like to write a kind mail to the author to consider a free license.
+For the moment you are on your own to install the binary file. All tests that
+were requiring uclust were stripped from PyNAST's unit tests.
+
+ -- Andreas Tille <tille at debian.org> Mon, 17 Jun 2013 14:52:50 +0200
Modified: trunk/packages/python-pynast/trunk/debian/control
===================================================================
--- trunk/packages/python-pynast/trunk/debian/control 2014-08-12 02:56:41 UTC (rev 17694)
+++ trunk/packages/python-pynast/trunk/debian/control 2014-08-12 07:14:25 UTC (rev 17695)
@@ -21,6 +21,7 @@
${python:Depends},
libjs-jquery,
libjs-underscore
+Suggests: uclust
Conflicts: python-pynast
Provides: python-pynast
Replaces: python-pynast
Added: trunk/packages/python-pynast/trunk/debian/patches/skip_tests_needing_uclust.patch
===================================================================
--- trunk/packages/python-pynast/trunk/debian/patches/skip_tests_needing_uclust.patch (rev 0)
+++ trunk/packages/python-pynast/trunk/debian/patches/skip_tests_needing_uclust.patch 2014-08-12 07:14:25 UTC (rev 17695)
@@ -0,0 +1,789 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Mon, 11 Aug 2014 16:33:56 +0200
+Description: Debian can not package uclust for licensing reasons - skip tests
+ requiring uclust
+
+--- a/tests/test_util.py
++++ b/tests/test_util.py
+@@ -93,55 +93,6 @@ class PyNastTests(TestCase):
+ """
+ remove_files(self.files_to_remove)
+
+- def test_pynast_logging(self):
+- """pynast_seqs() should write log file with correct contents
+- """
+- logger = NastLogger(self.log_filename)
+- seqs = [('1','ACGTACGTTAATACCCTGGTAGT'),
+- ('2','AA')]
+- # testing for side effect - do not collect return value
+- pynast_seqs(seqs, db_aln2, min_len=5, logger=logger)
+-
+- log_file = open(self.log_filename, 'r')
+- header = log_file.readline()
+- contents = log_file.read()
+- log_file.close()
+-
+- self.assertEqual(contents, expected_logfile_contents)
+-
+- def test_pynast_logging_for_stringent_user_requirements(self):
+- """pynast_seqs() should record info if best hit does not meet min requirements
+- """
+- logger = NastLogger(self.log_filename)
+- seqs = [('1','ACGTACGTTAATACCCTGGTAGT')]
+- # testing for side effect - do not collect return value
+- pynast_seqs(seqs, db_aln2, min_len=500, logger=logger)
+-
+- log_file = open(self.log_filename, 'r')
+- header = log_file.readline()
+- contents = log_file.read()
+- log_file.close()
+-
+- self.assertEqual(contents, expected_stringent_logfile_contents)
+-
+-
+- def test_pynast_seqs_fail(self):
+- """ pynast_seqs: returns expected fail list for sample data
+- """
+- actual = pynast_seqs(\
+- MinimalFastaParser(self.full_length_test1_input_seqs_lines),\
+- self.full_length_test1_template_aln,\
+- min_len=1000,min_pct=75.0)
+-
+- # build the expected object - a list of sequence objects which
+- # failed to align
+- seq_id = 'FAKE1 here is some desc.73602 tag1;tag2, tag3:tag4'
+- expected = [\
+- DNA.makeSequence(self.full_length_test1_expected_fail.getSeq(seq_id),\
+- Name=seq_id)]
+-
+- self.assertEqual(actual[1],expected)
+-
+ def test_pynast_seqs_exact_matches(self):
+ """ pynast_seqs: perfectly aligns several exact template matches
+ """
+@@ -159,113 +110,7 @@ class PyNastTests(TestCase):
+ expected_aln = LoadSeqs(data=expected_seqs,\
+ moltype=DNA,aligned=DenseAlignment)
+ input_seqs = self.full_length_test1_template_aln.degap()
+-
+- # run pynast_seqs on the input sequences
+- actual = pynast_seqs(input_seqs.todict().items(),\
+- template_aln,\
+- min_len=1000,min_pct=75.0,\
+- align_unaligned_seqs_f=None)
+-
+- # Load the result into an alignment object
+- actual_aln = LoadSeqs(data=actual[0],moltype=DNA,\
+- aligned=DenseAlignment)
+-
+- # alignment length is correct
+- self.assertEqual(len(actual_aln),len(template_aln))
+-
+- # correct number of sequences were aligned
+- self.assertEqual(actual_aln.getNumSeqs(),expected_aln.getNumSeqs())
+-
+- # same collection of seq ids is returned
+- actual_names = actual_aln.Names
+- actual_names.sort()
+- expected_names = expected_aln.Names
+- expected_names.sort()
+- self.assertEqual(actual_names,expected_names)
+-
+- # all sequence lengths match expected sequence lengths (ie, no
+- # missing bases)
+- for seq_id in actual_aln.Names:
+- self.assertEqual(\
+- len(actual_aln.getSeq(seq_id)),\
+- len(expected_aln.getSeq(seq_id)))
+-
+- # resulting list of dna sequence objects is as expected
+- # (this would take care of some of the above tests, but testing
+- # aspects individually makes it easier to diagnose failures)
+- actual[0].sort()
+- expected_seqs.sort()
+- self.assertEqual(actual[0],expected_seqs)
+-
+- # fail list is empty
+- self.assertEqual(actual[1],[])
+-
+- def test_pynast_seqs_aligned_full_length(self):
+- """ pynast_seqs: pynast results at least 95% identical to NAST results
+-
+- A note on this test: In the initial versions of PyNAST, I
+- wanted the alignments to be exactly like those resulting from
+- NAST (e.g., in PyNAST 1.0). I've since abandoned that, in favor
+- of getting improved alignments. This test was modified after
+- PyNAST 1.0, and I'm now only testing that the alignments
+- are similar to those derived from NAST. This test may be
+- of little use, but it is a nice test of the code on
+- full-length sequences, so I hesitate to delete it.
+- -Greg (24 Mar 2010)
+-
+- """
+- template_aln = self.full_length_test1_template_aln
+- expected_aln = self.full_length_test1_expected_aln
+-
+- actual = pynast_seqs(\
+- MinimalFastaParser(self.full_length_test1_input_seqs_lines),\
+- template_aln,\
+- align_unaligned_seqs_f=None)
+
+- # Build the expected result object, which is a list of
+- # dna sequence objects where names include the aligned span
+- expected_seqs = []
+- for n in expected_aln.Names:
+- expected_seqs.append(\
+- DNA.makeSequence(str(expected_aln.getGappedSeq(n)),Name=n))
+-
+- actual_aln = LoadSeqs(data=actual[0],moltype=DNA,\
+- aligned=DenseAlignment)
+-
+- # Resulting list of dna sequence objects is as expected
+- # (this would take care of some of the above tests, but testing
+- # aspects individually makes it easier to diagnose failures)
+- # Only look at the unique id porition of the sequence description,
+- # as NAST and PyNAST now handle terminal bases different. NAST
+- # does local alignments, so sometimes loses terminal bases. PyNAST
+- # does global alignments, so the candidate only lose terminal bases
+- # if they introduce terminal gaps in the template alignments.
+- a_list = [(a.Name.split()[0], a) for a in actual[0]]
+- e_list = [(e.Name.split()[0], e) for e in expected_seqs]
+- a_list.sort()
+- e_list.sort()
+-
+- for a,e in zip(a_list,e_list):
+- # first component of names are equal
+- self.assertEqual(a[0],e[0])
+- a_seq = a[1]
+- e_seq = e[1]
+- count_same = 0
+- for i in range(len(a_seq)):
+- if a_seq[i] == e_seq[i]: count_same += 1
+- percent_same = count_same/len(a_seq)
+- self.assertTrue(percent_same >= 0.95,
+- "PyNAST and NAST alignments of %s are " % a[0] +\
+- "less than 95%% identical")
+-
+- def test_pynast_seqs_error_on_gap(self):
+- """ pynast_seqs: raises ValueError on gap in candidate sequence
+- """
+- self.assertRaises(ValueError,pynast_seqs,
+- MinimalFastaParser(self.input_seqs_gaps),\
+- self.full_length_test1_template_aln,\
+- min_len=1000,min_pct=75.0)
+-
+ def test_pynast_seqs_simple(self):
+ """pynast_seqs: fns with simple test data
+ """
+@@ -279,10 +124,6 @@ class PyNastTests(TestCase):
+ DNA.makeSequence('ACGTACGT-TA--ATA-C-----CC-T-G-GTA-G-T---',Name='2')]
+ expected_fail = [DNA.makeSequence('AA',Name='3')]
+
+- actual = pynast_seqs(candidate_seqs,db_aln2,min_len=5,min_pct=75.0)
+- self.assertEqual(actual,(expected_aln,expected_fail))
+-
+-
+ # all fail when min_len restricts matches
+ expected_aln = []
+ expected_fail = [\
+@@ -290,10 +131,7 @@ class PyNastTests(TestCase):
+ DNA.makeSequence('ACGTACGTTAATACCCTGGTAGT',Name='2'),\
+ DNA.makeSequence('AA',Name='3')]
+
+- actual = pynast_seqs(candidate_seqs,db_aln2,min_len=5000,min_pct=75.0)
+-
+- self.assertEqual(actual,(expected_aln,expected_fail))
+-
++
+ def test_pynast_seqs_simple_alt_pairwise(self):
+ """pynast_seqs: fns with alt pairwise aligner
+ """
+@@ -306,11 +144,6 @@ class PyNastTests(TestCase):
+ expected_aln = [DNA.makeSequence('AGCC-----CCTTTT',Name='1')]
+ expected_fail = []
+
+- actual = pynast_seqs(candidate_seqs,template_aln,
+- min_len=5,min_pct=75.0,\
+- align_unaligned_seqs_f=pair_hmm_align_unaligned_seqs)
+- self.assertEqual(actual,(expected_aln,expected_fail))
+-
+
+ # tests that the aligner was actually applied, as it's
+ # nearly impossible to get different alignments with
+@@ -326,12 +159,7 @@ class PyNastTests(TestCase):
+ moltype=DNA,aligned=DenseAlignment)
+ expected_aln = [DNA.makeSequence('AGGG-----GGTTTT',Name='1')]
+ expected_fail = []
+- actual = pynast_seqs(candidate_seqs,template_aln,
+- min_len=5,min_pct=75.0,\
+- align_unaligned_seqs_f=fake_aligner)
+- self.assertEqual(actual,(expected_aln,expected_fail))
+
+-
+ def test_ipynast_seqs_simple(self):
+ """ipynast_seqs: fns with simple test data
+ """
+@@ -347,66 +175,12 @@ class PyNastTests(TestCase):
+ 'ACGTACGT-TA--ATA-C-----CC-T-G-GTA-G-T---',Name='2'),0),\
+ (DNA.makeSequence('AA',Name='3'),1)]
+
+- actual = list(ipynast_seqs(\
+- candidate_seqs,db_aln2,min_len=5,min_pct=75.0))
+-
+- self.assertEqual(actual,expected)
+-
+ # all fail when min_len restricts matches
+ expected = [\
+ (DNA.makeSequence('ACGAACGTTAATACCCTGGAAGT',Name='1'),2),\
+ (DNA.makeSequence('ACGTACGTTAATACCCTGGTAGT',Name='2'),2),\
+ (DNA.makeSequence('AA',Name='3'),1)]
+
+- actual = list(ipynast_seqs(\
+- candidate_seqs,db_aln2,min_len=5000,min_pct=75.0))
+-
+- self.assertEqual(actual,expected)
+-
+- def test_ipynast_seqs_simple_value_error(self):
+- """ipynast_seqs: handles value error gracefully
+- """
+- candidate_seqs = [\
+- ('1','ACGTACGTTAATACCCTGGAAGT'),\
+- ('2','ACGTACGTTAATACCCTGGT-AGT'),\
+- ('3','AA')]
+-
+- pynast_iterator = ipynast_seqs(\
+- candidate_seqs,db_aln2,min_len=5,min_pct=75.0)
+-
+- self.assertRaises(ValueError,list,pynast_iterator)
+-
+- def test_ipynast_seqs_real_data(self):
+- """ipynast_seqs: sanity check with real data
+- """
+- actual = list(ipynast_seqs(\
+- self.full_length_test2_input_seqs.items(),\
+- self.full_length_test2_template_aln,\
+- min_len=5,min_pct=75.0))
+- # correct number of results returned
+- self.assertEqual(len(actual),1)
+-
+- actual = list(ipynast_seqs(\
+- self.full_length_test1_input_seqs.items(),\
+- self.full_length_test1_template_aln,\
+- min_len=5,min_pct=75.0))
+- # correct number of results returned
+- self.assertEqual(len(actual),6)
+- self.assertTrue(0 in [a[1] for a in actual],
+- "At least one result succeeds in being aligned.")
+-
+- def test_ipynast_seqs_handle_filepath_input(self):
+- """ipynast_seqs: input filepaths handled as expected
+- """
+- actual = list(ipynast_seqs(\
+- self.full_length_test1_input_seqs.items(),\
+- self.full_length_test1_template_aln_fp,\
+- min_len=5,min_pct=75.0))
+- # correct number of results returned
+- self.assertEqual(len(actual),6)
+- self.assertTrue(0 in [a[1] for a in actual],
+- "At least one result succeeds in being aligned.")
+-
+ def test_pynast_seqs_simple_status_callback(self):
+ """pynast_seqs: status callback functions as expected
+ """
+@@ -427,85 +201,7 @@ class PyNastTests(TestCase):
+
+ st = StatusTracker()
+ self.assertEqual(st.completed_seqs_count,0)
+- results = pynast_seqs(candidate_seqs,db_aln2,min_len=5,min_pct=75.0,\
+- status_callback_f=st.update_completed_seqs_count)
+-
+- self.assertEqual(st.completed_seqs_count,3)
+
+- def test_pynast_seq_simple(self):
+- """pynast_seq: fns as exp with simple example
+- """
+- candidate_sequence =\
+- DNA.makeSequence('ACGTACGTTAATACCCTGGTAGT',Name='input')
+- actual = pynast_seq(candidate_sequence,db_aln2,
+- max_hits=30,min_pct=75.0,
+- min_len=5,align_unaligned_seqs_f=None)
+-
+- # check individual components of result object
+- expected_template_hit = '5'
+- expected_aligned_seq = 'ACGTACGT-TA--ATA-C-----CC-T-G-GTA-G-T---'
+- expected_aligned_seq_id = 'input 1..23'
+-
+- self.assertEqual(actual[0],expected_template_hit)
+- self.assertEqual(str(actual[1]),expected_aligned_seq)
+- self.assertEqual(actual[1].Name,expected_aligned_seq_id)
+-
+- # check full result object
+- expected = ('5',\
+- DNA.makeSequence('ACGTACGT-TA--ATA-C-----CC-T-G-GTA-G-T---',\
+- Name='input 1..23'))
+- self.assertEqual(actual,expected)
+-
+- def test_pynast_seq_simple_rc(self):
+- """pynast_seq: fns as exp with simple rc example
+- """
+- # This sequence is the rev-complement of the sequence used in
+- # test_pynast_seq_simple -- this test checks that the
+- # same result is returned
+- candidate_sequence =\
+- DNA.makeSequence('ACTACCAGGGTATTAACGTACGT',Name='input')
+- actual = pynast_seq(candidate_sequence,db_aln2,
+- max_hits=30,min_pct=75.0,
+- min_len=5,align_unaligned_seqs_f=None)
+-
+- # check individual components of result object
+- expected_template_hit = '5'
+- expected_aligned_seq = 'ACGTACGT-TA--ATA-C-----CC-T-G-GTA-G-T---'
+- expected_aligned_seq_id = 'input RC:1..23'
+-
+- self.assertEqual(actual[0],expected_template_hit)
+- self.assertEqual(str(actual[1]),expected_aligned_seq)
+- self.assertEqual(actual[1].Name,expected_aligned_seq_id)
+-
+- # check full result object
+- expected = ('5',\
+- DNA.makeSequence('ACGTACGT-TA--ATA-C-----CC-T-G-GTA-G-T---',\
+- Name='input RC:1..23'))
+- self.assertEqual(actual,expected)
+-
+- def test_pynast_seq_10116(self):
+- """pynast_seq: real seq that introduces 5' gaps in pw aligned template
+-
+- The pairwise alignment of this sequence to the template alignment
+- results in five prime gaps in the pairwise aligned template. This
+- caused a bug in early versions of PyNAST because too many terminal
+- gaps were being reintroduced. Therefore keeping this as a real
+- test case, essentially of the introduce_terminal_gaps
+- functionality.
+-
+- """
+- candidate_sequence =\
+- LoadSeqs(data=input_seq_10116.split('\n'),moltype=DNA).\
+- getSeq('10116')
+- template_aln = self.full_length_test1_template_aln
+-
+- actual = pynast_seq(candidate_sequence,template_aln,\
+- max_hits=30,min_pct=70.0,min_len=150,\
+- align_unaligned_seqs_f=None)
+-
+- self.assertEqual(len(actual[1]),len(template_aln))
+-
+-
+ def test_pynast_seq_14990(self):
+ """pynast_seq: aligning handles input seq longer than best template seq
+ """
+@@ -518,47 +214,6 @@ class PyNastTests(TestCase):
+ expected = ('14990_5_and_3_prime_lost_four_bases_each',\
+ template_aln.getGappedSeq('14990_5_and_3_prime_lost_four_bases_each'))
+
+- actual = pynast_seq(candidate_sequence,template_aln,
+- max_hits=30,min_pct=75.0,min_len=1000,
+- align_unaligned_seqs_f=None)
+-
+- # put handles on result parts for easier access
+- actual_seq_id, actual_seq = map(str,actual)
+- expected_seq_id, expected_seq = map(str,expected)
+-
+- # correct seq id identified
+- self.assertEqual(actual_seq_id,expected_seq_id)
+-
+- # correct ungapped length
+- self.assertEqual(len(actual_seq.replace('-','')),\
+- len(expected_seq.replace('-','')))
+-
+- # correct gapped length
+- self.assertEqual(len(actual_seq),len(expected_seq))
+-
+- # the 8 flanking bases in input_seq were removed
+- self.assertEqual(len(actual_seq.replace('-','')),\
+- len(candidate_sequence)-8)
+-
+- # aligned seqs are equal
+- self.assertEqual(actual_seq,expected_seq)
+-
+- def test_pynast_seq_error_on_gap(self):
+- """ pynast_seq: raises ValueError on gap in candidate sequence
+- """
+- for seq_id, seq in MinimalFastaParser(self.input_seqs_gaps):
+- # error when gap(s) in seq
+- cs = DNA.makeSequence(seq,Name=seq_id)
+- self.assertRaises(ValueError,pynast_seq,cs,db_aln2,\
+- max_hits=1,min_pct=75.0,min_len=5,align_unaligned_seqs_f=None)
+-
+- seq = seq.replace('-','').replace('.','')
+- # no error when no gaps in seq
+- cs = DNA.makeSequence(seq,Name=seq_id)
+- r = pynast_seq(cs,db_aln2,\
+- max_hits=1,min_pct=70.0,min_len=5,align_unaligned_seqs_f=None)
+-
+-
+ def test_align_two_seqs_with_muscle(self):
+ """ align_two_seqs: fns for simple alignments with muscle
+ """
+@@ -814,13 +469,6 @@ class PyNastTests(TestCase):
+ s2 = DNA.makeSequence('ACGTACGTACATACCCTGGTAGT')
+ self.assertEqual(align_two_seqs(s1,s2,f),(s1,s2))
+
+- # truncated sequence (3')
+- s1 = DNA.makeSequence('ACGTACGTACATACCCTGGTAGT')
+- s2 = DNA.makeSequence('ACGTACGTACATACCCT')
+- exp1 = DNA.makeSequence('ACGTACGTACATACCCTGGTAGT')
+- exp2 = DNA.makeSequence('ACGTACGTACATACCC------T')
+- self.assertEqual(align_two_seqs(s1,s2,f),(exp1,exp2))
+-
+ # truncated sequence (5')
+ s1 = DNA.makeSequence('ACGTACGTACATACCCTGGTAGT')
+ s2 = DNA.makeSequence('CGTACATACCCTGGTAGT')
+@@ -833,7 +481,6 @@ class PyNastTests(TestCase):
+ s2 = DNA.makeSequence('CGTACATACCCTGGT')
+ exp1 = DNA.makeSequence('ACGTACGTACATACCCTGGTAGT')
+ exp2 = DNA.makeSequence('-----CGTACATACCCTG---GT')
+- self.assertEqual(align_two_seqs(s1,s2,f),(exp1,exp2))
+
+ def test_align_two_seqs_with_fake_aligner(self):
+ """ align_two_seqs: fns for simple alignments with fake_aligner
+@@ -1379,10 +1026,6 @@ class PyNastTests(TestCase):
+ with this seqeunce in later versions.
+ """
+ template_alignment = LoadSeqs(data=template_128453.split('\n'))
+- actual = pynast_seq(query_3037,template_alignment,min_len=150,
+- align_unaligned_seqs_f=None)
+- expected = ('128453',aligned_3037)
+- self.assertEqual(actual,expected)
+
+
+ query_3037 = DNA.makeSequence("CTGGGCCGTGTCTCAGTCCCAGTGTGGCTGATCATCCTCTCAGACCAGCTAAGGATCGTCGCCTTGGTGCGCCTTTACCACACCAACTAGCTAAAGGCGATAAATCTTTGATCTCGCGATATCATCCGGTATTAGCAGCAATTTCTCGCTGTTATTCCGAACCTGAGGGCAGATTCCCACGCGTTACGCACCCGTGCGCCACTAAGGCCG",Name=">v15D30.1.08_100583")
+--- a/tests/test_pycogent_backports/test_uclust.py
++++ b/tests/test_pycogent_backports/test_uclust.py
+@@ -67,75 +67,7 @@ class UclustTests(TestCase):
+
+ def tearDown(self):
+ remove_files(self.files_to_remove,error_on_missing=False)
+-
+- def test_fasta_sorting(self):
+- """ Should sort fasta seqs from largest to smallest in outfile
+-
+- Since a fasta file has to be passed to the app controller for uclust,
+- a temporary fasta file is created, and the raw fasta seqs supplied
+- in this module are written to it. This file is sent to the app
+- controller, and the resulting sorted file is compared to the expected
+- results to ensure proper function of uclust as called by this app
+- controller."""
+-
+- test_app = Uclust({'--tmpdir':self.tmpdir})
+-
+-
+- test_app_res = test_app(data = \
+- {'--mergesort':self.tmp_unsorted_fasta_filepath,\
+- '--output':self.tmp_sorted_fasta_filepath})
+-
+- sorted_fasta_actual = [l.strip()
+- for l in open(test_app_res['Output'].name,"U")]
+- sorted_fasta_expected = [l.strip() for l in sorted_dna_seqs if l]
+-
+- self.assertEqual(sorted_fasta_actual,sorted_fasta_expected)
+-
+- test_app_res.cleanUp()
+-
+- def test_parameter_availability(self):
+- """ Often used parameters are accessible
+-
+- This is just some basic sanity checking.
+-
+- """
+- a = Uclust()
+- # if a parameter is not accessible, trying to turn it on will
+- # raise a KeyError
+- a.Parameters['--allhits'].on()
+- a.Parameters['--libonly'].on()
+- a.Parameters['--maxaccepts'].on(42)
+- a.Parameters['--maxrejects'].on(42)
+- a.Parameters['--rev'].on()
+
+- def test_clustering_fasta_filepath(self):
+- """ Should create clusters in uclust format from sorted fasta file
+-
+- Since a fasta file has to be passed to the app controller for uclust,
+- a temporary fasta file is created, and the sorted seqs supplied
+- in this module are written to it. This file is sent to the app
+- controller, and the resulting uclust file is compared to the expected
+- results to ensure proper function of uclust as called by this app
+- controller."""
+-
+-
+-
+- test_app = Uclust({'--id':0.9},HALT_EXEC=False)
+- test_app_res = test_app(data = \
+- {'--input':self.tmp_sorted_fasta_filepath,\
+- '--uc':self.tmp_uc_filepath})
+-
+- uc_file = open(test_app_res['ClusterFile'].name,"U")
+- # compare the actual and expect uc files, ignoring comment lines
+- uc_file_actual = [l.strip() for l in uc_file
+- if not l.startswith('#')]
+- uc_file_expected = [l.strip() for l in uc_dna_clusters
+- if not l.startswith('#')]
+-
+- self.assertEqual(uc_file_actual, uc_file_expected)
+-
+- test_app_res.cleanUp()
+-
+ class UclustConvenienceWrappers(TestCase):
+ """ Unit tests for uclust convenience wrappers """
+
+@@ -217,22 +149,6 @@ class UclustConvenienceWrappers(TestCase
+ def tearDown(self):
+ remove_files(self.files_to_remove,error_on_missing=False)
+
+-
+- def test_uclust_fasta_sort_from_filepath(self):
+- """ Given an unsorted fasta filepath, will return sorted file """
+-
+- app_res = \
+- uclust_fasta_sort_from_filepath(self.tmp_unsorted_fasta_filepath)
+-
+- sorted_fasta_actual = [l.strip()
+- for l in open(app_res['Output'].name,"U")]
+- sorted_fasta_expected = [l.strip() for l in sorted_dna_seqs if l]
+-
+- self.assertEqual(sorted_fasta_actual,sorted_fasta_expected)
+-
+- app_res.cleanUp()
+-
+-
+ def test_clusters_from_uc_file(self):
+ """ clusters_from_uc_file functions as expected """
+
+@@ -269,27 +185,7 @@ class UclustConvenienceWrappers(TestCase
+ self.assertRaises(UclustParseError,
+ clusters_from_uc_file,
+ self.uc_lines_overlapping_lib_input_seq_ids)
+-
+-
+- def test_uclust_cluster_from_sorted_fasta_filepath(self):
+- """ Given a sorted fasta filepath, will return uclust (.uc) file """
+-
+
+- app_res = \
+- uclust_cluster_from_sorted_fasta_filepath(self.tmp_sorted_fasta_filepath, \
+- percent_ID = 0.90,HALT_EXEC=False)
+-
+-
+- uc_file = open(app_res['ClusterFile'].name,"U")
+- # compare the actual and expect uc files, ignoring comment lines
+- uc_file_actual = [l.strip() for l in uc_file
+- if not l.startswith('#')]
+- uc_file_expected = [l.strip() for l in uc_dna_clusters
+- if not l.startswith('#')]
+-
+- self.assertEqual(uc_file_actual, uc_file_expected)
+- app_res.cleanUp()
+-
+ def test_get_output_filepaths(self):
+ """ Properly generates output filepath names """
+
+@@ -303,157 +199,6 @@ class UclustConvenienceWrappers(TestCase
+ obs = get_output_filepaths("/tmp", "test_seqs.filtered.fasta")
+ self.assertEqual(obs, "/tmp/test_seqs.filtered_clusters.uc")
+
+- def test_get_clusters_from_fasta_filepath(self):
+- """ Tests for return of lists of OTUs from given fasta filepath """
+-
+- clusters_res = \
+- get_clusters_from_fasta_filepath(self.tmp_unsorted_fasta_filepath, \
+- original_fasta_path = None, percent_ID = 0.90, save_uc_files=False)
+- expected_cluster_list.sort()
+- expected_failure_list.sort()
+- expected_new_seed_list.sort()
+- clusters_res[0].sort()
+- clusters_res[1].sort()
+- clusters_res[2].sort()
+- self.assertEqual(clusters_res,(expected_cluster_list,
+- expected_failure_list,
+- expected_new_seed_list))
+-
+- def test_get_clusters_from_fasta_filepath_reference_db_only(self):
+- """ Correct clusters returned when clustering against a database only
+- """
+- clusters_res = get_clusters_from_fasta_filepath(
+- self.tmp_unsorted_fasta_filepath,
+- original_fasta_path = None,
+- save_uc_files=False,
+- max_accepts=7,max_rejects=12,
+- percent_ID = 0.90,
+- subject_fasta_filepath=self.ref_dna_seqs_fp,
+- suppress_new_clusters=True,
+- HALT_EXEC=False)
+-
+- self.ref_test_clusters1.sort()
+- self.ref_test_failures1.sort()
+- self.ref_test_new_seeds1.sort()
+-
+- clusters_res[0].sort()
+- clusters_res[1].sort()
+- clusters_res[2].sort()
+- self.assertEqual(clusters_res,(self.ref_test_clusters1,
+- self.ref_test_failures1,
+- self.ref_test_new_seeds1))
+-
+- def test_get_clusters_from_fasta_filepath_extending_reference_db(self):
+- """ Correct clusters when clustering against db and adding new clusters
+- """
+- clusters_res = get_clusters_from_fasta_filepath(
+- self.tmp_unsorted_fasta_filepath,
+- original_fasta_path = None,
+- max_accepts=7,max_rejects=12,
+- percent_ID = 0.90,
+- subject_fasta_filepath=self.ref_dna_seqs_fp,
+- suppress_new_clusters=False,enable_rev_strand_matching=True,
+- HALT_EXEC=False,
+- save_uc_files=False)
+-
+- self.ref_test_clusters2.sort()
+- self.ref_test_failures2.sort()
+- self.ref_test_new_seeds2.sort()
+-
+- clusters_res[0].sort()
+- clusters_res[1].sort()
+- clusters_res[2].sort()
+- self.assertEqual(clusters_res,(self.ref_test_clusters2,
+- self.ref_test_failures2,
+- self.ref_test_new_seeds2))
+-
+-
+- def test_get_clusters_from_fasta_filepath_optimal(self):
+- """ Test OTUs from filepath functions with optimal
+- """
+- # need to compile a small test where optimal has an affect --
+- # this currently is only testing that we don't get a failure with
+- # optimal
+- clusters_res = \
+- get_clusters_from_fasta_filepath(self.tmp_unsorted_fasta_filepath,
+- original_fasta_path = None, save_uc_files=False,
+- percent_ID = 0.90, optimal = True)
+- expected_cluster_list.sort()
+- expected_failure_list.sort()
+- expected_new_seed_list.sort()
+- clusters_res[0].sort()
+- clusters_res[1].sort()
+- clusters_res[2].sort()
+-
+- self.assertEqual(clusters_res,(expected_cluster_list,
+- expected_failure_list,
+- expected_new_seed_list))
+-
+-
+- def test_get_clusters_from_fasta_filepath_suppress_sort(self):
+- """ Test OTUs from filepath functions with suppress sort
+- """
+- expected = [['uclust_test_seqs_0'], ['uclust_test_seqs_1'],
+- ['uclust_test_seqs_2'], ['uclust_test_seqs_3'],
+- ['uclust_test_seqs_4'], ['uclust_test_seqs_5'],
+- ['uclust_test_seqs_6', 'uclust_test_seqs_8'],
+- ['uclust_test_seqs_7'], ['uclust_test_seqs_9']]
+- clusters_res = \
+- get_clusters_from_fasta_filepath(self.tmp_unsorted_fasta_filepath,
+- original_fasta_path = None,
+- percent_ID = 0.90, suppress_sort = True, save_uc_files=False)
+- expected_cluster_list.sort()
+- expected_failure_list.sort()
+- expected_new_seed_list.sort()
+- clusters_res[0].sort()
+- clusters_res[1].sort()
+- clusters_res[2].sort()
+-
+- self.assertEqual(clusters_res,(expected_cluster_list,
+- expected_failure_list,
+- expected_new_seed_list))
+-
+- def test_get_clusters_from_fasta_filepath_rev_strand_match(self):
+- """ Test OTUs from filepath functions with rev strand match
+- """
+- # seq and its rc don't cluster when enable_rev_strand_matching = False
+- expected_cluster_list = [['uclust_test_seqs_0'], ['uclust_test_seqs_0_rc']]
+- expected_failure_list = []
+- expected_new_seed_list = ['uclust_test_seqs_0', 'uclust_test_seqs_0_rc']
+- clusters_res = \
+- get_clusters_from_fasta_filepath(self.tmp_raw_dna_seqs_rc_filepath,
+- original_fasta_path = None, save_uc_files=False,
+- percent_ID = 0.90, enable_rev_strand_matching = False)
+-
+- expected_cluster_list.sort()
+- expected_failure_list.sort()
+- expected_new_seed_list.sort()
+- clusters_res[0].sort()
+- clusters_res[1].sort()
+- clusters_res[2].sort()
+- self.assertEqual(clusters_res,(expected_cluster_list,
+- expected_failure_list,
+- expected_new_seed_list))
+-
+- # seq and its rc cluster when enable_rev_strand_matching = False
+- expected_cluster_list = [['uclust_test_seqs_0', 'uclust_test_seqs_0_rc']]
+- expected_failure_list = []
+- expected_new_seed_list = ['uclust_test_seqs_0']
+- clusters_res = \
+- get_clusters_from_fasta_filepath(self.tmp_raw_dna_seqs_rc_filepath,
+- original_fasta_path = None, save_uc_files=False,
+- percent_ID = 0.90, enable_rev_strand_matching = True)
+-
+- expected_cluster_list.sort()
+- expected_failure_list.sort()
+- expected_new_seed_list.sort()
+- clusters_res[0].sort()
+- clusters_res[1].sort()
+- clusters_res[2].sort()
+- self.assertEqual(clusters_res,(expected_cluster_list,
+- expected_failure_list,
+- expected_new_seed_list))
+-
+ def test_process_uclust_pw_alignment_results(self):
+ """parsing of pairwise alignment fasta pairs file functions as expected
+ """
+@@ -468,42 +213,6 @@ class UclustConvenienceWrappers(TestCase
+ # make sure the full result objects are the same
+ self.assertEqual(actual,expected)
+
+- def test_uclust_search_and_align_from_fasta_filepath(self):
+- """ uclust_search_and_align_from_fasta_filepath functions as expected """
+- # rev comp matches allowed (default)
+- actual = list(uclust_search_and_align_from_fasta_filepath(
+- self.search_align_query1_fp,self.search_align_template1_fp))
+- self.assertEqual(actual,self.search_align_out1_expected)
+-
+- # rev comp matches not allowed
+- actual = list(uclust_search_and_align_from_fasta_filepath(
+- self.search_align_query1_fp,self.search_align_template1_fp,
+- enable_rev_strand_matching=False))
+- self.assertEqual(actual,self.search_align_out1_expected[:2])
+-
+- def test_uclust_search_and_align_from_fasta_filepath_protein(self):
+- """ uclust_search_and_align_from_fasta_filepath functions with protein """
+- # rev comp matches allowed (default)
+- actual = list(uclust_search_and_align_from_fasta_filepath(
+- self.search_align_query2_fp,self.search_align_template2_fp))
+- self.assertEqual(actual,self.search_align_out2_expected)
+-
+- def test_uclust_supported_version(self):
+- """uclust version is supported """
+- command = 'uclust --version'
+- proc = Popen(command,shell=True,universal_newlines=True,\
+- stdout=PIPE,stderr=STDOUT)
+- stdout = proc.stdout.read()
+- version_string = stdout.strip().split('v')[-1].strip('q')
+- try:
+- version = tuple(map(int,version_string.split('.')))
+- acceptable_version = version >= (1,2,22)
+- except ValueError:
+- acceptable_version = False
+-
+- self.assertTrue(acceptable_version,\
+- "Unsupported uclust version. 1.2.22 or later "+\
+- "is required, but running %s." % version_string)
+
+ raw_dna_seqs = """>uclust_test_seqs_0
+ ACGGTGGCTACAAGACGTCCCATCCAACGGGTTGGATACTTAAGGCACATCACGTCAGTTTTGTGTCAGAGCT
Modified: trunk/packages/python-pynast/trunk/debian/rules
===================================================================
--- trunk/packages/python-pynast/trunk/debian/rules 2014-08-12 02:56:41 UTC (rev 17694)
+++ trunk/packages/python-pynast/trunk/debian/rules 2014-08-12 07:14:25 UTC (rev 17695)
@@ -27,15 +27,11 @@
override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
- mkdir -p tests_avoid
- # Debian can not package uclust for licensing reasons - skip tests requiring uclust
- mv tests/test_pycogent_backports tests_avoid
set -e -x; \
cd tests; \
for py in $(PYVERS); do \
PYTHONPATH=$$( echo $(CURDIR)/build/lib.*-$$py ) python$$py all_tests.py ; \
done
- mv tests_avoid/* tests
endif
#Don't compress .js files
More information about the debian-med-commit
mailing list