Ejemplo n.º 1
0
def test_best_hit_single_invalid_sequence():
    """
    Check if the sequence is validated if only one sequence is input
    """
    with pytest.raises(KeyError) as kerr:
        scoring_matrix.closest_match("MAAAAG", ["MAAAAO"], PAM70)

    assert (
        repr(kerr.value) ==
        "AminoAcidNotFoundError(\"Scoring matrix does not support scoring for: ('G', 'O')\")"
    )
Ejemplo n.º 2
0
def test_best_hit(matrix, index_best):
    """
    Check if the correct best hit is returned
    """
    best_hit = scoring_matrix.closest_match(HUMAN_INSULIN,
                                            INSULIN_VARIANTS_NO_TIE, matrix)
    assert isinstance(best_hit, str)
    assert best_hit.upper() == INSULIN_VARIANTS_NO_TIE[index_best].upper()
Ejemplo n.º 3
0
def test_best_hit_ties(matrix, to_index):
    """
    Check if multiple best hits are dealt with correctly
    """
    best_hits = scoring_matrix.closest_match(HUMAN_INSULIN,
                                             INSULIN_VARIANTS_TIES, matrix)
    assert isinstance(best_hits, list)
    assert sorted([s.upper() for s in best_hits]) == sorted(
        [s.upper() for s in INSULIN_VARIANTS_TIES[:to_index]])
Ejemplo n.º 4
0
def test_best_hit_none():
    """
    Test if empty query returns a None
    """
    assert scoring_matrix.closest_match("AAA", []) is None