def sort(self,key='txStart'):
        """Sort the gene table in asscending order"""

        # iterate through the choromosomes
        chroms=self.table.keys()
        for chrom in chroms:
            try:
                key_column=self.table[chrom][key]
            except KeyError, e:
                raise Exception((e) %'%s is not a valid column name')
            
            # if key_column is not list, TypeError is raised. Then, convert key_column into a list and do sorting again.
            try:
                sort_order=self.__argsort(key_column)
            except TypeError:
                key_column=list(key_column)
                sort_order=self.__argsort(key_column)
            
            # sort the other columns according to sort_order
            for column in self.columns:
                if column=='chrom': continue
                if type(self.table[chrom][column]).__name__=='array':
                    self.table[chrom][column]=array(self.table[chrom][column].typecode, [self.table[chrom][column][so] for so in sort_order])
                else:
                    self.table[chrom][column]=[self.table[chrom][column][so] for so in sort_order]
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/GeneTable.sort/swapped operands of `%`