本文整理汇总了Python中jcvi.utils.grouper.Grouper.keys方法的典型用法代码示例。如果您正苦于以下问题:Python Grouper.keys方法的具体用法?Python Grouper.keys怎么用?Python Grouper.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jcvi.utils.grouper.Grouper
的用法示例。
在下文中一共展示了Grouper.keys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fuse
# 需要导入模块: from jcvi.utils.grouper import Grouper [as 别名]
# 或者: from jcvi.utils.grouper.Grouper import keys [as 别名]
def fuse(args):
"""
%prog fuse *.bed *.anchors
Fuse gene orders based on anchors file.
"""
from jcvi.algorithms.graph import BiGraph
p = OptionParser(fuse.__doc__)
opts, args = p.parse_args(args)
if len(args) < 1:
sys.exit(not p.print_help())
bedfiles = [x for x in args if x.endswith(".bed")]
anchorfiles = [x for x in args if x.endswith(".anchors")]
# TODO: Use Markov clustering to sparsify the edges
families = Grouper()
for anchorfile in anchorfiles:
af = AnchorFile(anchorfile)
for a, b, block_id in af.iter_pairs():
families.join(a, b)
allowed = set(families.keys())
logging.debug("Total families: {}, Gene members: {}"
.format(len(families), len(allowed)))
# TODO: Use C++ implementation of BiGraph() when available
# For now just serialize this to the disk
G = BiGraph()
for bedfile in bedfiles:
bed = Bed(bedfile, include=allowed)
#add_bed_to_graph(G, bed, families)
print_edges(G, bed, families)