def identify_marker_genes_corr(self, labels=None, n_genes=<NUM_LIT>):
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>w=self.adata.var['<STR_LIT>'].values<EOL>s = StandardScaler()<EOL>idxg = np.argsort(-w)[:n_genes]<EOL>y1=s.fit_transform(self.adata.layers['<STR_LIT>'][:,idxg].A)*w[idxg]<EOL>all_gene_names = np.array(list(self.adata.var_names))[idxg]<EOL>markers = {}<EOL>lblsu=np.unique(lbls)<EOL>for i in lblsu:<EOL><INDENT>Gcells = np.array(list(self.adata.obs_names[lbls==i]))<EOL>z1 = y1[np.in1d(self.adata.obs_names,Gcells),:]<EOL>m1 = (z1 - z1.mean(<NUM_LIT:1>)[:,None])/z1.std(<NUM_LIT:1>)[:,None]            <EOL>ref = z1.mean(<NUM_LIT:0>)<EOL>ref = (ref-ref.mean())/ref.std()<EOL>g2 = (m1*ref).mean(<NUM_LIT:0>)    <EOL>markers[i] = all_gene_names[np.argsort(-g2)]<EOL><DEDENT>self.adata.uns['<STR_LIT>'] = markers<EOL>return markers<EOL>
Ranking marker genes based on their respective magnitudes in the
correlation dot products with cluster-specific reference expression
profiles. 

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.

n_genes - int, optional, default 4000
    By default, computes correlations on the top 4000 SAM-weighted genes.