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

binnify crashes for small genome ? #237

Closed
nservant opened this issue Apr 16, 2021 · 4 comments
Closed

binnify crashes for small genome ? #237

nservant opened this issue Apr 16, 2021 · 4 comments

Comments

@nservant
Copy link

Hi all,
I tried to run the binnify command on a small genome and it crashed

cooltools genome binnify chrom.size 1000 > genome_bins.txt
Traceback (most recent call last):
  File "/home/nservant/Apps/conda/envs/nf-core-hic-dev3/bin/cooltools", line 8, in <module>
    sys.exit(cli())
  File "/home/nservant/.local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/nservant/.local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/nservant/.local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nservant/.local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nservant/.local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/nservant/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/nservant/Apps/conda/envs/nf-core-hic-dev3/lib/python3.7/site-packages/cooltools/cli/genome.py", line 30, in binnify
    bins = bioframe.tools.binnify(chromsizes, binsize)
  File "/home/nservant/Apps/conda/envs/nf-core-hic-dev3/lib/python3.7/site-packages/bioframe/tools.py", line 80, in binnify
    axis=0, ignore_index=True)
  File "/home/nservant/.local/lib/python3.7/site-packages/pandas/core/reshape/concat.py", line 281, in concat
    sort=sort,
  File "/home/nservant/.local/lib/python3.7/site-packages/pandas/core/reshape/concat.py", line 329, in __init__
    raise ValueError("No objects to concatenate")
ValueError: No objects to concatenate

The reference genome is available here ;
https://github.com/nf-core/test-datasets/raw/hic/reference/W303_SGD_2015_JRIU00000000.fsa

In total, there are 236 contigs. I though that it could be due to one contig with a size smaller than the bin size, but even with 100 bp bin, I still have the error.
Thanks
N

@nvictus
Copy link
Member

nvictus commented Apr 19, 2021

Could you try:

cooltools genome binnify --all-names chrom.size 1000 > genome_bins.txt

@nservant
Copy link
Author

nservant commented Apr 19, 2021

Well done! It works.
Can I use the option --all-names by default ? for all reference genomes ?

@nvictus
Copy link
Member

nvictus commented Apr 19, 2021

Yes, and we should change the current default behavior. With --all-names no sorting happens.

Without --all-names it looks for patterns "chr[0-9]+$", "chr[XY]$", "chrM$" and sorts in them in that order. So it was filtering out everything in your case.

@nservant
Copy link
Author

Thanks @nvictus !

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