def genes_panel(self, ax, feature):
        """
        Plots gene models on an Axes.

        Queries the database

        :param ax: matplotlib.Axes object
        :param feature: pybedtools.Interval

        """
        from gffutils.contrib.plotting import Gene
        extent = [feature.start, feature.stop]
        nearby_genes = self.db.region(
            (feature.chrom, feature.start, feature.stop), featuretype='gene')
        ybase = 0
        ngenes = 0
        for nearby_gene in nearby_genes:
            # TODO: there should be a better way of identifying which gene is
            # the same as the feature requested.  Might need to expose an "ID"
            # kwarg.
            try:
                if nearby_gene['ID'][0] == feature['ID']:
                    color = '0.2'
                else:
                    color = '0.5'
            except __HOLE__:
                color = '0.5'
            ngenes += 1
            extent.extend([nearby_gene.start, nearby_gene.stop])
            gene_collection = Gene(
                self.db,
                nearby_gene,
                transcripts=None,
                cds=['CDS'],
                utrs=['exon'],
                ybase=ybase,
                color=color)
            gene_collection.name = nearby_gene.id
            gene_collection.add_to_ax(ax)
            ybase += gene_collection.max_y

        xmin = min(extent)
        xmax = max(extent)
        ymax = ngenes

        # 1% padding seems to work well
        padding = (xmax - xmin) * 0.01
        ax.axis('tight')

        # add lines indicating extent of current feature
        # vline_kwargs = dict(color='k', linestyle='--')
        # ax.axvline(feature.start, **vline_kwargs)
        # ax.axvline(feature.stop, **vline_kwargs)

        # Make a new feature to represent the region plus surrounding genes
        interval = pybedtools.create_interval_from_list(feature.fields)
        interval.strand = '.'
        for txt in ax.get_yticklabels():
            txt.set_visible(False)
        for tick in ax.get_yticklines():
            tick.set_visible(False)
        ax.set_ylabel('Genes')
        ax.spines['right'].set_color('None')
        ax.spines['left'].set_color('None')
        ax.spines['top'].set_color('None')
        ax.yaxis.set_ticks_position('none')
        ax.xaxis.set_ticks_position('bottom')
        ax.set_ylabel('Genes', rotation=0, horizontalalignment='right',
                      verticalalignment='center')

        return interval
dataset/ETHPy150Open daler/metaseq/metaseq/minibrowser.py/ChIPSeqMiniBrowser.genes_panel