def print_to_bed(self, filename="stdout", switch=False):
        fw = must_open(filename, "w")
        for lg, markers in sorted(self.items()):
            for marker, pos in markers:
                if not switch:
                    line = (lg, pos, pos + 1, marker)
                else:
                    seqid, spos = marker.split(".")
                    spos = int(spos)
                    marker = "{0}:{1}".format(lg, pos / 1000.)
                    line = (seqid, spos - 1, spos, marker)
                print >> fw, "\t".join(str(x) for x in line)
        fw.close()
dataset/ETHPy150Open tanghaibao/jcvi/assembly/geneticmap.py/BinMap.print_to_bed/original