search_variants_by_coordinates() does not work (v2.0.0)
mapo9 opened this issue · 2 comments
Hi,
version 2.0.0.
I was trying to use civic.search_variants_by_coordinates()
as seen in the provided Genie example.
Command:
coords = civic.CoordinateQuery(chr='7', start=140453136, stop=140453136) civic.search_variants_by_coordinates(coords, search_mode='any')
However, this is not possible as I get the following error message:
`AttributeError Traceback (most recent call last)
Cell In [13], line 2
1 test = civic.CoordinateQuery(chr='7', start=140453136, stop=140453136)
----> 2 civic.search_variants_by_coordinates(test, search_mode='query_encompassing')
File ~/miniconda3/envs/work/lib/python3.10/site-packages/civicpy/civic.py:2085, in search_variants_by_coordinates(coordinate_query, search_mode)
2083 chromosome = str(coordinate_query.chr)
2084 # overlapping = (start <= ct.stop) & (stop >= ct.start)
-> 2085 left_idx = chr_idx.searchsorted(chromosome)
2086 right_idx = chr_idx.searchsorted(chromosome, side='right')
2087 chr_ct_idx = chr_idx[left_idx:right_idx].index
AttributeError: 'NoneType' object has no attribute 'searchsorted'`
Hi, thanks for reporting this. I can confirm that I am able to replicate this issue and am looking into it!
Hi @mapo9, we have identified the issue and its related to the generated cache file that civicpy downloads.
If you remove your local copy of the cache which is stored in ~/.civicpy
and perform the following steps:
from civicpy import civic
civic.load_cache()
coords = civic.CoordinateQuery(chr='7', start=140453136, stop=140453136)
civic.search_variants_by_coordinates(coords, search_mode='any')
You should get results successfully now. Apologies for the trouble and let us know if you have any further issues!
Thanks,
Adam