# Path: crumbs/seq/seq.py
# class SeqItem(_SeqItem):
#     def __new__(cls, name, lines, annotations=None):
# def get_title(seq):
# def get_description(seq):
# def get_name(seq):
# def get_file_format(seq):
# def _break():
# def _is_fastq_plus_line(line, seq_name):
# def _get_seqitem_quals(seq):
# def get_str_seq(seq):
# def get_length(seq):
# def _get_seqitem_qualities(seqwrap):
# def get_int_qualities(seq):
# def _int_quals_to_str_quals(int_quals, out_format):
# def get_str_qualities(seq, out_format=None):
# def get_annotations(seq):
# def _copy_seqrecord(seqrec, seq=None, name=None, id_=None):
# def _copy_seqitem(seqwrapper, seq=None, name=None):
# def copy_seq(seqwrapper, seq=None, name=None):
# def _slice_seqitem(seqwrap, start, stop):
# def slice_seq(seq, start=None, stop=None):
# def assing_kind_to_seqs(kind, seqs, file_format):
# SANGER_QUALS = {chr(i): i - 33 for i in range(33, 127)}
# ILLUMINA_QUALS = {chr(i): i - 64 for i in range(64, 127)}
# SANGER_STRS = {i - 33: chr(i)  for i in range(33, 127)}
# ILLUMINA_STRS = {i - 64: chr(i) for i in range(64, 127)}
# 
# Path: crumbs/utils/tags.py
# SEQITEM = 'seqitem'
# 
# ILLUMINA_QUALITY = 'fastq-illumina'


import unittest
from crumbs.seq.seq import (get_length, get_str_seq, get_int_qualities,
                            get_str_qualities, slice_seq, copy_seq, SeqItem,
                            SeqWrapper)
from crumbs.utils.tags import SEQITEM, ILLUMINA_QUALITY
        seq = SeqItem(name='seq',
                      lines=['@seq\n', 'aaaa\n', '+\n', '!???\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq')
        assert list(get_int_qualities(seq)) == [0, 30, 30, 30]

        seq = SeqItem(name='seq', lines=['@seq\n', 'aaaaaaaa\n', '+\n',
                                         '@AAABBBB\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq-illumina')
        assert list(get_int_qualities(seq)) == [0, 1, 1, 1, 2, 2, 2, 2]

    def test_str_qualities(self):
        # with fasta
        seq = SeqItem(name='s1', lines=['>s1\n', 'ACTG\n', 'GTAC\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fasta')
        try:
            assert get_str_qualities(seq, 'fasta')
            self.fail('ValueError expected')
        except ValueError:
            pass

        # with fastq
        seq = SeqItem(name='seq',
                      lines=['@seq\n', 'aaaa\n', '+\n', '!???\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq')
        assert get_str_qualities(seq) == '!???'

        # with fastq to fastq-illumina
        seq = SeqItem(name='seq',
                      lines=['@seq\n', 'aaaa\n', '+\n', '!???\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq')

# Path: crumbs/seq/seq.py
# class SeqItem(_SeqItem):
#     def __new__(cls, name, lines, annotations=None):
# def get_title(seq):
# def get_description(seq):
# def get_name(seq):
# def get_file_format(seq):
# def _break():
# def _is_fastq_plus_line(line, seq_name):
# def _get_seqitem_quals(seq):
# def get_str_seq(seq):
# def get_length(seq):
# def _get_seqitem_qualities(seqwrap):
# def get_int_qualities(seq):
# def _int_quals_to_str_quals(int_quals, out_format):
# def get_str_qualities(seq, out_format=None):
# def get_annotations(seq):
# def _copy_seqrecord(seqrec, seq=None, name=None, id_=None):
# def _copy_seqitem(seqwrapper, seq=None, name=None):
# def copy_seq(seqwrapper, seq=None, name=None):
# def _slice_seqitem(seqwrap, start, stop):
# def slice_seq(seq, start=None, stop=None):
# def assing_kind_to_seqs(kind, seqs, file_format):
# SANGER_QUALS = {chr(i): i - 33 for i in range(33, 127)}
# ILLUMINA_QUALS = {chr(i): i - 64 for i in range(64, 127)}
# SANGER_STRS = {i - 33: chr(i)  for i in range(33, 127)}
# ILLUMINA_STRS = {i - 64: chr(i) for i in range(64, 127)}
# 
# Path: crumbs/utils/tags.py
# SEQITEM = 'seqitem'
# 
# ILLUMINA_QUALITY = 'fastq-illumina'


# Path: test/seq/test_seq.py
import unittest
from crumbs.seq.seq import (get_length, get_str_seq, get_int_qualities,
                            get_str_qualities, slice_seq, copy_seq, SeqItem,
                            SeqWrapper)
from crumbs.utils.tags import SEQITEM, ILLUMINA_QUALITY

        seq = SeqItem(name='seq',
                      lines=['@seq\n', 'aaaa\n', '+\n', '!???\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq')
        assert list(get_int_qualities(seq)) == [0, 30, 30, 30]

        seq = SeqItem(name='seq', lines=['@seq\n', 'aaaaaaaa\n', '+\n',
                                         '@AAABBBB\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq-illumina')
        assert list(get_int_qualities(seq)) == [0, 1, 1, 1, 2, 2, 2, 2]

    def test_str_qualities(self):
        # with fasta
        seq = SeqItem(name='s1', lines=['>s1\n', 'ACTG\n', 'GTAC\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fasta')
        try:
            assert get_str_qualities(seq, 'fasta')
            self.fail('ValueError expected')
        except ValueError:
            pass

        # with fastq
        seq = SeqItem(name='seq',
                      lines=['@seq\n', 'aaaa\n', '+\n', '!???\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq')
        assert get_str_qualities(seq) == '!???'

        # with fastq to fastq-illumina
        seq = SeqItem(name='seq',
                      lines=['@seq\n', 'aaaa\n', '+\n', '!???\n'])
        seq = SeqWrapper(SEQITEM, seq, 'fastq')

        assert get_str_qualities(seq, ILLUMINA_QUALITY) == '@^^^'