Esempio n. 1
0
                other_type_calls += 1
                continue
            calls_gte_threshold.append(line)

    bed_lines = []
    for line in calls_gte_threshold:
        fields = line.split("\t")
        # need to strip off the "chr"
        chrom = fields[1][3:len(fields[1])]
        if (int(fields[2]) > int(fields[3])):
            sys.stderr.write("warning, start is greater than end: " + "\t".join([chrom, fields[2], fields[3]]) + "\n")
            continue
        if (sv_type == "DEL"):
            bed_line = "\t".join([chrom, fields[2], fields[3]])
        else:
            bed_line = "\t".join([chrom, fields[2], fields[3], str(abs(int(float(fields[6]))))])
        bed_lines.append(bed_line)

    if print_bed:
        print "\n".join(bed_lines)
        sys.exit(0)
    if (sv_type == "DEL"):
        (qualified_calls, matches, short_calls) = evalBedFile.eval_bed_deletions(truth_filename, bed_lines, print_hits)
    else:
        (qualified_calls, matches, short_calls) = evalBedFile.eval_bed_insertions(truth_filename, bed_lines, print_hits)
    tpr = float(matches) / (qualified_calls)
    if not print_hits:
        print "\t".join(map(str, [v, qualified_calls, matches, other_type_calls, short_calls, tpr]))


Esempio n. 2
0
        pindel_file = open(pindel_long_insertions_filename, "r")
        for line in pindel_file:
            fields = line.split()
            if len(fields) < 2 or fields[1] != "LI":
                continue
            if float(fields[6]) * float(fields[9]) >= v:
                chrom = fields[3]
                ostart = fields[4]
                oend = fields[7]
                length = "100"
                bed_line = "\t".join([chrom, ostart, oend, length])
                #print bed_line.strip()
                calls_gte_threshold.append(bed_line)
        pindel_file.close()
    if print_bed:
        print "\n".join(calls_gte_threshold)
        continue

    if sv_type == "DEL":
        (qualified_calls, matches, short_calls) = evalBedFile.eval_bed_deletions(truth_filename, calls_gte_threshold, print_hits)
    else:
        (qualified_calls, matches, short_calls) = evalBedFile.eval_bed_insertions(truth_filename, calls_gte_threshold, print_hits)
    if (qualified_calls > 0):
        tpr = float(matches) / (qualified_calls)
    else:
        tpr = "NA"
    if not print_hits:
        print "\t".join(map(str, [v, qualified_calls, matches, 0, short_calls, tpr]))