当前位置: 首页>>代码示例>>Python>>正文


Python AlignmentList.filter_by_taxa方法代码示例

本文整理汇总了Python中process.sequence.AlignmentList.filter_by_taxa方法的典型用法代码示例。如果您正苦于以下问题:Python AlignmentList.filter_by_taxa方法的具体用法?Python AlignmentList.filter_by_taxa怎么用?Python AlignmentList.filter_by_taxa使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在process.sequence.AlignmentList的用法示例。


在下文中一共展示了AlignmentList.filter_by_taxa方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AlignmentTaxaFilters

# 需要导入模块: from process.sequence import AlignmentList [as 别名]
# 或者: from process.sequence.AlignmentList import filter_by_taxa [as 别名]
class AlignmentTaxaFilters(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_min_taxa(self):

        self.aln_obj.add_alignment_files(dna_data_fas)

        self.aln_obj.filter_min_taxa(50)

        self.assertEqual(len(self.aln_obj.alignments), 5)

    def test_filter_min_taxa_max(self):

        self.aln_obj.add_alignment_files(dna_data_fas)

        self.aln_obj.filter_min_taxa(100)

        self.assertEqual(len(self.aln_obj.alignments), 1)

    def test_filter_min_taxa_min(self):

        self.aln_obj.add_alignment_files(dna_data_fas)

        self.aln_obj.filter_min_taxa(0)

        self.assertEqual(len(self.aln_obj.alignments), 7)

    def test_filter_by_taxa_include(self):

        self.aln_obj.add_alignment_files(dna_data_fas)

        self.aln_obj.filter_by_taxa(["spa", "spb", "spc", "spd"], "Contain")

        self.assertEqual(len(self.aln_obj.alignments), 2)

    def test_filter_by_taxa_exclude(self):

        self.aln_obj.add_alignment_files(dna_data_fas)

        self.aln_obj.filter_by_taxa(["spa", "spb", "spc", "spd"], "Exclude")

        self.assertEqual(len(self.aln_obj.alignments), 5)

    def test_filter_by_taxa_all(self):

        self.aln_obj.add_alignment_files(dna_data_fas)

        self.aln_obj.filter_by_taxa(["no_taxa"], "Contain")

        self.assertEqual(len(self.aln_obj.alignments), 0)

    def test_filter_by_taxa_from_file(self):

        self.aln_obj.add_alignment_files(dna_data_fas)

        self.aln_obj.filter_by_taxa("trifusion/tests/data/filter_taxa.txt",
                                    "Contain")

        self.assertEqual(len(self.aln_obj.alignments), 2)
开发者ID:ODiogoSilva,项目名称:TriFusion,代码行数:73,代码来源:test_process_filters.py


注:本文中的process.sequence.AlignmentList.filter_by_taxa方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。