Annotate_variants_table using keytable generated from spark dataframe


#1

Hello,
I have a keytable generated from a Spark dataframe with the ‘v’ column in the string format (eg. ‘1:20000:A:T’)
kt
Out[206]: KeyTable(is.hail.HailContext@7cf3114c,MapPartitionsRDD[99] at map at KeyTable.scala:54,Struct{gene_refgene:String,func_refgene:String,exonicfunc_refgene:String,popfreqmax:Double,mutationtaster_score:Double,v:String},[Ljava.lang.String;@4d842e97)
kt.key
[u’v’]

The annotate_variants_table method doesn’t work for me as it expects the table keyed by “Variant.” I know you can use Variant.parse() but don’t know how to convert the column type in the key table.

Please help. Thx!


#2

Running kt = kt.annotate('v = Variant(v)').key_by('v') beforehand should do the trick


#3

Thanks very much, @konradjk!
The Hail community is awesome! :+1: