'Determines whether the file is a Reference Taxonomy
http://www.mothur.org/wiki/Taxonomy_outline
A table with 2 or 3 columns:
- SequenceName
- Taxonomy (semicolon-separated taxonomy in descending order)
- integer ?
Example: 2-column (http://www.mothur.org/wiki/Taxonomy_outline)
X56533.1        Eukaryota;Alveolata;Ciliophora;Intramacronucleata;Oligohymenophorea;Hymenostomatida;Tetrahymenina;Glaucomidae;Glaucoma;
X97975.1        Eukaryota;Parabasalidea;Trichomonada;Trichomonadida;unclassified_Trichomonadida;
AF052717.1      Eukaryota;Parabasalidea;
Example: 3-column (http://vamps.mbl.edu/resources/databases.php)
v3_AA008      Bacteria;Firmicutes;Bacilli;Lactobacillales;Streptococcaceae;Streptococcus      5
v3_AA016      Bacteria        120
v3_AA019      Archaea;Crenarchaeota;Marine_Group_I    1
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname( \'mothur_datatypetest_true.mothur.ref.taxonomy\' )
>>> RefTaxonomy().sniff( fname )
True
>>> fname = get_test_fname( \'mothur_datatypetest_false.mothur.ref.taxonomy\' )
>>> RefTaxonomy().sniff( fname )
False'

def sniff(self, filename):

    headers = iter_headers(filename, sep=' DCTB ', count=300)
    count = 0
    pat_prog = re.compile('^([^     DCTB \n\r\x0c\x0b;]+([(]\\d+[)])?(;[^     DCTB \n\r\x0c\x0b;]+([(]\\d+[)])?)*(;)?)$')
    found_semicolons = False
    for line in headers:
        if ((not line[0].startswith('@')) and (not line[0].startswith('#'))):
            if (not (2 <= len(line) <= 3)):
                return False
            if (not pat_prog.match(line[1])):
                return False
            if ((not found_semicolons) and (line[1].find(';') > (-1))):
                found_semicolons = True
            if (len(line) == 3):
                try:
                    int(line[2])
                except Exception:
                    return False
            count += 1
    if (count > 0):
        return found_semicolons
    return False
