'Returns file contents with only the bed data'

def as_ucsc_display_file(self, dataset, **kwd):

    (fd, temp_name) = tempfile.mkstemp()
    (c, s, e, t, n) = (dataset.metadata.chromCol, dataset.metadata.startCol, dataset.metadata.endCol, (dataset.metadata.strandCol or 0), (dataset.metadata.nameCol or 0))
    (c, s, e, t, n) = ((int(c) - 1), (int(s) - 1), (int(e) - 1), (int(t) - 1), (int(n) - 1))
    if (t >= 0):
        for (i, elems) in enumerate(util.file_iter(dataset.file_name)):
            strand = '+'
            name = ('region_%i' % i)
            if ((n >= 0) and (n < len(elems))):
                name = elems[n]
            if (t < len(elems)):
                strand = elems[t]
            tmp = [elems[c], elems[s], elems[e], name, '0', strand]
            os.write(fd, ('%s\n' % ' DCTB '.join(tmp)))
    elif (n >= 0):
        for (i, elems) in enumerate(util.file_iter(dataset.file_name)):
            name = ('region_%i' % i)
            if ((n >= 0) and (n < len(elems))):
                name = elems[n]
            tmp = [elems[c], elems[s], elems[e], name]
            os.write(fd, ('%s\n' % ' DCTB '.join(tmp)))
    else:
        for elems in util.file_iter(dataset.file_name):
            tmp = [elems[c], elems[s], elems[e]]
            os.write(fd, ('%s\n' % ' DCTB '.join(tmp)))
    os.close(fd)
    return open(temp_name)
