def __to_bed(self):
        """Turn the bed object into a bed-format string"""
        
        chroms=self.get_chroms()

        bedout=''
        for chrom in chroms:
            columns=self.bed[chrom].keys()
            len_columns=len(columns)
            formated='\t'.join(self.__format_cols[:len_columns+1])
            for i in xrange(0,len(self.bed[chrom][self.__columns[1]])):
                out=[chrom]+[self.bed[chrom][column][i] for column in self.__columns[1:len_columns+1]]
                try:
                    for j in self.__list_i: out[j]=str(out[j])[1:-1]+','
                except IndexError:
                    pass
                bedout+= formated %tuple(out)+'\n'
        
        return bedout
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/Bed.__to_bed/original