# Ld\_prune starts and stops error

**URL:** <https://discuss.hail.is/t/ld-prune-starts-and-stops-error/968>\
**Category:** Hail Query & hailctl\
**Created:** [May 30, 2019, 5:33pm UTC](https://discuss.hail.is/t/ld-prune-starts-and-stops-error/968 "2019-05-30T17:33:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmajarian](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@tmajarian](https://discuss.hail.is/u/tmajarian)\
**Post date:** [May 30, 2019, 5:33pm UTC](https://discuss.hail.is/t/ld-prune-starts-and-stops-error/968/1 "2019-05-30T17:33:35Z")

</div>

Hi-  
I’m writing a demo notebook that uses 1000 genomes data (ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/ALL.chr21.phase3\_shapeit2\_mvncall\_integrated\_v5a.20130502.genotypes.vcf.gz) . I am running into an issue with ld\_prune. After running the following code:

> vcf\_paths = [‘ALL.chr21.phase3\_shapeit2\_mvncall\_integrated\_v5a.20130502.genotypes.vcf.bgz’]  
> geno = hl.import\_vcf(vcf\_paths,min\_partitions = 100)  
> geno = hl.split\_multi\_hts(geno)  
> geno = hl.variant\_qc(geno)  
> geno = geno.filter\_rows(geno.variant\_qc.AF[1] \> 0.1)  
> pruned\_variant\_table = hl.ld\_prune(geno.GT, r2 = 0.2, bp\_window\_size=500000, block\_size = 1024)

I am getting this response:

> 2019-05-30 09:23:04 Hail: INFO: ld\_prune: running local pruning stage with max queue size of 99274 variants  
> 2019-05-30 09:23:10 Hail: INFO: wrote table with 9233 rows in 108 partitions to file:/tmp/hail.OfibaQ8KrJ2V/JSRMCTpZKa  
> 2019-05-30 09:23:19 Hail: INFO: Wrote all 30 blocks of 9232 x 2504 matrix with block size 1024.

With this error message:

> * * *
> 
> ValueError Traceback (most recent call last)  
> in   
> ----\> 1 pruned\_variant\_table = hl.ld\_prune(geno.GT, r2 = 0.2, bp\_window\_size=500000, block\_size = 1024)
> 
> \</Users/tmajaria/projects/src/miniconda3/envs/hail/lib/python3.7/site-packages/decorator.py:decorator-gen-1417\> in ld\_prune(call\_expr, r2, bp\_window\_size, memory\_per\_core, keep\_higher\_maf, block\_size)
> 
> ~/projects/src/miniconda3/envs/hail/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(\_\_original\_func, \*args, \*\*kwargs)  
> 559 def wrapper(_original\_func, \*args, \*\*kwargs):  
> 560 args, kwargs_ = check\_all(\_\_original\_func, args, kwargs, checkers, is\_method=is\_method)  
> → 561 return _original\_func(\*args, \*\*kwargs_)  
> 562  
> 563 return wrapper
> 
> ~/projects/src/miniconda3/envs/hail/lib/python3.7/site-packages/hail/methods/statgen.py in ld\_prune(call\_expr, r2, bp\_window\_size, memory\_per\_core, keep\_higher\_maf, block\_size)  
> 3336 \_, stops = hl.linalg.utils.locus\_windows(locally\_pruned\_table.locus, bp\_window\_size)  
> 3337  
> → 3338 entries = r2\_bm.sparsify\_row\_intervals(range(stops.size), stops, blocks\_only=True).entries(keyed=False)  
> 3339 entries = entries.filter((entries.entry \>= r2) & (entries.i \< entries.j))  
> 3340 entries = entries.select(i = hl.int32(entries.i), j = hl.int32(entries.j))
> 
> \</Users/tmajaria/projects/src/miniconda3/envs/hail/lib/python3.7/site-packages/decorator.py:decorator-gen-1305\> in sparsify\_row\_intervals(self, starts, stops, blocks\_only)
> 
> ~/projects/src/miniconda3/envs/hail/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(\_\_original\_func, \*args, \*\*kwargs)  
> 559 def wrapper(_original\_func, \*args, \*\*kwargs):  
> 560 args, kwargs_ = check\_all(\_\_original\_func, args, kwargs, checkers, is\_method=is\_method)  
> → 561 return _original\_func(\*args, \*\*kwargs_)  
> 562  
> 563 return wrapper
> 
> ~/projects/src/miniconda3/envs/hail/lib/python3.7/site-packages/hail/linalg/blockmatrix.py in sparsify\_row\_intervals(self, starts, stops, blocks\_only)  
> 1063 raise ValueError(f’n\_rows must be less than 2^31, found {n\_rows}‘)  
> 1064 if len(starts) != n\_rows or len(stops) != n\_rows:  
> → 1065 raise ValueError(f’starts and stops must both have length {n\_rows} (the number of rows)’)  
> 1066 if any([start \< 0 for start in starts]):  
> 1067 raise ValueError(‘all start values must be non-negative’)
> 
> ValueError: starts and stops must both have length 9232 (the number of rows)

I am not sure where to go from here. I’m using Hail version 0.2.14-8dcb6722c72a locally.

Any ideas would be great!  
Thanks,  
-Tim

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [May 30, 2019, 6:18pm UTC](https://discuss.hail.is/t/ld-prune-starts-and-stops-error/968/2 "2019-05-30T18:18:52Z")

</div>

tracking issue here: [https://github.com/hail-is/hail/issues/6223](https://github.com/hail-is/hail/issues/6223)
