def children(args):
    """
    %prog children gff_file

    Get the children that have the same parent.
    """
    p = OptionParser(children.__doc__)
    p.add_option("--parents", default="gene",
            help="list of features to extract, use comma to separate (e.g."
            "'gene,mRNA') [default: %default]")

    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    gff_file, = args
    g = make_index(gff_file)
    parents = set(opts.parents.split(','))

    for feat in get_parents(gff_file, parents):

        cc = [c.id for c in g.children(feat.id, 1)]
        if len(cc) <= 1:
            continue

        print("\t".join(str(x) for x in \
                    (feat.id, feat.start, feat.stop, "|".join(cc))))
def children ( args ) : p = OptionParser ( children . __doc__ ) p . add_option ( "--parents" , default = "gene" , help = "list of features to extract, use comma to separate (e.g." "'gene,mRNA') [default: %default]" ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) gff_file , = args g = make_index ( gff_file ) parents = set ( opts . parents . split ( ',' ) ) for feat in get_parents ( gff_file , parents ) : cc = [ c . id for c in g . children ( feat . id , 1 ) ] if len ( cc ) <= 1 : continue print ( "\t" . join ( str ( x ) for x in ( feat . id , feat . start , feat . stop , "|" . join ( cc ) ) ) )
%prog children gff_file

    Get the children that have the same parent.