# Filtering for a list of rsids

**URL:** <https://discuss.hail.is/t/filtering-for-a-list-of-rsids/614>\
**Category:** Help \[0.1\]\
**Created:** [August 20, 2018, 9:33pm UTC](https://discuss.hail.is/t/filtering-for-a-list-of-rsids/614 "2018-08-20T21:33:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![palakpsheth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/palakpsheth/32/172_2.png) [@palakpsheth](https://discuss.hail.is/u/palakpsheth)\
**Post date:** [August 20, 2018, 9:33pm UTC](https://discuss.hail.is/t/filtering-for-a-list-of-rsids/614/1 "2018-08-20T21:33:52Z")

</div>

Hello,

I am trying to filter a HAIL v0.1 `VariantDataSet` (UKBB data) on Databricks using a compound filter expression and the `filter_variants_expr` method but am receiving a fatal error `IllegalStateException: Bytecode failed verification 2`. I actually also tried using `filter_variants_list` building a `representation.Variant` object for each rsid’s chrm:pos:ref:alt but ended up with no variants in the filtered vds (no idea why)

```
print hail_filter_expr
(va.rsid == "rs459193") || (va.rsid == "rs6001930") || (va.rsid == "rs13078960")

print hail_var_list
[Variant(contig=5, start=55806751, ref=A, alts=[AltAllele(ref=A, alt=G)]), Variant(contig=22, start=40876234, ref=T, alts=[AltAllele(ref=T, alt=C)]), Variant(contig=3, start=85807590, ref=T, alts=[AltAllele(ref=T, alt=G)])]

bgen_vds = hc.import_bgen(row['bgen_path'].replace('s3://', 'dbfs:/mnt/'),
                          sample_file=row['bgen_sample_path'].replace('s3://', 'dbfs:/mnt/'))
#bgen_vds_filtered = bgen_vds.filter_variants_list(hail_var_list, keep=False).persist()
bgen_vds_filtered = bgen_vds.filter_variants_expr(hail_filter_expr, keep=False).persist()
FatalError Traceback (most recent call last)

```

> in ()  
> 12 sample\_file=row[‘bgen\_sample\_path’].replace(‘s3://’, ‘dbfs:/mnt/’))  
> 13 #bgen\_vds\_filtered = bgen\_vds.filter\_variants\_list(hail\_var\_list, keep=False).persist()  
> —\> 14 bgen\_vds\_filtered = bgen\_vds.filter\_variants\_expr(hail\_filter\_expr, keep=False).persist()  
> 15  
> 16 # assert to ensure that at least one variant found with the wanted rsid
> 
> in persist(self, storage\_level)
> 
> /local\_disk0/spark-1322f4fc-61d3-4a12-99d4-3cd8a85d0761/userFiles-f34fca5d-2974-4972-bb62-28c8f0ac193e/addedFile4156138757619196325dbfs\_\_FileStore\_jars\_f3963890\_53e6\_4f02\_9df8\_a3dd495e3ce3\_hail\_0\_1\_spark\_2\_2\_0\_44bec-6b92a.egg/hail/java.py in handle\_py4j(func, \*args, \*\*kwargs)  
> 119 raise FatalError(‘%s\n\nJava stack trace:\n%s\n’  
> 120 ‘Hail version: %s\n’  
> → 121 ‘Error summary: %s’ % (deepest, full, Env.hc().version, deepest))  
> 122 except py4j.protocol.Py4JError as e:  
> 123 if e.args[0].startswith(‘An error occurred while calling’):
> 
> FatalError: IllegalStateException: Bytecode failed verification 2
> 
> Java stack trace:  
> java.lang.IllegalStateException: Bytecode failed verification 2  
> at is.hail.asm4s.FunctionBuilder.classAsBytes(FunctionBuilder.scala:196)  
> at is.hail.asm4s.FunctionBuilder.result(FunctionBuilder.scala:208)  
> at is.hail.expr.CM.runWithDelayedValues(CM.scala:78)  
> at is.hail.expr.Parser$.is$hail$expr$Parser$$evalNoTypeCheck(Parser.scala:49)  
> at is.hail.expr.Parser$.is$hail$expr$Parser$$eval(Parser.scala:62)  
> at is.hail.expr.Parser$.evalExpr(Parser.scala:74)  
> at is.hail.expr.Parser$.evalTypedExpr(Parser.scala:67)  
> at is.hail.expr.FilterVariants.execute(Relational.scala:348)  
> at is.hail.variant.VariantSampleMatrix.value$lzycompute(VariantSampleMatrix.scala:490)  
> at is.hail.variant.VariantSampleMatrix.value(VariantSampleMatrix.scala:488)  
> at is.hail.variant.VariantSampleMatrix.x$13$lzycompute(VariantSampleMatrix.scala:493)  
> at is.hail.variant.VariantSampleMatrix.x$13(VariantSampleMatrix.scala:493)  
> at is.hail.variant.VariantSampleMatrix.rdd$lzycompute(VariantSampleMatrix.scala:493)  
> at is.hail.variant.VariantSampleMatrix.rdd(VariantSampleMatrix.scala:493)  
> at is.hail.variant.VariantDatasetFunctions$.withGenotypeStream$extension(VariantDataset.scala:196)  
> at is.hail.variant.VariantDatasetFunctions$.persist$extension(VariantDataset.scala:190)  
> at is.hail.variant.VariantDatasetFunctions.persist(VariantDataset.scala:182)  
> at sun.reflect.GeneratedMethodAccessor427.invoke(Unknown Source)  
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.lang.reflect.Method.invoke(Method.java:498)  
> at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)  
> at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:380)  
> at py4j.Gateway.invoke(Gateway.java:293)  
> at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)  
> at py4j.commands.CallCommand.execute(CallCommand.java:79)  
> at py4j.GatewayConnection.run(GatewayConnection.java:226)  
> at java.lang.Thread.run(Thread.java:748)
> 
> Hail version: 0.1-1214727  
> Error summary: IllegalStateException: Bytecode failed verification 2

Ant insight would be greatly appreciated!

Any other suggestions on how to filter on a list of rsids is welcome as well. Thanks so much!

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [August 21, 2018, 7:12pm UTC](https://discuss.hail.is/t/filtering-for-a-list-of-rsids/614/2 "2018-08-21T19:12:39Z")

</div>

Hi @palakpsheth!

I’m really sorry to hear you are encountering this issue. Do you have a particular reason for using Hail 0.1? Hail 0.2 has an easier to use interface, more functionality, and is receiving all the new features.

I have started trying to reproduce your issue in Hail 0.1. I will respond if I have more information.

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [August 21, 2018, 7:37pm UTC](https://discuss.hail.is/t/filtering-for-a-list-of-rsids/614/3 "2018-08-21T19:37:21Z")

</div>

Ok, I can’t reproduce with hail version `0.1-74bf1ebb`. The version of hail you are using is a little bit old; however, I do not think the changes from `1214727` to `74bf1ebb` will fix this.

The following executes successfully for me:

```auto
from hail import *
hail_filter_expression = """(va.rsid == "rs459193") || (va.rsid == "rs6001930") || (va.rsid == "rs13078960")"""
hc = HailContext()
vds = hc.import_bgen('ukb_imp_chr22_v3.bgen')
vds.filter_variants_expr(hail_filter_expression, keep=False).count()

```

Can you share the `hail.log` file? It should reside in the working directory of the driver node.

Can you also share the output of:

```auto
print(vds.sample_schema)
print(vds.variant_schema)
print(vds.genotype_schema)

```
