sourmash-bio / sourmash_plugin_randsampling

kmers extraction based on weighted-random-sampling
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Zipped sig returns error #1

Open ccbaumler opened 1 year ago

ccbaumler commented 1 year ago

The following command returns and error:

sourmash scripts randsampling -k 21 --sig ERR11520689.k21.sig.zip --max-kmers 1000 --plot -o sub/test.subsample.sig.zip

The error:


== This is sourmash version 4.8.3. ==
== Please cite Brown and Irber (2016), doi:10.21105/joss.00027. ==

Traceback (most recent call last):
  File "/home/baumlerc/miniconda3/envs/sourmash/lib/python3.8/site-packages/sourmash/signature.py", line 437, in load_one_signature
    first_sig = next(sigiter)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/baumlerc/miniconda3/envs/sourmash/bin/sourmash", line 11, in <module>
    sys.exit(main())
  File "/home/baumlerc/miniconda3/envs/sourmash/lib/python3.8/site-packages/sourmash/__main__.py", line 19, in main
    retval = mainmethod(args)
  File "/home/baumlerc/miniconda3/envs/sourmash/lib/python3.8/site-packages/sourmash_plugin_RandSampling.py", line 137, in main
    sig = sourmash.load_one_signature(args.sig, ksize=args.k)
  File "/home/baumlerc/miniconda3/envs/sourmash/lib/python3.8/site-packages/sourmash/signature.py", line 439, in load_one_signature
    raise ValueError("no signatures to load")
ValueError: no signatures to load

The argument works perfectly without a zip file

I think this may be fixed by changing the line to sourmash.load_file_as_signatures().

ccbaumler commented 1 year ago

I would be happy to work on this when I figure out how to properly edit a sourmash plugin.

mr-eyes commented 1 year ago

I think a quick fix would be to replace the loading code with something like that

https://github.com/ctb/sourmash_plugin_commonhash/blob/4a3b982f0a832d7dbde3e0ff50e41d5a3f024af1/src/sourmash_plugin_commonhash.py#L69-L75