def annotate(args):
    """
    %prog annotate coordsfile

    Annotate coordsfile to append an additional column, with the following
    overlaps: {0}.
    """
    p = OptionParser(annotate.__doc__.format(", ".join(Overlap_types)))
    p.add_option("--maxhang", default=100, type="int",
                 help="Max hang to call dovetail overlap [default: %default]")
    p.add_option("--all", default=False, action="store_true",
                 help="Output all lines [default: terminal/containment]")

    opts, args = p.parse_args(args)

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

    coordsfile, = args
    fp = open(coordsfile)

    for row in fp:
        try:
            c = CoordsLine(row)
        except AssertionError:
            continue

        ov = c.overlap(opts.maxhang)
        if not opts.all and ov == 0:
            continue

        print("{0}\t{1}".format(row.strip(), Overlap_types[ov]))
def annotate ( args ) : p = OptionParser ( annotate . __doc__ . format ( ", " . join ( Overlap_types ) ) ) p . add_option ( "--maxhang" , default = 100 , type = "int" , help = "Max hang to call dovetail overlap [default: %default]" ) p . add_option ( "--all" , default = False , action = "store_true" , help = "Output all lines [default: terminal/containment]" ) opts , args = p . parse_args ( args ) if len ( args ) != 1 : sys . exit ( not p . print_help ( ) ) coordsfile , = args fp = open ( coordsfile ) for row in fp : try : c = CoordsLine ( row ) except AssertionError : continue ov = c . overlap ( opts . maxhang ) if not opts . all and ov == 0 : continue print ( "{0}\t{1}" . format ( row . strip ( ) , Overlap_types [ ov ] ) )
%prog annotate coordsfile

    Annotate coordsfile to append an additional column, with the following
    overlaps: {0}.