mgalardini / pyseer

SEER, reimplemented in python 🐍🔮
http://pyseer.readthedocs.io
Apache License 2.0
109 stars 27 forks source link

TypeError: unsupported operand type(s) for /: 'str' and 'int' #139

Closed Morteza-M-Saber closed 3 years ago

Morteza-M-Saber commented 3 years ago

Running pyseer enet model on a dataset with continuous labels (ranging from -19 to 28) :

pyseer --wg enet --phenotypes phenotypes --vcf data.vcf --cpu 2 > pyseerEnet.txt

I get the following error:

Read 700 phenotypes
Detected continuous phenotype
Reading all variants

0variants [00:00, ?variants/s]
70variants [00:00, 697.21variants/s]
123variants [00:00, 635.66variants/s]
.
.
.
92503variants [02:38, 502.04variants/s]
92533variants [02:38, 584.71variants/s]
Applying correlation filtering
Traceback (most recent call last):
  File "/home/masih/.local/easybuild/software/2017/Core/miniconda3/4.3.27/envs/MLBenchmarker/bin/pyseer", line 10, in <module>
    sys.exit(main())
  File "/home/masih/.local/easybuild/software/2017/Core/miniconda3/4.3.27/envs/MLBenchmarker/lib/python3.6/site-packages/pyseer/__main__.py", line 605, in main
    cor_filter = correlation_filter(p, all_vars, options.cor_filter)
  File "/home/masih/.local/easybuild/software/2017/Core/miniconda3/4.3.27/envs/MLBenchmarker/lib/python3.6/site-packages/pyseer/enet.py", line 336, in correlation_filter
    b = p.values - np.mean(p.values)
  File "<__array_function__ internals>", line 6, in mean
  File "/home/masih/.local/easybuild/software/2017/Core/miniconda3/4.3.27/envs/MLBenchmarker/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 3373, in mean
    out=out, **kwargs)
  File "/home/masih/.local/easybuild/software/2017/Core/miniconda3/4.3.27/envs/MLBenchmarker/lib/python3.6/site-packages/numpy/core/_methods.py", line 172, in _mean
    ret = ret / rcount
TypeError: unsupported operand type(s) for /: 'str' and 'int'

I could not figure out what is going wrong here!

Morteza-M-Saber commented 3 years ago

It was due to an 0 written as 'o' in phenotype file!

johnlees commented 3 years ago

Ah, an accidental character is usually the issue with these! We should add a check on type