def test_as_refpkg(self): with wrap.as_refpkg(self.sequences) as refpkg: self.assertTrue(os.path.isdir(refpkg.path)) if which('rppr'): out = subprocess.check_output(['rppr', 'check', '-c', refpkg.path]) self.assertTrue('OK!' in out, out)
class FilterOutliersFunctions(unittest.TestCase): def setUp(self): pass def test_parse_usearch_allpairs(self): filename = util.data_path('e_faecalis.head.allpairs') with open(util.data_path('e_faecalis.head.fasta')) as f: seqs = SeqIO.parse(f, 'fasta') seqnames = [seq.id for seq in seqs] distmat = filter_outliers.parse_usearch_allpairs(filename, seqnames) self.assertEqual(len(seqnames), distmat.shape[0]) @unittest.skipUnless(which(wrap.VSEARCH), "{} not found.".format(wrap.VSEARCH)) def test_distmat_pairwise_vsearch(self): infile = util.data_path('e_faecalis.head.fasta') taxa, distmat = filter_outliers.distmat_pairwise( infile, 'foo', 'vsearch', wrap.VSEARCH) self.assertEqual(distmat.shape[0], len(taxa))
import os.path import subprocess import tempfile import unittest from Bio import SeqIO from deenurp import wrap from deenurp.test import util from deenurp.util import which @unittest.skipUnless(which('cmalign'), "cmalign not found.") class CmAlignTestCase(unittest.TestCase): def setUp(self): self.sequences = list(SeqIO.parse(util.data_path('test_input.fasta'), 'fasta')) def test_nompi(self): result = list(wrap.cmalign(self.sequences)) self.assertEqual(len(self.sequences), len(result)) def test_mpi(self): result = list(wrap.cmalign(self.sequences, mpi_args=['-np', '2'])) self.assertEqual(len(self.sequences), len(result)) class CMTestCase(unittest.TestCase): def test_find_cm(self): self.assertTrue(os.path.isfile(wrap.CM)) @unittest.skipUnless(which('FastTree'), "FastTree not found") class AsRefpkgTestCase(unittest.TestCase): def setUp(self):