f"Selected layer: {layer} is not in the layers list. "
f"The list of valid layers is: {adata.layers.keys()}"
)
matrix = adata[:, var_names].layers[layer]
elif use_raw:
matrix = adata.raw[:, var_names].X
else:
After Change
// prepare var values
if len(var_names) > 0:
X = _get_obs_rep(adata, layer=layer, use_raw=use_raw)
matrix = X[:, adata.var_names.get_indexer(var_names)]
df_var = pd.DataFrame(matrix, columns=var_symbol, index=adata.obs.index)
// prepare obs values