예제 #1
0
def test_votes_normalization():
    '''
    Tests if min-max normalization of votes works.
    Note that in a scale of 0-1 the value 0.775 has to be 0.5 (if the initial range is 0.55-1).
    '''
    prot1 = core.Protein(symbol="PROTEIN'\"",
                         positions=[1],
                         sentence=core.Sentence("This is a sentence"))
    prot2 = core.Protein(symbol="PROTEIN2'\"",
                         positions=[2],
                         sentence=core.Sentence("This is a sentence"))
    int_candidate = core.InteractionCandidate(prot1, prot2)
    int_candidate.votes = 0.775
    int_candidate._InteractionCandidate__normalize_pred()
    assert (0.5 == int_candidate.votes)
예제 #2
0
def test_disambiguate():
    '''
    Tests disambuation of protein symbols
    '''
    prot = core.Protein(symbol="PROTEIN'\"",
                        positions=[1],
                        sentence=core.Sentence("This is a sentence"))
    assert (prot.disambiguate() == "PROTEIN")
예제 #3
0
def test_disambiguation_negative():
    '''
    Tests a incorrect disambiguation
    '''
    protname = "tHISISNOTAKNOWNPROTEIn"
    protein = core.Protein(symbol=protname,
                           positions=[1, 2],
                           sentence="placeholder")
    disamb = protein.disambiguate()
    assert (disamb == "THISISNOTAKNOWNPROTEIN")
예제 #4
0
def test_disambiguation_positive():
    '''
    Tests a correct disambiguation
    '''
    protname = "albumin"
    protein = core.Protein(symbol=protname,
                           positions=[1, 2],
                           sentence="placeholder")
    disamb = protein.disambiguate()
    assert (disamb == "ALB")