def local_max_end_beg(self): win_beg = 942899 win_end = 947099 strand_search = 'top' local_max_received = infernal.local_max( self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, cmsearch_bin=self.cmsearch, out_dir=self.out_dir, cpu_nb=self.cpu_nb) local_max_expected = pd.DataFrame([[ 'LIAN.001.C02_10', 'attC_4', 1, 47, 943270, 943395, '+', 0.13 ], [ 'LIAN.001.C02_10', 'attC_4', 1, 47, 944008, 944133, '+', 0.049 ], ['LIAN.001.C02_10', 'attC_4', 1, 47, 944472, 944598, '+', 4.7e-06]], columns=[ 'Accession_number', 'cm_attC', 'cm_debut', 'cm_fin', 'pos_beg', 'pos_end', 'sens', 'evalue' ]) pdt.assert_frame_equal(local_max_expected, local_max_received)
def test_local_max_cmsearch_bad_rc(self): win_beg = 942899 win_end = 947099 strand_search = 'top' infernal.call = lambda x, stdout=None: 1 with self.assertRaises(RuntimeError) as ctx: _ = infernal.local_max(self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, out_dir=self.out_dir, cpu_nb=self.cpu_nb ) self.assertTrue(str(ctx.exception).endswith("failed returncode = {}".format(infernal.call(None))))
def test_no_local_max_bottom(self): win_beg = 930689 win_end = 934889 strand_search = 'bottom' local_max_received = infernal.local_max(self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, cmsearch_bin=self.cmsearch, out_dir=self.out_dir, cpu_nb=self.cpu_nb ) local_max_expected = pd.DataFrame(columns=['Accession_number', 'cm_attC', 'cm_debut', 'cm_fin', 'pos_beg', 'pos_end', 'sens', 'evalue']) pdt.assert_frame_equal(local_max_expected, local_max_received)
def test_local_max_cmsearch_failed(self): win_beg = 942899 win_end = 947099 strand_search = 'top' cmsearch_bin = 'failed_cmsearch' with self.assertRaises(RuntimeError) as ctx: _ = infernal.local_max(self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, cmsearch_bin=cmsearch_bin, out_dir=self.out_dir, cpu_nb=self.cpu_nb ) self.assertTrue(re.search("failed : \[Errno 2\] No such file or directory: '{}'".format(cmsearch_bin), str(ctx.exception)))
def local_max_end_beg(self): win_beg = 942899 win_end = 947099 strand_search = 'top' local_max_received = infernal.local_max(self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, cmsearch_bin=self.cmsearch, out_dir=self.out_dir, cpu_nb=self.cpu_nb ) local_max_expected = pd.DataFrame([['LIAN.001.C02_10', 'attC_4', 1, 47, 943270, 943395, '+', 0.13], ['LIAN.001.C02_10', 'attC_4', 1, 47, 944008, 944133, '+', 0.049], ['LIAN.001.C02_10', 'attC_4', 1, 47, 944472, 944598, '+', 4.7e-06]], columns=['Accession_number', 'cm_attC', 'cm_debut', 'cm_fin', 'pos_beg', 'pos_end', 'sens', 'evalue']) pdt.assert_frame_equal(local_max_expected, local_max_received)
def test_local_max_cmsearch_bad_rc(self): win_beg = 942899 win_end = 947099 strand_search = 'top' infernal.call = lambda x, stdout=None: 1 with self.assertRaises(RuntimeError) as ctx: _ = infernal.local_max(self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, out_dir=self.out_dir, cpu_nb=self.cpu_nb) self.assertTrue( str(ctx.exception).endswith("failed returncode = {}".format( infernal.call(None))))
def test_no_local_max_bottom(self): win_beg = 930689 win_end = 934889 strand_search = 'bottom' local_max_received = infernal.local_max( self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, cmsearch_bin=self.cmsearch, out_dir=self.out_dir, cpu_nb=self.cpu_nb) local_max_expected = pd.DataFrame(columns=[ 'Accession_number', 'cm_attC', 'cm_debut', 'cm_fin', 'pos_beg', 'pos_end', 'sens', 'evalue' ]) pdt.assert_frame_equal(local_max_expected, local_max_received)
def test_local_max_cmsearch_failed(self): win_beg = 942899 win_end = 947099 strand_search = 'top' cmsearch_bin = 'failed_cmsearch' with self.assertRaises(RuntimeError) as ctx: _ = infernal.local_max(self.replicon, win_beg, win_end, self.model_attc_path, strand_search=strand_search, evalue_attc=self.evalue_attc, max_attc_size=self.max_attc_size, min_attc_size=self.min_attc_size, cmsearch_bin=cmsearch_bin, out_dir=self.out_dir, cpu_nb=self.cpu_nb) self.assertTrue( re.search( "failed : \[Errno 2\] No such file or directory: '{}'".format( cmsearch_bin), str(ctx.exception)))