Hi Hail community,
I’m using Hail to filter variants from GVCF file based on a BED file. The issue is the returned results if I used VCF file was completely correct, but it wasn’t correct when I used GVCF file.
My code
I checked the document and found that the locus information contains 3 information: contig(chrom), position and reference and I believe that it’s the root cause because with the GVCF file we still have END position information that defined a row data as a range (Hail interval).
I have tried to create another column called new_interval with Hail.Interval type contains chrom, pos, and END position information for the vds matrix table, but I don’t know how to filter rows data from this matrix table using BED file based on new_interval column.
Is there any way to achieve this approach?
Thanks
Hi @biodev,
If I understand correctly, I think you want to import the gvcf as a hail VDS, which understands the reference blocks/intervals. Importing a single gvcf is an unusual use case, I think the only way to do that at the moment is using the VariantDatasetCombiner to “combine” one file.
Hi @patrick-schultz,
Sorry for any confusing,
Currently I’m using import_vcf function to import my GVCF file, build a hail VDS on this and there is no problems.
The exact problem that I’m facing is: 'Filtering GVCF data from a BED file’ using this following code:
I have used this code to filter data from a VCF file, it worked perfectly. But it was wrong when I used this code for GVCF file
The root cause that I thought:
Because each line in VCF file is just a single data and it doesn’t have the END position as the one in GVCF. With GVCF we have one Interval (block) (created by chrom, position, END) per line, so the vds.locus object Locus created by chrom & position only now will be wrong.
My solution:
Create another column called new_interval with Hail.Interval data type that is built from chrom, position, and END for the GVCF vds matrix table by using annotate_rows function, then use this column to compare against intervals in the BED file. Is it possible because we have failed many times? Here is my code for this solution