Example #1
0
    def test_fastq_to_sequence_collection(self):
        for valid_files, kwargs, components in self.valid_configurations:
            for valid in valid_files:
                for observed_kwargs in kwargs:
                    _drop_kwargs(observed_kwargs, 'seq_num')
                    constructor = observed_kwargs.get('constructor', Sequence)

                    # Can't use partials for this because the read
                    # function below can't operate on partials
                    expected_kwargs = {}
                    if hasattr(constructor, 'lowercase'):
                        expected_kwargs['lowercase'] = 'introns'
                        observed_kwargs['lowercase'] = 'introns'

                    expected = SequenceCollection(
                        [constructor(
                            c[2], metadata={'id': c[0], 'description': c[1]},
                            positional_metadata={'quality': np.array(c[3],
                                                 np.uint8)},
                            **expected_kwargs)
                         for c in components])

                    observed = _fastq_to_sequence_collection(valid,
                                                             **observed_kwargs)
                    self.assertEqual(observed, expected)
Example #2
0
    def test_fastq_to_sequence_collection(self):
        for valid, kwargs, components in self.valid_files:
            for kwarg in kwargs:
                _drop_kwargs(kwarg, 'seq_num')
                constructor = kwarg.get('constructor', BiologicalSequence)
                expected = SequenceCollection(
                    [constructor(c[2], id=c[0], description=c[1], quality=c[3])
                     for c in components])

                observed = _fastq_to_sequence_collection(valid, **kwarg)
                # TODO remove when #656 is resolved
                self.assertEqual(observed, expected)
                for o, e in zip(observed, expected):
                    self.assertTrue(o.equals(e))
Example #3
0
    def test_fastq_to_sequence_collection(self):
        for valid, kwargs, components in self.valid_files:
            for kwarg in kwargs:
                _drop_kwargs(kwarg, 'seq_num')
                constructor = kwarg.get('constructor', BiologicalSequence)
                expected = SequenceCollection([
                    constructor(c[2], id=c[0], description=c[1], quality=c[3])
                    for c in components
                ])

                observed = _fastq_to_sequence_collection(valid, **kwarg)
                # TODO remove when #656 is resolved
                self.assertEqual(observed, expected)
                for o, e in zip(observed, expected):
                    self.assertTrue(o.equals(e))
Example #4
0
    def test_fastq_to_sequence_collection(self):
        for valid_files, kwargs, components in self.valid_configurations:
            for valid in valid_files:
                for kwarg in kwargs:
                    _drop_kwargs(kwarg, 'seq_num')
                    constructor = kwarg.get('constructor', Sequence)
                    expected = SequenceCollection(
                        [constructor(
                            c[2], metadata={'id': c[0], 'description': c[1]},
                            positional_metadata={'quality': np.array(c[3],
                                                 np.uint8)})
                         for c in components])

                    observed = _fastq_to_sequence_collection(valid, **kwarg)
                    self.assertEqual(observed, expected)