AlphaGenes / AlphaImpute2

AlphaImpute2: pedigree- and population-based genotype imputation
MIT License
11 stars 6 forks source link

IndexError: tuple index out of range #37

Open Sendong98 opened 5 months ago

Sendong98 commented 5 months ago

Hi I'm trying to do some imputation checks by masking the genotype data and it worked well with the original file but always get errors when I use the file that I added random 9(missing value) into the genotype file: File "/home1/p314480/.local/lib/python3.10/site-packages/alphaimpute2/Imputation/BurrowsWheelerLibrary.py", line 65, in setup_library bw_loci = np.array(range(self.haplotypes.shape[1]), dtype = np.int64) IndexError: tuple index out of range How could I solve this problem? Thank you!

gregorgorjanc commented 5 months ago

@Sendong98 this is odd. Can you provide a reproducible example?

Sendong98 commented 5 months ago

Of course, here's an example for the Alphaimpute example genotype file: I added random 9 and got the error during imputation. original file (genotype and pedigree data )downloaded from https://github.com/AlphaGenes/AlphaImpute2/tree/main/example masked 10% genotype data generated by adding random missing value command used: AlphaImpute2 -genotypes genotypes_mask10.txt -pedigree pedigree.txt -out test -writekey genotypes -onlykeyed -cycles 10 -maxthreads 12 genotypes_mask10.txt genotypes_original.txt pedigree.txt

yqiqichen commented 5 months ago

I can reproduce the error on my end. And I will try to identify the cause of the error.

yqiqichen commented 1 month ago

I have found out the cause of the error. It is because if there are a lot of '9' in 'genotypes.txt' file, 'self.haplotypes' of function 'setup_library' in file 'BurrowsWheelerLibrary.py' has shape (0,), but we use self.haplotypes.shape[1], which does not exist and leads to the error. I have now modified the function 'setup_library'.