def gff3_verifier(entries, line=None):
    """Raises error if invalid GFF3 format detected

    Args:
        entries (list): A list of GFF3Entry instances

        line (int): Line number of first entry

    Raises:
        FormatError: Error when GFF3 format incorrect with descriptive message
    """

    regex = r'^[a-zA-Z0-9.:^*$@!+_?-|]+\t.+\t.+\t\d+\t\d+\t' \
            + r'\d*\.?\d*\t[+-.]\t[.0-2]\t.+{0}$'.format(os.linesep)
    delimiter = r'\t'

    for entry in entries:
        try:
            entry_verifier([entry.write()], regex, delimiter)
        except FormatError as error:
            # Format info on what entry error came from
            if line:
                intro = 'Line {0}'.format(str(line))
            elif error.part == 0:
                intro = 'Entry with source {0}'.format(entry.source)
            else:
                intro = 'Entry with Sequence ID {0}'.format(entry.seqid)

            # Generate error
            if error.part == 0:
                msg = '{0} has no Sequence ID'.format(intro)
            elif error.part == 1:
                msg = '{0} has no source'.format(intro)
            elif error.part == 2:
                msg = '{0} has non-numerical characters in type'.format(intro)
            elif error.part == 3:
                msg = '{0} has non-numerical characters in ' \
                      'start position'.format(intro)
            elif error.part == 4:
                msg = '{0} has non-numerical characters in ' \
                      'end position'.format(intro)
            elif error.part == 5:
                msg = '{0} has non-numerical characters in score'.format(intro)
            elif error.part == 6:
                msg = '{0} strand not in [+-.]'.format(intro)
            elif error.part == 7:
                msg = '{0} phase not in [.0-2]'.format(intro)
            elif error.part == 8:
                msg = '{0} has no attributes'.format(intro)
            else:
                msg = 'Unknown Error: Likely a Bug'
            raise FormatError(message=msg)

        if line:
            line += 1
def gff3_verifier ( entries , line = None ) : regex = r'^[a-zA-Z0-9.:^*$@!+_?-|]+\t.+\t.+\t\d+\t\d+\t' + r'\d*\.?\d*\t[+-.]\t[.0-2]\t.+{0}$' . format ( os . linesep ) delimiter = r'\t' for entry in entries : try : entry_verifier ( [ entry . write ( ) ] , regex , delimiter ) except FormatError as error : if line : intro = 'Line {0}' . format ( str ( line ) ) elif error . part == 0 : intro = 'Entry with source {0}' . format ( entry . source ) else : intro = 'Entry with Sequence ID {0}' . format ( entry . seqid ) if error . part == 0 : msg = '{0} has no Sequence ID' . format ( intro ) elif error . part == 1 : msg = '{0} has no source' . format ( intro ) elif error . part == 2 : msg = '{0} has non-numerical characters in type' . format ( intro ) elif error . part == 3 : msg = '{0} has non-numerical characters in ' 'start position' . format ( intro ) elif error . part == 4 : msg = '{0} has non-numerical characters in ' 'end position' . format ( intro ) elif error . part == 5 : msg = '{0} has non-numerical characters in score' . format ( intro ) elif error . part == 6 : msg = '{0} strand not in [+-.]' . format ( intro ) elif error . part == 7 : msg = '{0} phase not in [.0-2]' . format ( intro ) elif error . part == 8 : msg = '{0} has no attributes' . format ( intro ) else : msg = 'Unknown Error: Likely a Bug' raise FormatError ( message = msg ) if line : line += 1
Raises error if invalid GFF3 format detected

    Args:
        entries (list): A list of GFF3Entry instances

        line (int): Line number of first entry

    Raises:
        FormatError: Error when GFF3 format incorrect with descriptive message