'The use of ESTScan implies the creation of scores matrices which
reflect the codons preferences in the studied organisms.  The
ESTScan package includes scripts for generating these files.  The
output of these scripts consists of the matrices, one for each
isochor, and which look like this:
FORMAT: hse_4is.conf CODING REGION 6 3 1 s C+G: 0 44
-1 0 2 -2
2 1 -8 0
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname(\'test_space.txt\')
>>> Smat().sniff(fname)
False
>>> fname = get_test_fname(\'test_tab.bed\')
>>> Smat().sniff(fname)
False
>>> fname = get_test_fname(\'1.smat\')
>>> Smat().sniff(fname)
True'

def sniff(self, filename):

    line_no = 0
    with open(filename, 'r') as fh:
        for line in fh:
            line_no += 1
            if (line_no > 10000):
                return True
            if ((line_no == 1) and (not line.startswith('FORMAT'))):
                return False
            if (not line.startswith('FORMAT')):
                if (line.find(' DCTB ') >= 0):
                    return False
                items = line.split()
                if (len(items) != 4):
                    return False
                for item in items:
                    if (re.match('[-+]?\\d+$', item) is None):
                        return False
    return True
