def identify_marker_genes_ratio(self, labels=None):
if(labels is None):<EOL><INDENT>try:<EOL><INDENT>keys = np.array(list(self.adata.obs_keys()))<EOL>lbls = self.adata.obs[ut.search_string(<EOL>keys, '<STR_LIT>')[<NUM_LIT:0>][<NUM_LIT:0>]].get_values()<EOL><DEDENT>except KeyError:<EOL><INDENT>print("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT>elif isinstance(labels, str):<EOL><INDENT>lbls = self.adata.obs[labels].get_values().flatten()<EOL><DEDENT>else:<EOL><INDENT>lbls = labels<EOL><DEDENT>all_gene_names = np.array(list(self.adata.var_names))<EOL>markers={}<EOL>s = np.array(self.adata.layers['<STR_LIT>'].sum(<NUM_LIT:0>)).flatten()<EOL>lblsu=np.unique(lbls)<EOL>for i in lblsu:<EOL><INDENT>d = np.array(self.adata.layers['<STR_LIT>']<EOL>[lbls == i, :].sum(<NUM_LIT:0>)).flatten()<EOL>rat = np.zeros(d.size)<EOL>rat[s > <NUM_LIT:0>] = d[s > <NUM_LIT:0>]**<NUM_LIT:2> / s[s > <NUM_LIT:0>] *self.adata.var['<STR_LIT>'].values[s > <NUM_LIT:0>]<EOL>x = np.argsort(-rat)<EOL>markers[i] = all_gene_names[x[:]]<EOL><DEDENT>self.adata.uns['<STR_LIT>'] = markers<EOL>return markers<EOL>
Ranks marker genes for each cluster using a SAM-weighted
expression-ratio approach (works quite well). 

Parameters
----------

labels - numpy.array or str, optional, default None
    Cluster labels to use for marker gene identification. If None,
    assumes that one of SAM's clustering algorithms has been run. Can
    be a string (i.e. 'louvain_clusters', 'kmeans_clusters', etc) to
    specify specific cluster labels in adata.obs.