def test_calculate_conserved_dna_unvalid(test_fragment_matches): # check conDNA for *unvalid* test fragment matches test_fragment_matches = test_fragment_matches[2:] conserved_dna = ra.calculate_conserved_dna( {k['id']: k for k in test_fragment_matches}, test_fragment_matches) expected_conserved_dna = 0.0 assert conserved_dna == expected_conserved_dna
def test_calculate_conserved_dna_valid(test_fragment_matches): # check conDNA for *valid* test fragment matches test_fragment_matches = test_fragment_matches[0:2] conserved_dna = ra.calculate_conserved_dna( {k['id']: k for k in test_fragment_matches}, test_fragment_matches) expected_conserved_dna = sum( map(lambda k: k['alignment_length'], test_fragment_matches)) / sum( map(lambda k: k['length'], test_fragment_matches)) assert conserved_dna == expected_conserved_dna
def test_calculate_conserved_dna_empty(): # check conDNA for empty test fragment matches conserved_dna = ra.calculate_conserved_dna({}, []) expected_conserved_dna = 0.0 assert conserved_dna == expected_conserved_dna