'Determines whether the file is in generic fastq format
For details, see http://maq.sourceforge.net/fastq.shtml
Note: There are three kinds of FASTQ files, known as "Sanger" (sometimes called "Standard"), Solexa, and Illumina
These differ in the representation of the quality scores
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname( \'1.fastqsanger\' )
>>> FastqSanger().sniff( fname )
True
>>> fname = get_test_fname( \'2.fastqsanger\' )
>>> FastqSanger().sniff( fname )
True
>>> fname = get_test_fname( \'2.fastq\' )
>>> Fastq().sniff( fname )
True
>>> FastqSanger().sniff( fname )
False'

def sniff(self, filename):

    compressed = (is_gzip(filename) or is_bz2(filename))
    if (compressed and (not isinstance(self, Binary))):
        return False
    headers = iter_headers(filename, None, count=1000)
    if (isinstance(self, FastqSanger) or isinstance(self, FastqSangerGz) or isinstance(self, FastqSangerBz2)):
        if (not self.sangerQualities(headers)):
            return False
    bases_regexp = re.compile('^[NGTAC]*')
    try:
        headers = get_headers(filename, None, count=4)
        if ((len(headers) == 4) and headers[0][0] and (headers[0][0][0] == '@') and headers[2][0] and (headers[2][0][0] == '+') and headers[1][0]):
            if (not bases_regexp.match(headers[1][0])):
                return False
            return True
        return False
    except:
        return False
