Пример #1
0
    def test_very_big_diff(self):
        source_sequences = {
            'R1':
            'LOREMIPSUMDOLORSITAMETCONSECTETURADIPISCINGELITCRASMOLESTIE'
            'ODIOVELMAXIMUSELEMENTUMMASSAPURUSFRINGILLALIGULANONSUSCIPIT'
            'FELISDUIUTLACUS' * 3
        }
        new_sequence = source_sequences['R1']
        new_sequence = new_sequence[:10] + 'CETUS' + new_sequence[15:]
        project_config = self.build_config({'P-A-KX-R1-seed': new_sequence})
        expected_report = """\
ERROR: changed references:
P-A-KX-R1-seed
- LOREMIPSUMDOLORSITAMETCONSECTETURADIPISCINGELITCRASMOLESTIEODIOVE
?           ^^^^^
+ LOREMIPSUMCETUSSITAMETCONSECTETURADIPISCINGELITCRASMOLESTIEODIOVE
?           ^^^^^
  LMAXIMUSELEMENTUMMAS[244 matching characters]VELMAXIMUSELEMENTUMM
  ASSAPURUSFRINGILLALIGULANONSUSCIPITFELISDUIUTLACUS

"""

        report, error_count = compare_config(['P-A-KX-R1-seed'],
                                             project_config,
                                             source_sequences,
                                             name_part=3)

        assert expected_report == report
        assert 1 == error_count
Пример #2
0
    def test_match(self):
        sequences = {'R1': 'ACTGATA'}
        project_config = self.build_config('PROJ1',
                                           {'P-A-KX-R1-seed': 'ACTGATA'})
        expected_report = """\
P-A-KX-R1-seed
==

0 differences
"""

        report = ''.join(compare_config('PROJ1', project_config, sequences))

        self.assertEqual(expected_report, report)
Пример #3
0
    def test_match(self):
        sequences = {'KX1234': 'ACTGATA'}  # {accession_num: seq}
        project_config = self.build_config({'P-A-KX-KX1234-seed': 'ACTGATA'})
        expected_report = """\
Matching references: P-A-KX-KX1234-seed
"""

        report, error_count = compare_config(['P-A-KX-KX1234-seed'],
                                             project_config,
                                             sequences,
                                             name_part=3)

        assert expected_report == report
        assert 0 == error_count
Пример #4
0
    def test_dashes(self):
        sequences = {'R1': 'ACT---GATT'}
        project_config = self.build_config({'P-A-KX-R1-seed': 'ACTGATT'})
        expected_report = """\
Matching references: P-A-KX-R1-seed
"""

        report, error_count = compare_config(['P-A-KX-R1-seed'],
                                             project_config,
                                             sequences,
                                             name_part=3)

        assert expected_report == report
        assert 0 == error_count
Пример #5
0
    def test(self):
        sequences = {'R1': 'ACTGATT'}
        project_config = self.build_config('PROJ1',
                                           {'P-A-KX-R1-seed': 'ACTGATT',
                                            'P-A-KY-R2-seed': 'TTT'})
        expected_report = """\
P-A-KX-R1-seed
==

P-A-KY-R2-seed
missing

1 differences
"""

        report = ''.join(compare_config('PROJ1', project_config, sequences))

        self.assertEqual(expected_report, report)
Пример #6
0
    def test_missing_from_source(self):
        sequences = {'R1': 'ACTGATT'}
        project_config = self.build_config({
            'P-A-KX-R1-seed': 'ACTGATT',
            'P-A-KY-R2-seed': 'TTT'
        })
        expected_report = """\
Matching references: P-A-KX-R1-seed
ERROR: references missing from source: P-A-KY-R2-seed
"""

        report, error_count = compare_config(
            ['P-A-KX-R1-seed', 'P-A-KY-R2-seed'],
            project_config,
            sequences,
            name_part=3)

        assert expected_report == report
        assert 1 == error_count
Пример #7
0
    def test_diff(self):
        source_sequences = {'R1': 'ACTGATT'}
        project_config = self.build_config({'P-A-KX-R1-seed': 'ACTGATA'})
        expected_report = """\
ERROR: changed references:
P-A-KX-R1-seed
- ACTGATT
?       ^
+ ACTGATA
?       ^

"""

        report, error_count = compare_config(['P-A-KX-R1-seed'],
                                             project_config,
                                             source_sequences,
                                             name_part=3)

        assert expected_report == report
        assert 1 == error_count
Пример #8
0
    def test_many_matches(self):
        sequences = {'R1': 'ACTGATT', 'R2': 'TTT', 'R3': 'A', 'R4': 'A'}
        project_config = self.build_config({
            'P-A-KX-R1-seed': 'ACTGATT',
            'P-A-KY-R2-seed': 'TTT',
            'P-A-KY-R3-seed': 'A',
            'P-A-KY-R4-seed': 'A'
        })
        expected_report = """\
Matching references: P-A-KX-R1-seed, P-A-KY-R2-seed, P-A-KY-R3-seed,
P-A-KY-R4-seed
"""

        report, error_count = compare_config([
            'P-A-KX-R1-seed', 'P-A-KY-R2-seed', 'P-A-KY-R3-seed',
            'P-A-KY-R4-seed'
        ],
                                             project_config,
                                             sequences,
                                             name_part=3)

        assert expected_report == report
        assert 0 == error_count