Exemple #1
0
 def setUp(self):
     self.empty = ProteinSequence('')
     self.p1 = ProteinSequence('GREG')
     self.p2 = ProteinSequence('PRTEINSEQNCE',
                               id="test-seq-2",
                               description="A test sequence")
     self.p3 = ProteinSequence('PROTEIN',
                               id="bad-seq-1",
                               description="Not a protein sequence")
Exemple #2
0
    def test_alignment_to_fastq_kwargs_passed(self):
        for components, kwargs_expected_fp in self.valid_files:
            for kwargs, expected_fp in kwargs_expected_fp:
                obj = Alignment([
                    ProteinSequence(c[2],
                                    id=c[0],
                                    description=c[1],
                                    quality=c[3]) for c in components
                ])

                fh = StringIO()
                _alignment_to_fastq(obj, fh, **kwargs)
                observed = fh.getvalue()
                fh.close()

                with open(expected_fp, 'U') as f:
                    expected = f.read()

                self.assertEqual(observed, expected)
Exemple #3
0
 def test_nondegenerates(self):
     exp = [ProteinSequence('AD'), ProteinSequence('AN')]
     # Sort based on sequence string, as order is not guaranteed.
     obs = sorted(ProteinSequence('AB').nondegenerates(), key=str)
     self.assertEqual(obs, exp)