Ejemplo n.º 1
0
def main():
    start = datetime.now()
    global logger
    fn = os.path.join(os.getcwd(), "cLoops.log")
    logger = getLogger(fn)
    op = mainHelp()
    report = "Command line: cLoops -f {} -o {} -m {} -eps {} -minPts {} -p {} -w {} -j {} -s {} -c {} -hic {} -cut {} -plot {} -max_cut {}".format(
        op.fnIn, op.fnOut, op.mode, op.eps, op.minPts, op.cpu, op.washU,
        op.juice, op.tmp, op.chroms, op.hic, op.cut, op.plot, op.max_cut)
    logger.info(report)
    if op.mode == 0:
        #parse eps
        if "," in str(op.eps):
            eps = map(int, op.eps.split(","))
            eps.sort(reverse=False)
        else:
            eps = int(op.eps)
            if eps != 0:
                eps = [eps]
        #parse minPts
        if "," in str(op.minPts):
            minPts = map(int, op.minPts.split(","))
            minPts.sort(reverse=True)
        else:
            minPts = int(op.minPts)
            if minPts != 0:
                minPts = [minPts]
            else:
                logger.error("minPts not assigned!")
                return
        hic = op.hic
    if op.mode == 1:
        eps = [500, 1000, 2000]
        minPts = [5]
        hic = 0
    if op.mode == 2:
        eps = [1000, 2000, 5000]
        minPts = [5]
        hic = 0
    if op.mode == 3:
        eps = [5000, 7500, 10000]
        minPts = [50, 40, 30, 20]
        hic = 1
    if op.mode == 4:
        eps = [2500, 5000, 7500, 10000]
        minPts = [30, 20]
        hic = 1
    report = "mode:%s\t eps:%s\t minPts:%s\t hic:%s\t" % (op.mode, eps, minPts,
                                                          hic)
    logger.info(report)
    pipe(op.fnIn.split(","), op.fnOut, eps, minPts, op.chroms, op.cpu, op.tmp,
         hic, op.washU, op.juice, op.cut, op.plot, op.max_cut)
    usedtime = datetime.now() - start
    r = "cLoops finished. Used CPU time: %s Bye!\n\n\n" % usedtime
    logger.info(r)
Ejemplo n.º 2
0
def main():
    global logger
    fn = os.path.join(os.getcwd(), "quantifyLoops.log")
    logger = getLogger(fn)
    op = help()
    if op.chroms == "":
        chroms = []
    else:
        chroms = set(op.chroms.split(","))
    cfa, dfa = op.f, op.d
    ra = preDs(cfa, dfa, chroms)
    keys = ra.keys()
    for key in ra.keys():
        if key not in keys:
            del ra[key]
            logger.info("No match of %s in %s or %s" % (key, cfa, dfa))
    quantifyLoops(ra, op.output, op.dis, op.cpu)
Ejemplo n.º 3
0
def main():
    start = datetime.now()
    global logger
    fn = os.path.join(os.getcwd(), "cLoops.log")
    logger = getLogger(fn)
    op = mainHelp()
    report = "Command line: cLoops -f {} -o {} -eps {} -minPts {} -p {} -w {} -j {} -s {} -c {} -hic {} -cut {}".format(
        op.fnIn, op.fnOut, op.eps, op.minPts, op.cpu, op.washU, op.juice,
        op.tmp, op.chroms, op.hic, op.cut)
    logger.info(report)
    if "," in str(op.eps):
        eps = map(int, op.eps.split(","))
    else:
        eps = int(op.eps)
        if eps != 0:
            eps = [eps]
    pipe(op.fnIn.split(","), op.fnOut, eps, op.minPts, op.chroms, op.cpu,
         op.tmp, op.hic, op.washU, op.juice, op.cut)
    usedtime = datetime.now() - start
    r = "cLoops finished. Used CPU time: %s Bye!" % usedtime
    logger.info(r)
Ejemplo n.º 4
0
    l, a, n, m, = 0, 0, 0, 0
    for d in ds:
        l += d[0]
        a += d[1]
        n += d[2]
        m += d[3]
    r = m / 1.0 / n
    report = "%s\t%s,loops:%s, anchors:%s,raw PETs: %s, PETs in anchors:%s, ratio:%s" % (
        f, dir, l, a, n, m, r)
    logger.info(report)


if __name__ == "__main__":
    start = datetime.now()
    fn = os.path.join(os.getcwd(), "%s.log" % NAME)
    logger = getLogger(fn)
    op = jd2cleanWashuPETsHelp()
    if op.chroms == "":
        chroms = []
    else:
        chroms = set(op.chroms.split(","))
    if not os.path.exists(op.output):
        os.mkdir(op.output)
    jd2cleanWashuPETs(op.f,
                      op.d,
                      op.significant,
                      op.output,
                      chroms=chroms,
                      cpu=op.cpu)
    usedtime = datetime.now() - start
    r = "%s finished. Bye! Used time:%s" % (NAME, usedtime)