Name 'qc_vars' is not defined: how to trouble shoot, help?

When running this code I get an error message that ‘qc_vars’ is not defined
for adata in adata_control:
adata.var[“mt”] = adata.var_names.str.startswith(“mt-”)
sc.pp.calculate_qc_metrics(
adata, qc_vars[“mt”], percent_top=None, log1p=False, inplace=True
)
I’m not certain why it’s not detecting mitochondrial genes.

Hi!
Are you following any particular tutorial? I think you’re trying to do almost exactly what the example in the function achieves. Below is that example adapted to your code:

adata.var["mt"] = adata.var_names.str.startswith("mt-")
sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], inplace=True, percent_top=None, log1p=False)

The error you were getting was related to you forgetting the ‘=’ between qc_vars and ["mt"].

Hope that helps!
Best, Jesko