3eea3791dc36fbfc521b45b9eebd854c73908b62,dataPrepScripts/CountNumInBed.py,,Calc,#Any#,15

Before Change



    a = 0
    o = 0
    with open(args.input_fn) as f:
        for row in f:
            a += 1
            row = row.strip().split()
            ctgName = row[0]
            pos = int(row[1])
            if ctgName not in tree:
                continue
            if len(tree[ctgName].search(pos)) == 0:
                continue
            o += 1

    logging.info("Total: %d, Overlapped: %d, Percentage: %.3f" % (a, o, float(o)/a*100) )


if __name__ == "__main__":

After Change



    logging.info("Loading BED file ...")
    tree = {}
    f = subprocess.Popen(shlex.split("gzip -fdc %s" % (args.bed_fn) ), stdout=subprocess.PIPE, bufsize=8388608)
    for row in f.stdout:
        row = row.strip().split()
        name = row[0]
        if name not in tree:
            tree[name] = intervaltree.IntervalTree()
        begin = int(row[1])
        end = int(row[2])
        tree[name].addi(begin, end)
    f.stdout.close()
    f.wait()

    logging.info("Counting number of records in bed regions ...")

    a = 0
    o = 0
    f = subprocess.Popen(shlex.split("gzip -fdc %s" % (args.input_fn) ), stdout=subprocess.PIPE, bufsize=8388608)
    for row in f.stdout:
        a += 1
        row = row.strip().split()
        ctgName = row[0]
        pos = int(row[1])
        if ctgName not in tree:
            continue
        if len(tree[ctgName].search(pos)) == 0:
            continue
        o += 1
    f.stdout.close()
    f.wait()

    logging.info("Total: %d, Overlapped: %d, Percentage: %.3f" % (a, o, float(o)/a*100) )

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 24

Instances


Project Name: aquaskyline/Clairvoyante
Commit Name: 3eea3791dc36fbfc521b45b9eebd854c73908b62
Time: 2017-09-13
Author: aquaskyline@gmail.com
File Name: dataPrepScripts/CountNumInBed.py
Class Name:
Method Name: Calc


Project Name: aquaskyline/Clairvoyante
Commit Name: 3eea3791dc36fbfc521b45b9eebd854c73908b62
Time: 2017-09-13
Author: aquaskyline@gmail.com
File Name: dataPrepScripts/ChooseItemInBed.py
Class Name:
Method Name: Calc


Project Name: aquaskyline/Clairvoyante
Commit Name: 3eea3791dc36fbfc521b45b9eebd854c73908b62
Time: 2017-09-13
Author: aquaskyline@gmail.com
File Name: dataPrepScripts/CountNumInBed.py
Class Name:
Method Name: Calc


Project Name: aquaskyline/Clairvoyante
Commit Name: 3eea3791dc36fbfc521b45b9eebd854c73908b62
Time: 2017-09-13
Author: aquaskyline@gmail.com
File Name: dataPrepScripts/GetTruth.py
Class Name:
Method Name: OutputVariant