'Determines whether the file is blastxml
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname(\'megablast_xml_parser_test1.blastxml\')
>>> BlastXml().sniff(fname)
True
>>> fname = get_test_fname(\'tblastn_four_human_vs_rhodopsin.xml\')
>>> BlastXml().sniff(fname)
True
>>> fname = get_test_fname(\'interval.interval\')
>>> BlastXml().sniff(fname)
False'

def sniff(self, filename):

    handle = open(filename)
    line = handle.readline()
    if (line.strip() != '<?xml    version="1.0"?>'):
        handle.close()
        return False
    line = handle.readline()
    if (line.strip() not in ['<!DOCTYPE    BlastOutput    PUBLIC    "-//NCBI//NCBI    BlastOutput/EN"    "http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd">', '<!DOCTYPE    BlastOutput    PUBLIC    "-//NCBI//NCBI    BlastOutput/EN"    "NCBI_BlastOutput.dtd">']):
        handle.close()
        return False
    line = handle.readline()
    if (line.strip() != '<BlastOutput>'):
        handle.close()
        return False
    handle.close()
    return True
