Open hardingnj opened 4 years ago
Thanks, this certainly looks like a bug. Though not one I can immediately identify. Let me look into it!
Is this problem solved? I also report the same error.
xpclr -I ./PIGs.SNPs.chr.vcf -O ./Chr01.xpclr-LM.out -C chr1 -Sa ./pop.DL.table -Sb ./pop.DM.table --rrate 1e-8 --ld 0.95 --size 100000 --step 10000
2021-09-12 10:36:05 : INFO : Done dropping above SNPs from analysis. XP-CLR algorithm starting.
Traceback (most recent call last):
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/bin/xpclr", line 195, in <module>
main()
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/bin/xpclr", line 181, in main
model_lik, null_lik, selcoef, nsnps, navail, snpedges = xpclr.methods.xpclr_scan(
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/lib/python3.8/site-packages/xpclr/methods.py", line 283, in xpclr_scan
geneticd = bpositions * rrate
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/lib/python3.8/site-packages/allel/abc.py", line 133, in __mul__
return self.values * other
numpy.core._exceptions.UFuncTypeError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U11'), dtype('<U11')) -> dtype('<U11')
When I delete the parameter -R and the rrate,It has a new error.
2021-09-12 12:36:55 : INFO : Omega estimated as : 0.062348
Traceback (most recent call last):
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/bin/xpclr", line 195, in <module>
main()
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/bin/xpclr", line 181, in main
model_lik, null_lik, selcoef, nsnps, navail, snpedges = xpclr.methods.xpclr_scan(
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/lib/python3.8/site-packages/xpclr/methods.py", line 320, in xpclr_scan
weights = determine_weights(gt2.take(ix, axis=0), ldcutoff=ldcutoff,
File "/home/lcs/Data/opt/biosoft/miniconda3/envs/xpclr/lib/python3.8/site-packages/xpclr/methods.py", line 270, in determine_weights
above_cut = (squareform(ld**2) > ldcutoff) | (squareform(np.isnan(ld)))
TypeError: '>' not supported between instances of 'numpy.ndarray' and 'str'
After I delete the parameter --ld, it worked.
Thanks. Looks like the same bug:
https://github.com/hardingnj/xpclr/blob/a555c442b6ce9deff5ecff6e3080a5bde0acb557/bin/xpclr#L57
Seems that LD should be interpreted as a float, but something is not correct.
@hardingnj Hi, Nick, Seems I got similar dtype problem with the parameter -R ( --rrate ). My input variation data is vcf.gz format. My code is :
xpclr --format vcf -Sa "....." -Sb "....." -R 2.5e-06 -C 1 -I input.vcf.gz ... (this code worked for me in the old version)
It stopped after reading vcf and dropping some SNPs. It showed that : Traceback (most recent call last): File "/opt/miniconda2/bin/xpclr", line 195, in
main()
File "/opt/miniconda2/bin/xpclr", line 185, in main
rrate=args.rrate)
File "/opt/miniconda2/lib/python2.7/site-packages/xpclr/methods.py", line 287, in xpclr_scan
geneticd = bpositions rrate
File "/opt/miniconda2/lib/python2.7/site-packages/allel/abc.py", line 136, in mul
return self.values other
TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S11') dtype('S11') dtype('S11')
I changed 2.5e-06 to 1e-8 which is the same as the default. It still stopped there. I also changed it to 0.0000025, It still stopped there. When I delete the parameter -R and the rrate, it worked fine with the default rrate value 1e-08:
2019-11-29 16:43:24 : INFO : Done dropping above SNPs from analysis. XP-CLR algorithm starting. 2019-11-29 16:43:24 : INFO : No genetic distance provided; using rrate of 1e-08/bp 2019-11-29 16:43:25 : INFO : Omega estimated as : 0.355998
I tried to update numpy scipy pandas h5py and zarr to the newest version, but it didn't help.
Originally posted by @Dkyuan in https://github.com/hardingnj/xpclr/issues/43#issuecomment-559806844