"NA:i:4\tNH:i:4",
              "NA:i:4\tNH:i:4",
              "NA:i:4\tNH:i:4",
              "NA:i:4\tNH:i:4"]

    Read.process_set_sam_tag(sample, count_tag=True, tag_regex='NA:i:(\d+)')
    Read.process_set_sam_tag(sample, count_tag=True, tag_regex='NH:i:(\d+)')


def test_build_positions():
    for test in cigar_string:
        yield (check_build_positions, test, cigar_string[test])


def check_build_positions(test, (values, expected)):
    position_array = Read.build_positions(*values)
    test_description = "\nTest:    \t{}\n".format(test)
    test_description += "Expected:\t{}\n".format(expected)
    test_description += "Position:\t{}\n".format(position_array)
    assert position_array == expected, "{}Error:   \tDid not create the expected position array.".format(
        test_description)


def test_catch_bad_cigar_input():
    for test in bad_cigar_string:
        yield (check_catch_bad_cigar_input, test, bad_cigar_string[test])


@raises(MetageneError)
def check_catch_bad_cigar_input(test, (values, expected)):
    print Read.build_positions(*values)
Example #2
0
        "NA:i:4\tNH:i:4", "NA:i:4\tNH:i:4", "NA:i:4\tNH:i:4", "NA:i:4\tNH:i:4",
        "NA:i:4\tNH:i:4", "NA:i:4\tNH:i:4", "NA:i:4\tNH:i:4", "NA:i:4\tNH:i:4",
        "NA:i:4\tNH:i:4", "NA:i:4\tNH:i:4"
    ]

    Read.process_set_sam_tag(sample, count_tag=True, tag_regex='NA:i:(\d+)')
    Read.process_set_sam_tag(sample, count_tag=True, tag_regex='NH:i:(\d+)')


def test_build_positions():
    for test in cigar_string:
        yield (check_build_positions, test, cigar_string[test])


def check_build_positions(test, (values, expected)):
    position_array = Read.build_positions(*values)
    test_description = "\nTest:    \t{}\n".format(test)
    test_description += "Expected:\t{}\n".format(expected)
    test_description += "Position:\t{}\n".format(position_array)
    assert position_array == expected, "{}Error:   \tDid not create the expected position array.".format(
        test_description)


def test_catch_bad_cigar_input():
    for test in bad_cigar_string:
        yield (check_catch_bad_cigar_input, test, bad_cigar_string[test])


@raises(MetageneError)
def check_catch_bad_cigar_input(test, (values, expected)):
    print Read.build_positions(*values)