I have contents of a VCF in a hail table and I realize exporting it as a VCF doesn’t add the FORMAT field of the sample to the VCF. So, I’d like to convert it to a matrixtable to do mt.export_vcf()
but unclear on how to do it.
I created a tstruct
with all the FORMAT fields (based on Hail | Import / Export and `filter_entries` introduces NA instead of removing entries from a matrixtable - #5 by danking). I’m a little confused on the implementation here.
Here’s what I have till now:
- A hail table,
>>> test.describe()
----------------------------------------
Global fields:
None
----------------------------------------
Row fields:
'locus': locus<GRCh38>
'alleles': array<str>
'rsid': str
'qual': float64
'filters': set<str>
'info': struct {
AC: array<int32>,
AF: array<float64>,
AN: int32,
BaseQRankSum: float64,
DB: bool,
DP: int32,
ExcessHet: float64,
FS: float64,
InbreedingCoeff: float64,
MLEAC: array<int32>,
MLEAF: array<float64>,
MQ: float64,
MQRankSum: float64,
QD: float64,
ReadPosRankSum: float64,
SOR: float64
}
'test.AD': array<int32>
'test.DP': int32
'test.GQ': int32
'test.GT': call
'test.PL': array<int32>
----------------------------------------
Key: ['locus', 'alleles']
----------------------------------------
- Created a
tstruct
to be included in the FORMAT field
>>> test_struct.describe()
--------------------------------------------------------
Type:
struct {
AD: array<int32>,
DP: int32,
GQ: int32,
GT: call,
PL: array<int32>
}
--------------------------------------------------------
Source:
<hail.table.Table object at 0x7f0b9714fa70>
Index:
['row']
--------------------------------------------------------
- I’m stuck wondering how I would use the
table
(from 1.) andtstruct
(from 2.) to convert them into a matrixtable usingto_matrix_table_row_major
.
Any ideas on how to convert a hail Table
to MatrixTable
and then export a VCF
?
Thanks,
Faizal