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

cryptic error message when chromsizes is not formatted properly #142

Closed
sergpolly opened this issue Dec 27, 2018 · 1 comment
Closed

cryptic error message when chromsizes is not formatted properly #142

sergpolly opened this issue Dec 27, 2018 · 1 comment

Comments

@sergpolly
Copy link
Member

@nandankita discovered this recently:

that's the error one would get :

Command error:
  + cooler cload pairix --nproc 9 --assembly gal5 gal5Allele.chrom.sizes:1000 MNP-DT40-1-3-3-R1-T1__gal5.nodups.pairs.gz MNP-DT40-1-3-3-R1-T1__gal5.1000.cool
  /miniconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
    return f(*args, **kwds)
  Traceback (most recent call last):
    File "/miniconda3/bin/cooler", line 11, in <module>
      sys.exit(cli())
    File "/miniconda3/lib/python3.6/site-packages/click/core.py", line 722, in __call__
      return self.main(*args, **kwargs)
    File "/miniconda3/lib/python3.6/site-packages/click/core.py", line 697, in main
      rv = self.invoke(ctx)
    File "/miniconda3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/miniconda3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/miniconda3/lib/python3.6/site-packages/click/core.py", line 895, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File "/miniconda3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
      return callback(*args, **kwargs)
    File "/miniconda3/lib/python3.6/site-packages/cooler/cli/cload.py", line 248, in pairix
      chromsizes, bins = _parse_bins(bins)
    File "/miniconda3/lib/python3.6/site-packages/cooler/cli/cload.py", line 47, in _parse_bins
      bins = util.binnify(chromsizes, binsize)
    File "/miniconda3/lib/python3.6/site-packages/cooler/util.py", line 261, in binnify
      ignore_index=True)
    File "/miniconda3/lib/python3.6/site-packages/pandas/core/reshape/concat.py", line 225, in concat
      copy=copy, sort=sort)
    File "/miniconda3/lib/python3.6/site-packages/pandas/core/reshape/concat.py", line 256, in __init__
      objs = list(objs)
    File "/miniconda3/lib/python3.6/site-packages/cooler/util.py", line 249, in _each
      n_bins = int(np.ceil(clen / binsize))
  ValueError: cannot convert float NaN to integer

in case you screw up formatting in your .chrom.sizes, for example like this(pay attention to the hidden characters):
screenshot from 2018-12-27 15-46-57

this was too permissive:
https://github.com/mirnylab/cooler/blob/4ca715acfeb4b6f2d118589db5d1900339810f37/cooler/util.py#L197
and interpreted allele1 111111 as a chrom name with the corresponding "size" - NaN ...

  • Maybe enabling pd.read_csv(...verbose=True...) would have been helpful ?
  • There probably shouldn't by ANY NaNs in the .chrom.sizes file, could we leverage that - to catch such mistakes earlier ?
  • Maybe this is all too "exotic" of a case, cause people usually use this tools with standard genomes - not so sure ...
@nvictus
Copy link
Member

nvictus commented Jun 30, 2020

See #209

@nvictus nvictus closed this as completed Jun 30, 2020
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