brentp / peddy

genotype :: ped correspondence check, ancestry check, sex check. directly, quickly on VCF
MIT License
134 stars 39 forks source link

IndexError: arrays used as indices must be of integer (or boolean) type #75

Closed numicator closed 4 years ago

numicator commented 4 years ago

Hi, I run into an issue:

Traceback (most recent call last):
  File "/apps/python3/3.7.4/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/apps/python3/3.7.4/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "peddy/peddy/__main__.py", line 14, in <module>
    sys.exit(cli())
  File "pythonlib/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "pythonlib/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "pythonlib/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "pythonlib/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "peddy/peddy/cli.py", line 271, in peddy
    excl = correct_sex_errors(ped_df)
  File "peddy/peddy/cli.py", line 105, in correct_sex_errors
    osc[sel] = ito
IndexError: arrays used as indices must be of integer (or boolean) type

quick solution: change cli.py" line 104: from: sel = (gt & sf & (sc == ifrom)) to: sel = (gt & sf & (sc == ifrom)) != 0

Disclaimer: I am not a python programmer and it was a really quick fix without much (any) thinking. Cheers, Marcin

roryk commented 4 years ago

I see something similar with peddy 0.4.4:

  File "/home/rdk4/local/share/bcbio/anaconda/envs/python2/lib/python2.7/site-packages/peddy/cli.py", line 226, in peddy
    da = df.iloc[df['sample_duplication_error'], 'sample_a']
  File "/home/rdk4/local/share/bcbio/anaconda/envs/python2/lib/python2.7/site-packages/pandas/core/indexing.py", line 1494, in __getitem__
    return self._getitem_tuple(key)
  File "/home/rdk4/local/share/bcbio/anaconda/envs/python2/lib/python2.7/site-packages/pandas/core/indexing.py", line 2143, in _getitem_tuple
    self._has_valid_tuple(tup)
  File "/home/rdk4/local/share/bcbio/anaconda/envs/python2/lib/python2.7/site-packages/pandas/core/indexing.py", line 223, in _has_valid_tuple
    self._validate_key(k, i)
  File "/home/rdk4/local/share/bcbio/anaconda/envs/python2/lib/python2.7/site-packages/pandas/core/indexing.py", line 2060, in _validate_key
    raise NotImplementedError("iLocation based boolean "
NotImplementedError: iLocation based boolean indexing on an integer type is not available
brentp commented 4 years ago

will you give the latest commit a try?

roryk commented 4 years ago

Thanks, that fixed it! If you cut a new release I'll fix the bioconda package for it.

brentp commented 4 years ago

tagged 0.4.5 and uploaded to pypi. thank you!

roryk commented 4 years ago

Great, bioconda looks all set. Thanks so much, hope you and your family are holding up well!

brentp commented 4 years ago

I have a user reporting a conda error on 0.4.5 (she was seeing it previously as well), I am trying to get more details. Thanks for doing this.

Family is doing well so far. Hope you and yours are well too!

roryk commented 4 years ago

Thanks, happy to help fix it once we can get some more information.