def add_line(self,chrom,l):
        """Add a line"""
        
        try:
            for i in range(0,len(l)):
                if self.__types[i+1]=='int':
                    element=int(l[i])
                elif self.__types[i+1]=='float':
                    element=float(l[i])
                elif self.__types[i+1]=='str':
                    element=l[i]
                elif self.__types[i+1]=='list':
                    element=[int(e) for e in l[i].rstrip(',').split(',')]
                self.bed[chrom][self.__columns[i+1]].append(element)
        except TypeError:    # the first shot
            self.bed={}
            self.bed[chrom]={}
            for i in range(0,len(l)):
                if self.__types[i+1]=='int':        # when column is integer
                    self.bed[chrom][self.__columns[i+1]]=array('l',[int(l[i])])
                elif self.__types[i+1]=='float':    # when column is float
                    self.bed[chrom][self.__columns[i+1]]=array('d',[float(l[i])])
                elif self.__types[i+1]=='str'or self.__types[i+1]=='list':       # when string or blob type (comma separated string)
                    self.bed[chrom][self.__columns[i+1]]=[l[i]]
                elif self.__types[i+1]=='list':
                    self.bed[chrom][self.__columns[i+1]]=[[int(e) for e in l[i].rstrip(',').split(',')]]
        except __HOLE__:     # if new chromosome is met
            self.bed[chrom]={}
            for i in range(0,len(l)):
                if self.__types[i+1]=='int':        # when column is integer
                    self.bed[chrom][self.__columns[i+1]]=array('l',[int(l[i])])
                elif self.__types[i+1]=='float':    # when column is float
                    self.bed[chrom][self.__columns[i+1]]=array('d',[float(l[i])])
                elif self.__types[i+1]=='str'or self.__types[i+1]=='list':       # when string or blob type (comma separated string)
                    self.bed[chrom][self.__columns[i+1]]=[l[i]]
                elif self.__types[i+1]=='list':
                    self.bed[chrom][self.__columns[i+1]]=[[int(e) for e in l[i].rstrip(',').split(',')]]
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/Bed.add_line