bcm-uga / Loter

A software package for local ancestry inference and haplotype phasing
Other
38 stars 7 forks source link

UnboundLocalError: local variable 'res_loter' referenced before assignment #6

Closed alessandrotestori closed 5 years ago

alessandrotestori commented 5 years ago

Hi! I get this error when I run lc.loter_smooth following the tutorial.

import allel import numpy as np def vcf2npy(vcfpath): ... callset = allel.read_vcf(vcfpath) ... haplotypes_1 = callset['calldata/GT'][:,:,0] ... haplotypes_2 = callset['calldata/GT'][:,:,1] ...
... m, n = haplotypes_1.shape ... mat_haplo = np.empty((2*n, m)) ... mat_haplo[::2] = haplotypes_1.T ... mat_haplo[1::2] = haplotypes_2.T ...
... return mat_haplo.astype(np.uint8) ... import os

ceu_hap = vcf2npy(os.path.join(os.pardir, 'data', 'ceu.vcf')) yri_hap = vcf2npy(os.path.join(os.pardir, 'data', 'yri.vcf')) mex_hap = vcf2npy(os.path.join(os.pardir, 'data', 'mex.vcf')) import loter.locanc.local_ancestry as lc res_loter = lc.loter_smooth(l_H=[ceu_hap, yri_hap], h_adm=mex_hap, num_threads=4)

Traceback (most recent call last): File "", line 1, in File "/home/appl/Loter-master/python-package/loter/locanc/local_ancestry.py", line 295, in loter_smooth False) File "/home/appl/Loter-master/python-package/loter/locanc/local_ancestry.py", line 237, in loter_local_ancestry return r, res_loter UnboundLocalError: local variable 'res_loter' referenced before assignment

gdurif commented 5 years ago

Hi, Indeed, I just realized that I introduced this bug with the last commit (that was supposed to fix another issue). I'll fix before the end of the day tomorrow. Sorry for the trouble.

gdurif commented 5 years ago

This issue is now fixed. You can pull from master branch. Sorry again