'Tries to guess from the line the location number of the column for the chromosome, region start-end and strand'

def set_meta(self, dataset, overwrite=True, first_line_is_header=False, **kwd):

    Tabular.set_meta(self, dataset, overwrite=overwrite, skip=0)
    if dataset.has_data():
        empty_line_count = 0
        num_check_lines = 100
        for (i, line) in enumerate(open(dataset.file_name)):
            line = line.rstrip('\r\n')
            if line:
                if (first_line_is_header or (line[0] == '#')):
                    self.init_meta(dataset)
                    line = line.strip('#')
                    elems = line.split(' DCTB ')
                    for (meta_name, header_list) in alias_spec.items():
                        for header_val in header_list:
                            if (header_val in elems):
                                setattr(dataset.metadata, meta_name, (elems.index(header_val) + 1))
                                break
                    break
                else:
                    metadata_is_set = False
                    elems = line.split(' DCTB ')
                    if (len(elems) > 2):
                        for str in data.col1_startswith:
                            if line.lower().startswith(str):
                                if (overwrite or (not dataset.metadata.element_is_set('chromCol'))):
                                    dataset.metadata.chromCol = 1
                                try:
                                    int(elems[1])
                                    if (overwrite or (not dataset.metadata.element_is_set('startCol'))):
                                        dataset.metadata.startCol = 2
                                except:
                                    pass
                                try:
                                    int(elems[2])
                                    if (overwrite or (not dataset.metadata.element_is_set('endCol'))):
                                        dataset.metadata.endCol = 3
                                except:
                                    pass
                                if ((len(elems) < 6) or (elems[5] not in data.valid_strand)):
                                    if (overwrite or (not dataset.metadata.element_is_set('strandCol'))):
                                        dataset.metadata.strandCol = 0
                                elif (overwrite or (not dataset.metadata.element_is_set('strandCol'))):
                                    dataset.metadata.strandCol = 6
                                metadata_is_set = True
                                break
                    if (metadata_is_set or ((i - empty_line_count) > num_check_lines)):
                        break
            else:
                empty_line_count += 1
