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


Python DndParser.getTipNames方法代码示例

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


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

示例1: check_tree_subset

# 需要导入模块: from cogent.parse.tree import DndParser [as 别名]
# 或者: from cogent.parse.tree.DndParser import getTipNames [as 别名]
def check_tree_subset(fasta_labels,
                      tree_fp):
    """ Returns a list of all fasta labels that are not a subset of the tree
    
    fasta_labels:  list of fasta labels
    tree_fp: tree filepath
    """
    
    # Need to get modified fasta labels with underscore stripped
    
    raw_fasta_labels = set([label.split('_')[0] for label in fasta_labels])
    
    tree_f = open(tree_fp, "U")
    
    tree = DndParser(tree_f)
    
    # Get a set of tree tip names
    tree_tips = set(tree.getTipNames())
    
    labels_not_in_tips = []
    
    for curr_label in raw_fasta_labels:
        if curr_label not in tree_tips:
            labels_not_in_tips.append(curr_label)
    
    # Return True if all found in tree tips
    if len(labels_not_in_tips) == 0:
        labels_not_in_tips = True
    
    return labels_not_in_tips
开发者ID:Jorge-C,项目名称:qiime,代码行数:32,代码来源:validate_demultiplexed_fasta.py

示例2: check_tree_exact_match

# 需要导入模块: from cogent.parse.tree import DndParser [as 别名]
# 或者: from cogent.parse.tree.DndParser import getTipNames [as 别名]
def check_tree_exact_match(fasta_labels,
                           tree_fp):
    """Checks fasta labels to exact match to tree tips
    
    Returns a list of two lists, the fasta labels not in tips, and tips not
     in fasta labels.
    fasta_labels: list of fasta labels
    tree_fp: tree filepath
    """
    
    # Need to get modified fasta labels with underscore stripped
    
    raw_fasta_labels = set([label.split('_')[0] for label in fasta_labels])
    
    tree_f = open(tree_fp, "U")
    
    tree = DndParser(tree_f)
    
    # Get a set of tree tip names
    tree_tips = set(tree.getTipNames())
    
    labels_not_in_tips = []
    
    for curr_label in raw_fasta_labels:
        if curr_label not in tree_tips:
            labels_not_in_tips.append(curr_label)
            
    
    # Return True if all found in tree tips
    if len(labels_not_in_tips) == 0:
        labels_not_in_tips = True
        
    tips_not_in_labels = []
    
    for curr_tip in tree_tips:
        if curr_tip not in raw_fasta_labels:
            tips_not_in_labels.append(curr_tip)
            
    if len(tips_not_in_labels) == 0:
        tips_not_in_labels = True
    
    return [labels_not_in_tips, tips_not_in_labels]
开发者ID:Jorge-C,项目名称:qiime,代码行数:44,代码来源:validate_demultiplexed_fasta.py


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