'The ConnectivityTable (CT) is a file format used for describing
RNA 2D structures by tools including MFOLD, UNAFOLD and
the RNAStructure package. The tabular file format is defined as
follows::
5   energy = -12.3  sequence name
1   G       0       2       0       1
2   A       1       3       0       2
3   A       2       4       0       3
4   A       3       5       0       4
5   C       4       6       1       5
The links given at the edam ontology page do not indicate what
type of separator is used (space or tab) while different
implementations exist. The implementation that uses spaces as
separator (implemented in RNAStructure) is as follows::
10    ENERGY = -34.8  seqname
1 G       0    2    9    1
2 G       1    3    8    2
3 G       2    4    7    3
4 a       3    5    0    4
5 a       4    6    0    5
6 a       5    7    0    6
7 C       6    8    3    7
8 C       7    9    2    8
9 C       8   10    1    9
10 a       9    0    0   10'

def sniff(self, filename):

    i = 0
    j = 1
    try:
        with open(filename) as handle:
            for line in handle:
                line = line.strip()
                if (len(line) > 0):
                    if (i == 0):
                        if (not self.header_regexp.match(line)):
                            return False
                        else:
                            length = int(re.split('\\W+', line, 1)[0])
                    elif (not self.structure_regexp.match(line.upper())):
                        return False
                    elif (j != int(re.split('\\W+', line, 1)[0])):
                        return False
                    elif (j == length):
                        return True
                    else:
                        j += 1
                    i += 1
        return False
    except:
        return False
