'Determines whether the file is in GFF version 3 format
GFF 3 format:
1) adds a mechanism for representing more than one level
of hierarchical grouping of features and subfeatures.
2) separates the ideas of group membership and feature name/id
3) constrains the feature type field to be taken from a controlled
vocabulary.
4) allows a single feature, such as an exon, to belong to more than
one group at a time.
5) provides an explicit convention for pairwise alignments
6) provides an explicit convention for features that occupy disjunct regions
The format consists of 9 columns, separated by tabs (NOT spaces).
Undefined fields are replaced with the "." character, as described in the original GFF spec.
For complete details see http://song.sourceforge.net/gff3.shtml
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname( \'test.gff\' )
>>> Gff3().sniff( fname )
False
>>> fname = get_test_fname( \'test.gtf\' )
>>> Gff3().sniff( fname )
False
>>> fname = get_test_fname(\'gff_version_3.gff\')
>>> Gff3().sniff( fname )
True'

def sniff(self, filename):

    if (len(get_headers(filename, ' DCTB ', count=2)) < 2):
        return False
    try:
        headers = iter_headers(filename, ' DCTB ')
        for hdr in headers:
            if (hdr and hdr[0].startswith('##gff-version') and (hdr[0].find('3') >= 0)):
                return True
            elif (hdr and hdr[0].startswith('##gff-version') and (hdr[0].find('3') < 0)):
                return False
            if (hdr and hdr[0] and (not hdr[0].startswith('#'))):
                if (len(hdr) != 9):
                    return False
                try:
                    int(hdr[3])
                except:
                    if (hdr[3] != '.'):
                        return False
                try:
                    int(hdr[4])
                except:
                    if (hdr[4] != '.'):
                        return False
                if (hdr[5] != '.'):
                    try:
                        float(hdr[5])
                    except:
                        return False
                if (hdr[6] not in self.valid_gff3_strand):
                    return False
                if (hdr[7] not in self.valid_gff3_phase):
                    return False
                parse_gff3_attributes(hdr[8])
        return True
    except:
        return False
