'Determines whether the file is a secondary structure map format
A single column with an integer value which indicates the row that this
row maps to. Check to make sure if structMap[10] = 380 then
structMap[380] = 10 and vice versa.
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname( \'mothur_datatypetest_true.mothur.map\' )
>>> SecondaryStructureMap().sniff( fname )
True
>>> fname = get_test_fname( \'mothur_datatypetest_false.mothur.map\' )
>>> SecondaryStructureMap().sniff( fname )
False'

def sniff(self, filename):

    headers = iter_headers(filename, sep=' DCTB ')
    line_num = 0
    rowidxmap = {}
    for line in headers:
        line_num += 1
        if (len(line) > 1):
            return False
        try:
            pointer = int(line[0])
            if (pointer > line_num):
                rowidxmap[pointer] = line_num
            elif ((pointer > 0) or (line_num in rowidxmap)):
                if (rowidxmap[line_num] != pointer):
                    return False
        except (ValueError, KeyError):
            return False
    if (line_num < 3):
        return False
    return True
