本文整理匯總了Python中process.sequence.AlignmentList.filter_missing_data方法的典型用法代碼示例。如果您正苦於以下問題:Python AlignmentList.filter_missing_data方法的具體用法?Python AlignmentList.filter_missing_data怎麽用?Python AlignmentList.filter_missing_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類process.sequence.AlignmentList
的用法示例。
在下文中一共展示了AlignmentList.filter_missing_data方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: AlignmentMissingFiltersTest
# 需要導入模塊: from process.sequence import AlignmentList [as 別名]
# 或者: from process.sequence.AlignmentList import filter_missing_data [as 別名]
class AlignmentMissingFiltersTest(unittest.TestCase):
def setUp(self):
if not os.path.exists(temp_dir):
os.makedirs(temp_dir)
self.aln_obj = AlignmentList([], sql_db=sql_db)
def tearDown(self):
self.aln_obj.clear_alignments()
self.aln_obj.con.close()
shutil.rmtree(temp_dir)
def test_filter_default(self):
self.aln_obj.add_alignment_files(
["trifusion/tests/data/missing_data.phy",
"trifusion/tests/data/missing_data2.phy"]
)
self.aln_obj.filter_missing_data(25, 50)
s = []
for aln in self.aln_obj:
s.append(aln.locus_length)
self.assertEqual(s, [42, 43])
def test_filter_and_concat(self):
self.aln_obj.add_alignment_files(
["trifusion/tests/data/missing_data.phy",
"trifusion/tests/data/missing_data2.phy"]
)
self.aln_obj.filter_missing_data(25, 50, table_out="master_out")
self.aln_obj.concatenate(table_in="master_out")
self.assertEqual(self.aln_obj.size, 85)
def test_no_filters(self):
self.aln_obj.add_alignment_files(
["trifusion/tests/data/missing_data.phy",
"trifusion/tests/data/missing_data2.phy"]
)
self.aln_obj.filter_missing_data(100, 100)
s = []
for aln in self.aln_obj:
s.append(aln.locus_length)
self.assertEqual(s, [50, 50])
def test_no_missing(self):
self.aln_obj.add_alignment_files(
["trifusion/tests/data/missing_data.phy",
"trifusion/tests/data/missing_data2.phy"]
)
self.aln_obj.filter_missing_data(0, 0)
s = []
for aln in self.aln_obj:
s.append(aln.locus_length)
self.assertEqual(s, [0, 19])
def test_no_data_aln_default_filters(self):
self.aln_obj.add_alignment_files(
["trifusion/tests/data/missing_data3.phy"]
)
self.aln_obj.filter_missing_data(25, 50)
s = None
for aln in self.aln_obj:
s = aln.locus_length
self.assertEqual(s, 0)
def test_no_data_aln_no_filters(self):
self.aln_obj.add_alignment_files(
["trifusion/tests/data/missing_data3.phy"]
)
self.aln_obj.filter_missing_data(100, 100)
s = None
for aln in self.aln_obj:
s = aln.locus_length
self.assertEqual(s, 50)