def get_genelengths(self):
        """Return the minimum, average, and maximum gene lengths with std"""
        
        chroms=self.get_chroms()
        
        lengths={}
        total_min_gene=0
        total_max_gene=0
        total_mean_gene=0
        total_min_exon=0
        total_max_exon=0
        total_mean_exon=0
        total_min_intron=0
        total_max_intron=0
        total_mean_intron=0
        total_gene_length=0
        total_exon_length=0
        total_intron_length=0
        total_gene_num=0
        for chrom in chroms:
            gene_length=[end-start for start,end in zip(self[chrom]['txStart'],self[chrom]['txEnd'])]
            exon_length=[]
            intron_length=[]
            current_gene_num=len(self[chrom]['txStart'])
            for i in xrange(0,current_gene_num):
                exons=zip(self[chrom]['exonStarts'][i],self[chrom]['exonEnds'][i])
                try:
                    exon_length.append(sum([end-start for start,end in exons]))
                    intron_length.append(gene_length[i]-exon_length[i])
                except:
                    pass
            current_gene_length=sum(gene_length)
            current_exon_length=sum(exon_length)
            current_intron_length=current_exon_length-current_gene_length
            current_min_gene=min(gene_length)
            current_max_gene=min(gene_length)
            current_min_exon=min(exon_length)
            current_max_exon=max(exon_length)
            current_min_intron=min(intron_length)
            current_max_intron=max(intron_length)
            current_mean_gene=1.0*current_gene_length/current_gene_num
            current_mean_exon=1.0*current_exon_length/current_gene_num
            current_mean_intron=1.0*current_intron_length/current_gene_num
            
            lengths[chrom]={'gene':[current_min_gene,current_mean_gene,current_max_gene], 'exon':[current_min_exon,current_mean_exon,current_max_exon],\
                            'intron':[current_min_intron,current_mean_intron,current_max_intron]}
            
            if total_min_gene==0: total_min_gene=current_min_gene
            else: total_min_gene=min(total_min_gene,current_min_gene)
            if total_min_exon==0: total_min_exon=current_min_exon
            else: total_min_exon=min(total_min_exon,current_min_exon)
            if total_min_intron==0: total_min_intron=current_min_intron
            else: total_min_intron=min(total_min_intron,current_min_intron)
            
            total_max_gene=max(total_max_gene,current_max_gene)
            total_max_exon=max(total_max_exon,current_max_exon)
            total_max_intron=max(total_max_intron,current_max_intron)
            
            total_gene_length+=current_gene_length
            total_exon_length+=current_exon_length
            total_intron_length+=current_intron_length
            total_gene_num+=current_gene_num
            
            
        total_mean_gene=1.0*total_gene_length/total_gene_num
        total_mean_exon=1.0*total_exon_length/total_gene_num
        total_mean_intron=1.0*total_intron_length/total_gene_num
        
        lengths['whole']={'gene':[total_min_gene,total_mean_gene,total_max_gene], 'exon':[total_min_exon,total_mean_exon,total_max_exon],\
                          'intron':[total_min_intron,total_mean_intron,total_max_intron]}
        
        return lengths
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/GeneTable.get_genelengths/swapped operands of `-`