コード例 #1
0
def parse_breakend(record1, record2, datahub):
    result1 = _parse_breakend(record1)

    result2 = _parse_breakend(record2)
    if not (result1["chrom"] == result2["other_chrom"]
            and result1["pos"] == result2["other_pos"]):
        print(result1)
        print(result2)
        logger.error(
            "Malformed VCF: breakends do not appear to match:\n{}\n{}".format(
                record1, record2))
        return None

    if result1["chrom"] == result1["other_chrom"] and \
            abs(result1["pos"]-result1["other_pos"]) < datahub.align_distance*5:
        logger.error("Can't yet handle nearby breakends; skipping")
        return None

    # convert from 1-based to 0-based coordinates
    breakpoint1 = Locus(result1["chrom"], result1["pos"] - 1,
                        result1["pos"] - 1, result1["orientation"][0])
    breakpoint2 = Locus(result1["other_chrom"], result1["other_pos"] - 1,
                        result1["other_pos"] - 1, result1["orientation"][1])

    # print(breakpoint1, breakpoint2)
    return variants.Breakend(breakpoint1, breakpoint2, datahub, result1["id"])
コード例 #2
0
def get_translocation(record, datahub):
    breakpoint1 = Locus(record.chrom, record.start, record.start, "+")
    breakpoint2 = Locus(record.info["CHR2"], record.end, record.end,
                        "+" if record.info["STRAND"] == "+" else "-")

    variants.Breakend(breakpoint1, breakpoint2, datahub, record.id)

    raise NotImplementedError()