def update_m(data, old_M, old_W, selected_genes, disp=False, inner_max_iters=<NUM_LIT:100>, parallel=True, threads=<NUM_LIT:4>, write_progress_file=None, tol=<NUM_LIT:0.0>, regularization=<NUM_LIT:0.0>, **kwargs):
genes, cells = data.shape<EOL>k = old_M.shape[<NUM_LIT:1>]<EOL>non_selected_genes = [x for x in range(genes) if x not in set(selected_genes)]<EOL>new_M = np.zeros((genes, k))<EOL>new_M[selected_genes, :] = old_M<EOL>if disp:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>new_M_non_selected = data[non_selected_genes, :] * sparse.csc_matrix(old_W.T)<EOL>new_M[non_selected_genes, :] = new_M_non_selected.toarray()<EOL>X = data.astype(float)<EOL>XT = X.T<EOL>is_sparse = False<EOL>if sparse.issparse(X):<EOL><INDENT>is_sparse = True<EOL>update_fn = sparse_nolips_update_w<EOL>X = sparse.csc_matrix(X)<EOL>XT = sparse.csc_matrix(XT)<EOL>if parallel:<EOL><INDENT>update_fn = parallel_sparse_nolips_update_w<EOL><DEDENT>Xsum = np.asarray(X.sum(<NUM_LIT:0>)).flatten()<EOL>Xsum_m = np.asarray(X.sum(<NUM_LIT:1>)).flatten()<EOL>method = '<STR_LIT>'<EOL>objective_fn = _call_sparse_obj<EOL><DEDENT>else:<EOL><INDENT>objective_fn = objective<EOL>update_fn = nolips_update_w<EOL>Xsum = X.sum(<NUM_LIT:0>)<EOL>Xsum_m = X.sum(<NUM_LIT:1>)<EOL>if method == '<STR_LIT>':<EOL><INDENT>is_sparse = True<EOL>X = sparse.csc_matrix(X)<EOL>XT = sparse.csc_matrix(XT)<EOL>update_fn = sparse_nolips_update_w<EOL>if parallel:<EOL><INDENT>update_fn = parallel_sparse_nolips_update_w<EOL><DEDENT>objective_fn = _call_sparse_obj<EOL><DEDENT><DEDENT>if disp:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>new_M = _estimate_w(XT, new_M.T, old_W.T, Xsum_m, update_fn, objective_fn, is_sparse, parallel, threads, method, tol, disp, inner_max_iters, '<STR_LIT:M>', regularization)<EOL>if write_progress_file is not None:<EOL><INDENT>progress = open(write_progress_file, '<STR_LIT:w>')<EOL>progress.write('<STR_LIT:0>')<EOL>progress.close()<EOL><DEDENT>return new_M.T<EOL>
This returns a new M matrix that contains all genes, given an M that was
created from running state estimation with a subset of genes.

Args:
    data (sparse matrix or dense array): data matrix of shape (genes, cells), containing all genes
    old_M (array): shape is (selected_genes, k)
    old_W (array): shape is (k, cells)
    selected_genes (list): list of selected gene indices
    Rest of the args are as in poisson_estimate_state

Returns:
    new_M: array of shape (all_genes, k)