Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when providing data without PL #18

Open
dovivi opened this issue Aug 31, 2022 · 1 comment
Open

Error when providing data without PL #18

dovivi opened this issue Aug 31, 2022 · 1 comment

Comments

@dovivi
Copy link

dovivi commented Aug 31, 2022

Hi, I was testing the program but I get an error when parsing data that does not contain PL (either VCF file without PL or bed format).
To check if it was my input file I tried out with the provided bed data 701_502.filter.bed and got the same error.

(base) [user@host SNPmatch]$ snpmatch parser -v -i 701_502.filter.bed -o test
2022-08-31 17:32:58,070 - snpmatch.core.parsers - INFO - running snpmatch parser!
2022-08-31 17:32:58,071 - snpmatch.core.parsers - INFO - reading the position file
2022-08-31 17:32:58,100 - snpmatch.core.parsers - INFO - creating snpmatch parser file: test.npz
2022-08-31 17:32:58,117 - root - ERROR - ufunc 'add' did not contain a loop with signature matching types (dtype('<U2'), dtype('<U2')) -> None
Traceback (most recent call last):
  File "/home/user/miniconda3/lib/python3.9/site-packages/snpmatch/__init__.py", line 177, in main
    args['func'](args)
  File "/home/user/miniconda3/lib/python3.9/site-packages/snpmatch/__init__.py", line 134, in snpmatch_parser
    parsers.potatoParser(inFile = args['inFile'], logDebug =  args['logDebug'], outFile = args['outFile'])
  File "/home/user/miniconda3/lib/python3.9/site-packages/snpmatch/core/parsers.py", line 217, in potatoParser
    inputs = ParseInputs(inFile, logDebug, outFile)
  File "/home/user/miniconda3/lib/python3.9/site-packages/snpmatch/core/parsers.py", line 86, in __init__
    self.case_interpret_inputs(outFile + ".stats.json")
  File "/home/user/miniconda3/lib/python3.9/site-packages/snpmatch/core/parsers.py", line 113, in case_interpret_inputs
    statdict["depth"] = np.nanmean(self.dp)
  File "<__array_function__ internals>", line 180, in nanmean
  File "/home/user/miniconda3/lib/python3.9/site-packages/numpy/lib/nanfunctions.py", line 1034, in nanmean
    return np.mean(arr, axis=axis, dtype=dtype, out=out, keepdims=keepdims,
  File "<__array_function__ internals>", line 180, in mean
  File "/home/user/miniconda3/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 3432, in mean
    return _methods._mean(a, axis=axis, dtype=dtype,
  File "/home/user/miniconda3/lib/python3.9/site-packages/numpy/core/_methods.py", line 180, in _mean
    ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)
numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U2'), dtype('<U2')) -> None

Just to remark: when I provide a VCF file with PL I do not get the error.

== Update ==
I've just found where the problem comes from:
When parsing from .bed, DPmean is set to "NA" (line but afterwards this comuted statdict["depth"] = np.nanmean(self.dp) is called, which gives the error). The same happens with VCF file, if DP is not present (or not present in INFO), it is set to a list of "NA"s, giving afterwards the same error.

@baozg
Copy link

baozg commented Nov 7, 2024

Have you resloved this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants