# About sparse matrix table

**URL:** <https://discuss.hail.is/t/about-sparse-matrix-table/1276>\
**Category:** Hail Query & hailctl\
**Created:** [February 6, 2020, 3:49am UTC](https://discuss.hail.is/t/about-sparse-matrix-table/1276 "2020-02-06T03:49:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhebrard](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/mhebrard/32/322_2.png) [@mhebrard](https://discuss.hail.is/u/mhebrard)\
**Post date:** [February 6, 2020, 3:49am UTC](https://discuss.hail.is/t/about-sparse-matrix-table/1276/1 "2020-02-06T03:49:18Z")

</div>

Hi, I am interested to try out using sparse matrix table but I am a bit confuse about the workflow to properly load the data.

1\> I noticed that `transform_gvcf` should be run on a mt with only 1 column. That means if I have an individual gvcf I am god to go, but if I have a gvcf with multiple individuals, I need to select each column and transform it to its own sparse mt… am I right ?

2\> If I get it right, `combine_gvcf` take a list of sparse mt. That means if I get a sparse mt for each of my individuals at Q1, then I can combine them into one unique sparse mt using that function… am I right ?

3\> Can I combine\_gvcf incrementally ? let say I have 3 individuals. First I use transform\_gvcf of individual A into **A.smt** and B into **B.smt**. Then I combine\_gvcf of [A.smt, B.smt] into **all.smt**. Then I transform\_gvcf of individual C into **C.smt**. Can I combine\_gvcf of [all.smt, C.smt] into **all.smt**?

Thanks

---

<div class="post-metadata">

**Author:** ![chrisvittal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/chrisvittal/32/327_2.png) [@chrisvittal](https://discuss.hail.is/u/chrisvittal)\
**Post date:** [February 6, 2020, 3:17pm UTC](https://discuss.hail.is/t/about-sparse-matrix-table/1276/2 "2020-02-06T15:17:59Z")

</div>

Thank you for your interest! To answer your questions:

1. Sort of. The issue here is the correctness of INFO fields. The `transform_gvcf` method copies every `INFO` field (except DP and END) into the matrix table entry into a field called `gvcf_info`. Recomputing those INFO fields requires doing an aggregation over those entries. If you have a field such as `VAR_DP` which would then be aggregated back with a sum, you will end up with a result that is too large because we will have copied the original `VAR_DP` multiple times.
2. Correct.
3. Yes! `combine_gvcfs` **inputs** and **outputs** are sparse matrix tables. Therefore we can easily add samples in an incremental fashion. Be aware this requires a read and write of all data so it can be costly in terms of compute time, but we can incrementally add samples easily.
