# How to impute the modality (like ATAC) when I only have the other modality (RNA) using a pre-trained MultiVI?

**URL:** <https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580>\
**Category:** scvi-tools\
**Tags:** multivi\
**Created:** [June 28, 2022, 4:49pm UTC](https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580 "2022-06-28T16:49:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hongru-Hu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/hongru-hu/32/140_2.png) [@Hongru-Hu](https://discourse.scverse.org/u/Hongru-Hu)\
**Post date:** [June 28, 2022, 4:49pm UTC](https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580/1 "2022-06-28T16:49:55Z")

</div>

hI, just wondering how to impute the modality (like ATAC) when I only have the other modality (RNA) using a pre-trained MultiVI? If the built-in function does not work for this case, what would the flow I need to pass the RNA data through by using the multi.modules?

Thanks

---

<div class="post-metadata">

**Author:** ![RK900](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/rk900/32/296_2.png) [@RK900](https://discourse.scverse.org/u/RK900)\
**Post date:** [June 29, 2022, 6:46pm UTC](https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580/2 "2022-06-29T18:46:01Z")

</div>

If you have a pretrained MultiVI model, you can run `get_accessibility_estimates` with your AnnData with only gene expression counts to get the imputed ATAC values.

---

<div class="post-metadata">

**Author:** ![Hongru-Hu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/hongru-hu/32/140_2.png) [@Hongru-Hu](https://discourse.scverse.org/u/Hongru-Hu)\
**Post date:** [June 30, 2022, 5:55pm UTC](https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580/3 "2022-06-30T17:55:49Z")

</div>

Thanks for the reply, but it did not work (the expression AnnData is a held-out set which was not involved in training process).

One thing I would want to try is to pass the input RNA count matrix tensor to the modules. I understand the joint embedding is` 1/2*(Z_rna + Z_atac)` when we have both modalities, but if the input is single-modal, like `X_rna` only, to predict the `X_atac`, we need to put the input data through `Encoder_rna` and then the `Decoder_atac`, and in this case since I do not have `Z_atac`, I was wondering what form of `Z_rna` should be used as the input of the `Decoder_atac`? Simply `Z_rna` or `1/2*Z_rna`. Thanks!

---

<div class="post-metadata">

**Author:** ![Justin\_Hong](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/justin_hong/32/85_2.png) [@Justin\_Hong](https://discourse.scverse.org/u/Justin_Hong)\
**Post date:** [June 30, 2022, 6:12pm UTC](https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580/4 "2022-06-30T18:12:32Z")

</div>

Can you explain exactly what went wrong when you tried to pass in your held out AnnData? It should work for AnnDatas not used for training as long as it is formatted in the same way as the input AnnData.

What described is precisely what this function does. Z\_rna is used when the accessibility is not present (rather than 1/2 Z\_rna).

---

<div class="post-metadata">

**Author:** ![RK900](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/rk900/32/296_2.png) [@RK900](https://discourse.scverse.org/u/RK900)\
**Post date:** [June 30, 2022, 10:15pm UTC](https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580/5 "2022-06-30T22:15:38Z")

</div>

Also, make sure that your held out anndata is the same shape as the original anndata - as in padding the anndata with a 0 matrix for the chromatin accessibility data.

---

<div class="post-metadata">

**Author:** ![Hongru-Hu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/hongru-hu/32/140_2.png) [@Hongru-Hu](https://discourse.scverse.org/u/Hongru-Hu)\
**Post date:** [July 1, 2022, 8:10pm UTC](https://discourse.scverse.org/t/how-to-impute-the-modality-like-atac-when-i-only-have-the-other-modality-rna-using-a-pre-trained-multivi/580/6 "2022-07-01T20:10:15Z")

</div>

Thanks for the clarification!
