Esempio n. 1
0
    def test_missing_coverage_different_remap_counts(self):
        sample = Sample(
            MiseqRun(target_path='run1/Results/versionX'), 'sample42',
            SampleFiles(coverage_scores=[{
                'project': 'HCV',
                'region': 'HCV1-E1',
                'seed': 'HCV1-seed',
                'on.score': '2'
            }, {
                'project': 'HCV',
                'region': 'HCV2-E1',
                'seed': 'HCV2-seed',
                'on.score': '3'
            }],
                        remap_counts=[{
                            'type': 'remap-1 HCV1-seed'
                        }, {
                            'type': 'remap-1 HCV2-seed'
                        }]),
            SampleFiles(coverage_scores=[{
                'project': 'HCV',
                'region': 'HCV1-E1',
                'seed': 'HCV1-seed',
                'on.score': '2'
            }],
                        remap_counts=[{
                            'type': 'remap-1 HCV1-seed'
                        }]))
        expected_report = ''
        expected_scenario_counts = {
            Scenarios.REMAP_COUNTS_CHANGED:
            ['  run1:sample42 coverage: HCV HCV2-E1 3 => -\n']
        }

        report, scenario_counts, _ = compare_sample(
            sample, Scenarios.REMAP_COUNTS_CHANGED)

        self.assertEqual(expected_report, report)
        self.assertEqual(expected_scenario_counts, scenario_counts)
Esempio n. 2
0
    def test_remap_counts_ignore_other_seeds(self):
        sample = Sample(
            MiseqRun(target_path='run1/Results/versionX'), 'sample42',
            SampleFiles(coverage_scores=[{
                'project': 'HIV',
                'region': 'PR',
                'seed': 'HIV1-seed',
                'on.score': '3'
            }],
                        remap_counts=[{
                            'type': 'remap-1 HIV1-seed'
                        }, {
                            'type': 'remap-1 HIV2-seed'
                        }, {
                            'type': 'remap-2 HIV2-seed'
                        }]),
            SampleFiles(coverage_scores=[{
                'project': 'HIV',
                'region': 'PR',
                'seed': 'HIV1-seed',
                'on.score': '4'
            }],
                        remap_counts=[{
                            'type': 'remap-1 HIV1-seed'
                        }, {
                            'type': 'remap-2 HIV1-seed'
                        }]))
        expected_report = ''
        expected_scenario_counts = {
            Scenarios.REMAP_COUNTS_CHANGED:
            ['  run1:sample42 coverage: HIV PR 3 => 4\n']
        }

        report, scenario_counts, _ = compare_sample(
            sample, Scenarios.REMAP_COUNTS_CHANGED)

        self.assertEqual(expected_report, report)
        self.assertEqual(expected_scenario_counts, scenario_counts)
    def test_consensus_trailing_change(self):
        source_seqs = {('R1-seed', 'R1', 'MAX'): 'ACTTAC------GTAC'}
        target_seqs = {('R1-seed', 'R1', 'MAX'): 'ACTTAC'}
        sample = Sample(MiseqRun(target_path='run1/Results/versionX'),
                        'sample42', SampleFiles(), SampleFiles())
        expected_diffs = [
            'run1:sample42 consensus: R1-seed R1 MAX', '- ACTTAC------GTAC',
            '+ ACTTAC'
        ]
        expected_consensus_distances = [
            ConsensusDistance(region='R1',
                              cutoff='MAX',
                              distance=4,
                              pct_diff=25)
        ]
        diffs = []
        scenarios = defaultdict(list)

        consensus_distances = compare_consensus(sample, source_seqs,
                                                target_seqs, diffs,
                                                Scenarios.NONE, scenarios)

        self.assertEqual(expected_diffs, diffs)
        self.assertEqual(expected_consensus_distances, consensus_distances)