Exemple #1
0
def test_calculate_ani_valid(test_fragment_matches):
    #  check ANI for *valid* test fragment matches
    test_fragment_matches = test_fragment_matches[0:2]
    ani = ra.calculate_ani(test_fragment_matches)
    expected_ani = sum(
        map(
            lambda k: (k['alignment_length'] - k['no_non_identities']) / k[
                'alignment_length'],
            test_fragment_matches)) / len(test_fragment_matches)
    assert ani == expected_ani
Exemple #2
0
def test_calculate_ani_all(test_fragment_matches):
    #  check ANI over all test fragment matches
    ani = ra.calculate_ani(test_fragment_matches)
    valid_dna_fragment_matches = test_fragment_matches[0:2]
    expected_ani = sum(
        map(
            lambda k: (k['alignment_length'] - k['no_non_identities']) / k[
                'alignment_length'],
            valid_dna_fragment_matches)) / len(valid_dna_fragment_matches)
    assert ani == expected_ani
Exemple #3
0
def test_calculate_ani_empty():
    #  check ANI for empty test fragment matches
    ani = ra.calculate_ani([])
    expected_ani = 0.0
    assert ani == expected_ani
Exemple #4
0
def test_calculate_ani_unvalid(test_fragment_matches):
    #  check ANI for *unvalid* test fragment matches
    test_fragment_matches = test_fragment_matches[2:]
    ani = ra.calculate_ani(test_fragment_matches)
    expected_ani = 0.0
    assert ani == expected_ani