示例#1
0
def parse_comparestring(comp):
    a = comp.split(",")

    baselist = []
    derivedlist = []
    for e in a:
        b, d = map(int, e.split("-"))
        baselist.append(b)
        derivedlist.append(d)
    return (baselist, derivedlist)


parser = OptionParser()
parser.add_option("--sync",
                  dest="sync",
                  help="A file containing the cmh results")
parser.add_option("--compare",
                  dest="comp",
                  help="A comparision string as with the cmh-test")
(options, args) = parser.parse_args()

baselist, derivedlist = parse_comparestring(options.comp)

for chr, pos, mami, s in SyncReaderMajMin(options.sync):
    # [2L,15,(C,A),(108,45),(90,47))
    basec, derc = parse_line(s, baselist, derivedlist)
    hshc = get_hshc(basec, derc)

    topr = [chr, str(pos), str(hshc)]
    print "\t".join(topr)
示例#2
0
    baselist = []
    derivedlist = []
    for e in a:
        b, d = map(int, e.split("-"))
        baselist.append(b)
        derivedlist.append(d)
    return (baselist, derivedlist)


parser = OptionParser()
parser.add_option("--sync",
                  dest="sync",
                  help="A file containing the cmh results")
parser.add_option("--compare",
                  dest="comp",
                  help="A comparision string as with the cmh-test")
(options, args) = parser.parse_args()

baselist, derivedlist = parse_comparestring(options.comp)

for chr, start, end, syncs in SyncWindowReader(SyncReaderMajMin(options.sync),
                                               1000):
    if len(syncs) == 0:
        continue

    basec, derc = parse_line(syncs, baselist, derivedlist)
    hsc = get_hshcwindow(basec, derc)

    topr = [chr, str(start), str(hsc)]
    print "\t".join(topr)