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

Add input validation for out of bounds column numbers #135

Closed
pkerpedjiev opened this issue Sep 24, 2018 · 1 comment
Closed

Add input validation for out of bounds column numbers #135

pkerpedjiev opened this issue Sep 24, 2018 · 1 comment

Comments

@pkerpedjiev
Copy link
Collaborator

When I run cooler cload -c1 1 -p1 2 -c2 4 - p2 5 .. on a file with four columns:

galactic        1601634 galactic        1125339
galactic        1601743 galactic        1135340
galactic        1597121 galactic        1126359
galactic        1598993 galactic        1135185
galactic        1597588 galactic        1125826

The error I get is:

Traceback (most recent call last):
  File "/Users/peter/miniconda3/envs/cenv3/bin/cooler", line 11, in <module>
    load_entry_point('cooler', 'console_scripts', 'cooler')()
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/peter/projects/cooler.mirnylab/cooler/cli/cload.py", line 409, in pairs
    ensure_sorted=False
  File "/Users/peter/projects/cooler.mirnylab/cooler/io.py", line 510, in create_from_unordered
    create(cool_uri, bins, chunks, columns=columns, dtype=dtype, **kwargs)
  File "/Users/peter/projects/cooler.mirnylab/cooler/io.py", line 286, in create
    file_path, target, meta.columns, iterable, h5opts, lock)
  File "/Users/peter/projects/cooler.mirnylab/cooler/_writer.py", line 203, in write_pixels
    for i, chunk in enumerate(iterable):
  File "/Users/peter/projects/cooler.mirnylab/cooler/_binning.py", line 701, in __iter__
    ignore_index=True)
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/pandas/tools/merge.py", line 1334, in concat
    copy=copy)
  File "/Users/peter/miniconda3/envs/cenv3/lib/python3.6/site-packages/pandas/tools/merge.py", line 1367, in __init__
    raise ValueError('No objects to concatenate')
ValueError: No objects to concatenate

A much more informative error would be that the column I specified for p2 is invalid since the file only has 4 columns.

@nvictus
Copy link
Member

nvictus commented Jun 30, 2020

Migrating to #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