Exemplo n.º 1
0
    def test_fastq_itemizer(self):
        'It tests the fasta itemizer'
        fhand = StringIO('@s1\nACTG\n+\n1234\n@s2 desc\nACTG\n+\n4321\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['@s1\n', 'ACTG\n', '+\n', '1234\n'], {}),
                        ('s2', ['@s2 desc\n', 'ACTG\n', '+\n', '4321\n'], {})]

        # Empty line
        fhand = StringIO('@s1\nACTG\n+\n1234\n\n@s2 desc\nACTG\n+\n4321\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['@s1\n', 'ACTG\n', '+\n', '1234\n'], {}),
                        ('s2', ['@s2 desc\n', 'ACTG\n', '+\n', '4321\n'], {})]
        # Empty line
        fhand = StringIO('@s1\nACTG\nATTA\n+\n1234\n1234\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['@s1\n', 'ACTGATTA\n', '+\n',
                                '12341234\n'], {})]
Exemplo n.º 2
0
    def test_fastq_itemizer(self):
        'It tests the fasta itemizer'
        fhand = StringIO('@s1\nACTG\n+\n1234\n@s2 desc\nACTG\n+\n4321\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['@s1\n', 'ACTG\n', '+\n', '1234\n'], {}),
                        ('s2', ['@s2 desc\n', 'ACTG\n', '+\n', '4321\n'], {})]

        # Empty line
        fhand = StringIO('@s1\nACTG\n+\n1234\n\n@s2 desc\nACTG\n+\n4321\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['@s1\n', 'ACTG\n', '+\n', '1234\n'], {}),
                        ('s2', ['@s2 desc\n', 'ACTG\n', '+\n', '4321\n'], {})]
        # Empty line
        fhand = StringIO('@s1\nACTG\nATTA\n+\n1234\n1234\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['@s1\n', 'ACTGATTA\n', '+\n', '12341234\n'],
                         {})]
Exemplo n.º 3
0
    def test_fasta_itemizer(self):
        'It tests the fasta itemizer'
        fhand = StringIO('>s1\nACTG\n>s2 desc\nACTG\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['>s1\n', 'ACTG\n'], {}),
                        ('s2', ['>s2 desc\n', 'ACTG\n'], {})]

        # with several lines
        fhand = StringIO('>s1\nACTG\nGTAC\n>s2 desc\nACTG\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['>s1\n', 'ACTGGTAC\n'], {}),
                        ('s2', ['>s2 desc\n', 'ACTG\n'], {})]

        # With empty lines
        fhand = StringIO('>s1\nACTG\n\n>s2 desc\nACTG\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['>s1\n', 'ACTG\n'], {}),
                        ('s2', ['>s2 desc\n', 'ACTG\n'], {})]
Exemplo n.º 4
0
    def test_fasta_itemizer(self):
        'It tests the fasta itemizer'
        fhand = StringIO('>s1\nACTG\n>s2 desc\nACTG\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['>s1\n', 'ACTG\n'], {}),
                        ('s2', ['>s2 desc\n', 'ACTG\n'], {})]

        # with several lines
        fhand = StringIO('>s1\nACTG\nGTAC\n>s2 desc\nACTG\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['>s1\n', 'ACTGGTAC\n'], {}),
                        ('s2', ['>s2 desc\n', 'ACTG\n'], {})]

        # With empty lines
        fhand = StringIO('>s1\nACTG\n\n>s2 desc\nACTG\n')
        seqs = list(_itemize_fastx(fhand))
        assert seqs == [('s1', ['>s1\n', 'ACTG\n'], {}),
                        ('s2', ['>s2 desc\n', 'ACTG\n'], {})]
Exemplo n.º 5
0
 def test_singleline_itemizer(self):
     fhand = StringIO('@s1\nACTG\n+\n1234\n' * 1100)
     seqs = list(_itemize_fastx(fhand))
     names = [seq[0] for seq in seqs]
     assert len(names) == 1100
     assert len(set([seq[1][1] for seq in seqs])) == 1
Exemplo n.º 6
0
 def test_singleline_itemizer(self):
     fhand = StringIO('@s1\nACTG\n+\n1234\n' * 1100)
     seqs = list(_itemize_fastx(fhand))
     names = [seq[0] for seq in seqs]
     assert len(names) == 1100
     assert len(set([seq[1][1] for seq in seqs])) == 1