def test_dnal(self): """Call dnal, and do a trivial check on its output.""" Wise.align(["dnal"], ("seq1.fna", "seq2.fna"), kbyte=100000, dry_run=True) self.assert_(sys.stdout.getvalue().startswith( "dnal -kbyte 100000 seq1.fna seq2.fna"))
def test_psw(self): """Call psw, and do a trivial check on its output.""" Wise.align(["psw"], ("seq1.faa", "seq2.faa"), dry_run=True, kbyte=4) #If test output is redirected to a file, the wrapper adds -quiet output = sys.stdout.getvalue().replace(" -quiet ", " ") self.assertTrue(output.startswith("psw -kbyte 4 seq1.faa seq2.faa"), output[:200])
def test_dnal(self): """Call dnal, and do a trivial check on its output.""" Wise.align(["dnal"], ("seq1.fna", "seq2.fna"), kbyte=100000, dry_run=True) #If test output is redirected to a file, the wrapper adds -quiet output = sys.stdout.getvalue().replace(" -quiet ", " ") self.assertTrue( output.startswith("dnal -kbyte 100000 seq1.fna seq2.fna"), output[:200])
def test_align(self): """Call dnal with optional arguments, and do a trivial check on the output.""" temp_file = Wise.align( ["dnal"], ("Wise/human_114_g01_exons.fna_01", "Wise/human_114_g02_exons.fna_01"), kbyte=100000, force_type="DNA", quiet=True, ) line = temp_file.readline().rstrip() if line == "Score 114": # Wise 2.4.1 includes a score line, even in quiet mode, ignore this line = temp_file.readline().rstrip() if (line == "ENSG00000172135 AGGGAAAGCCCCTAAGCTC--CTGATCTATGCTGCATCCAGTTTGCAAAGTGGGGTCCC" ): # This is what we expect from wise 2.2.0 (and earlier) pass elif (line == "ENSG00000172135 AGGGAAAGCCCCTAAGCTC--CTGATCTATGCTGCATCCAGTTTGCAAAG-TGGGGTCC" ): # This is what we expect from wise 2.4.1 pass else: # Bad! self.fail(line)
def align(pair, match=_SCORE_MATCH, mismatch=_SCORE_MISMATCH, gap=_SCORE_GAP_START, extension=_SCORE_GAP_EXTENSION, **keywds): cmdline = _build_dnal_cmdline(match, mismatch, gap, extension) temp_file = Wise.align(cmdline, pair, **keywds) try: return Statistics(temp_file.name, match, mismatch, gap, extension) except AttributeError: try: keywds['dry_run'] return None except KeyError: raise
def align(pair, scores=None, gap_start=None, gap_extension=None, *args, **keywds): cmdline = _CMDLINE_PSW[:] if scores: cmdline.extend((_OPTION_SCORES, scores)) if gap_start: cmdline.extend((_OPTION_GAP_START, str(gap_start))) if gap_extension: cmdline.extend((_OPTION_GAP_EXTENSION, str(gap_extension))) temp_file = Wise.align(cmdline, pair, *args, **keywds) return parse(temp_file)
def align(pair, match=_SCORE_MATCH, mismatch=_SCORE_MISMATCH, gap=_SCORE_GAP_START, extension=_SCORE_GAP_EXTENSION, **keywds): """Align a pair of DNA files using dnal and calculate the statistics of the alignment.""" cmdline = _build_dnal_cmdline(match, mismatch, gap, extension) temp_file = Wise.align(cmdline, pair, **keywds) try: return Statistics(temp_file.name, match, mismatch, gap, extension) except AttributeError: try: keywds['dry_run'] return None except KeyError: raise
def test_align(self): """Call dnal with optional arguments, and do a trivial check on the output.""" temp_file = Wise.align(["dnal"], ("Wise/human_114_g01_exons.fna_01", "Wise/human_114_g02_exons.fna_01"), kbyte=100000, force_type="DNA", quiet=True) line = temp_file.readline().rstrip() if line == "Score 114" : #Wise 2.4.1 includes a score line, even in quiet mode, ignore this line = temp_file.readline().rstrip() if line == "ENSG00000172135 AGGGAAAGCCCCTAAGCTC--CTGATCTATGCTGCATCCAGTTTGCAAAGTGGGGTCCC" : #This is what we expect from wise 2.2.0 (and earlier) pass elif line == "ENSG00000172135 AGGGAAAGCCCCTAAGCTC--CTGATCTATGCTGCATCCAGTTTGCAAAG-TGGGGTCC" : #This is what we expect from wise 2.4.1 pass else : #Bad! self.assert_(False, line)
def test_psw(self): """Call psw, and do a trivial check on its output.""" Wise.align(["psw"], ("seq1.faa", "seq2.faa"), dry_run=True, kbyte=4) self.assert_(sys.stdout.getvalue().startswith("psw -kbyte 4 seq1.faa seq2.faa"))
def test_dnal(self): """Call dnal, and do a trivial check on its output.""" Wise.align(["dnal"], ("seq1.fna", "seq2.fna"), kbyte=100000, dry_run=True) self.assert_(sys.stdout.getvalue().startswith("dnal -kbyte 100000 seq1.fna seq2.fna"))
def test_psw(self): """Call psw, and do a trivial check on its output.""" Wise.align(["psw"], ("seq1.faa", "seq2.faa"), dry_run=True, kbyte=4) # If test output is redirected to a file, the wrapper adds -quiet output = sys.stdout.getvalue().replace(" -quiet ", " ") self.assertTrue(output.startswith("psw -kbyte 4 seq1.faa seq2.faa"), output[:200])
def test_dnal(self): """Call dnal, and do a trivial check on its output.""" Wise.align(["dnal"], ("seq1.fna", "seq2.fna"), kbyte=100000, dry_run=True) # If test output is redirected to a file, the wrapper adds -quiet output = sys.stdout.getvalue().replace(" -quiet ", " ") self.assertTrue(output.startswith("dnal -kbyte 100000 seq1.fna seq2.fna"), output[:200])
def test_psw(self): """Call psw, and do a trivial check on its output.""" Wise.align(["psw"], ("seq1.faa", "seq2.faa"), dry_run=True, kbyte=4) self.assert_( sys.stdout.getvalue().startswith("psw -kbyte 4 seq1.faa seq2.faa"))