def filter_by_score(self,lowercutoff,uppercutoff=None):
        """Filter elements by their scores.
        
        Parameters:
        1. lowercutoff: lower cut-off for the scores
        2. uppercutoff: upper cut-off for the socres. If this parameter is not given, only lowercutoff will be applied."""
        
        # get the look-up table to know the types of columns
        lookup={}
        for i,x in enumerate(self.__columns): lookup[x]=i
        
        # the new filtered Bed object
        filtered=Bed()
        chroms=self.get_chroms()
        ix=[]
        for chrom in chroms:
            for i in xrange(len(self.bed[chrom]['score'])):
                if uppercutoff:
                    if lowercutoff <=self.bed[chrom]['score'][i] >= uppercutoff: ix.append(i)
                else:
                    if lowercutoff <=self.bed[chrom]['score'][i]: ix.append(i)
            
            filtered.bed[chrom]={}
            columns=self.bed[chrom].keys()
            for column in columns:
                if column=='start' or column=='end' or column=='thickStart' or column=='thickEnd' or column=='blockCount':
                    filtered.bed[chrom][column]=array('l',[self.bed[chrom][column][j] for j in ix])
                elif column=='score':
                    filtered.bed[chrom][column]=array('d',[self.bed[chrom][column][j] for j in ix])
                else:
                    filtered.bed[chrom][column]=[self.bed[chrom][column][j] for j in ix]
                    
        return filtered
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/Bed.filter_by_score/original