# Name 'qc\_vars' is not defined: how to trouble shoot, help?

**URL:** <https://discourse.scverse.org/t/name-qc-vars-is-not-defined-how-to-trouble-shoot-help/653>\
**Category:** scanpy\
**Created:** [August 2, 2022, 2:28am UTC](https://discourse.scverse.org/t/name-qc-vars-is-not-defined-how-to-trouble-shoot-help/653 "2022-08-02T02:28:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cookiemonster](https://avatars.discourse-cdn.com/v4/letter/c/a4c791/32.png) [@cookiemonster](https://discourse.scverse.org/u/cookiemonster)\
**Post date:** [August 2, 2022, 2:28am UTC](https://discourse.scverse.org/t/name-qc-vars-is-not-defined-how-to-trouble-shoot-help/653/1 "2022-08-02T02:28:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jeskowagner](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/jeskowagner/32/218_2.png) [@jeskowagner](https://discourse.scverse.org/u/jeskowagner)\
**Post date:** [August 5, 2022, 10:40am UTC](https://discourse.scverse.org/t/name-qc-vars-is-not-defined-how-to-trouble-shoot-help/653/2 "2022-08-05T10:40:11Z")

</div>

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:

```auto
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
