# Path: crumbs/utils/optional_modules.py
# MSG = 'A python package to run this executable is required,'
# BIO = 'biopython'
# BIO_BGZF = 'biopython with Bgzf support'
#     NCBIXML = create_fake_class(MSG + BIO)
#     NCBIWWW = create_fake_class(MSG + BIO)
# def create_fake_class(msg):
#         def __init__(self, *args, **kwargs):
# def create_fake_funct(msg):
#     def FakeRequiredfunct(*args, **kwargs):
#     class FakePythonRequiredClass(object):
# 
# Path: crumbs/utils/tags.py
# SEQITEM = 'seqitem'
# 
# SEQRECORD = 'seqrecord'
# 
# ILLUMINA_QUALITY = 'fastq-illumina'
# 
# SANGER_QUALITY = 'fastq'
# 
# SANGER_FASTQ_FORMATS = ('fastq-sanger', 'fastq')
# 
# ILLUMINA_FASTQ_FORMATS = ('fastq-illumina',)


from copy import deepcopy
from collections import namedtuple
from crumbs.utils.optional_modules import SeqRecord
from crumbs.utils.tags import (SEQITEM, SEQRECORD, ILLUMINA_QUALITY,
                               SANGER_QUALITY, SANGER_FASTQ_FORMATS,
                               ILLUMINA_FASTQ_FORMATS)
        elif 'fastq' in fmt:
            lines = [lines[0], seq + '\n', lines[2], lines[3]]
            if len(lines[1]) != len(lines[3]):
                msg = 'Sequence and quality line length do not match'
                raise ValueError(msg)
        else:
            raise RuntimeError('Unknown format for a SequenceItem')

    if name:
        # name title line
        lines[0] = lines[0][0] + name + '\n'
        # change + line in case has the name in it.
        if 'fastq' in fmt:
            lines[2] = '+\n'
    name = seq_item.name if name is None else name

    annotations = seq_item.annotations
    if annotations is not None:
        annotations = annotations.copy()
    seq = SeqWrapper(kind=seqwrapper.kind,
                     object=SeqItem(name, lines, annotations),
                     file_format=fmt)
    return seq


def copy_seq(seqwrapper, seq=None, name=None):
    seq_class = seqwrapper.kind
    seq_obj = seqwrapper.object
    if seq_class == SEQITEM:
        seq = _copy_seqitem(seqwrapper, seq=seq, name=name)

# Path: crumbs/utils/optional_modules.py
# MSG = 'A python package to run this executable is required,'
# BIO = 'biopython'
# BIO_BGZF = 'biopython with Bgzf support'
#     NCBIXML = create_fake_class(MSG + BIO)
#     NCBIWWW = create_fake_class(MSG + BIO)
# def create_fake_class(msg):
#         def __init__(self, *args, **kwargs):
# def create_fake_funct(msg):
#     def FakeRequiredfunct(*args, **kwargs):
#     class FakePythonRequiredClass(object):
# 
# Path: crumbs/utils/tags.py
# SEQITEM = 'seqitem'
# 
# SEQRECORD = 'seqrecord'
# 
# ILLUMINA_QUALITY = 'fastq-illumina'
# 
# SANGER_QUALITY = 'fastq'
# 
# SANGER_FASTQ_FORMATS = ('fastq-sanger', 'fastq')
# 
# ILLUMINA_FASTQ_FORMATS = ('fastq-illumina',)


# Path: crumbs/seq/seq.py
from copy import deepcopy
from collections import namedtuple
from crumbs.utils.optional_modules import SeqRecord
from crumbs.utils.tags import (SEQITEM, SEQRECORD, ILLUMINA_QUALITY,
                               SANGER_QUALITY, SANGER_FASTQ_FORMATS,
                               ILLUMINA_FASTQ_FORMATS)

        elif 'fastq' in fmt:
            lines = [lines[0], seq + '\n', lines[2], lines[3]]
            if len(lines[1]) != len(lines[3]):
                msg = 'Sequence and quality line length do not match'
                raise ValueError(msg)
        else:
            raise RuntimeError('Unknown format for a SequenceItem')

    if name:
        # name title line
        lines[0] = lines[0][0] + name + '\n'
        # change + line in case has the name in it.
        if 'fastq' in fmt:
            lines[2] = '+\n'
    name = seq_item.name if name is None else name

    annotations = seq_item.annotations
    if annotations is not None:
        annotations = annotations.copy()
    seq = SeqWrapper(kind=seqwrapper.kind,
                     object=SeqItem(name, lines, annotations),
                     file_format=fmt)
    return seq


def copy_seq(seqwrapper, seq=None, name=None):
    seq_class = seqwrapper.kind
    seq_obj = seqwrapper.object
    if seq_class == SEQITEM:
        seq = _copy_seqitem(seqwrapper, seq=seq, name=name)

    elif seq_class == SEQRECORD: