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

Error while writing clusters #148

Closed
bglindner opened this issue Mar 24, 2023 · 2 comments
Closed

Error while writing clusters #148

bglindner opened this issue Mar 24, 2023 · 2 comments

Comments

@bglindner
Copy link

bglindner commented Mar 24, 2023

When recently running VAMB (4.0.0) I received the following error and VAMB quit with the vae_clusters.tsv table empty.

Traceback (most recent call last):
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/bin/vamb", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/__main__.py", line 1369, in main
    run(
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/__main__.py", line 824, in run
    cluster(
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/__main__.py", line 656, in cluster
    clusternumber, ncontigs = vamb.vambtools.write_clusters(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/vambtools.py", line 373, in write_clusters
    for clustername, contigs in clusters:
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/vambtools.py", line 647, in binsplit
    for binname, headers in clusters:
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/__main__.py", line 640, in <genexpr>
    renamed = (
              ^
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/cluster.py", line 260, in __next__
    cluster, _, points = self._findcluster()
                         ^^^^^^^^^^^^^^^^^^^
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/cluster.py", line 293, in _findcluster
    medoid, distances = _wander_medoid(
                        ^^^^^^^^^^^^^^^
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/site-packages/vamb/cluster.py", line 532, in _wander_medoid
    sampled_medoid = int(rng.choice(cluster).item())
                         ^^^^^^^^^^^^^^^^^^^
  File "/storage/home/hcoda1/4/blindner6/.conda/envs/vamb/lib/python3.11/random.py", line 369, in choice
    if not seq:
RuntimeError: Boolean value of Tensor with more than one value is ambiguous

I've installed VAMB via pip install. I also checked that my concatenated contig set was renamed with an appropriate delimiting strategy (with 'C' as the delimiter just to keep things consistent with your usage guide). Mapping was done with bwa-mem and then sorted BAMs were provided to VAMB. My call to VAMB was: vamb --outdir ${outdir} --fasta ${assembly} --bamfiles ${indir}/*.bam -o C

Wondering whether you have any immediate guidance based on the above. Thanks so much.

@madscort
Copy link

I just encountered the same error, bam files were created exactly as in the GitHub provided avamb snakemake workflow.

@jakobnissen
Copy link
Member

I found the issue. Vamb is not compatible with Python 3.11, since 3.11 changed the definition of Random.choice.
The short-term fix is to use Python 3.10 or below, but I'll get a fix pushed that makes it work with Python3.11

jakobnissen added a commit that referenced this issue Apr 3, 2023
After the embarrassment of #148, we should be more dilligent in testing and CI.
To make this work, I've had to remove the hash-based testing in test/result.py,
or rather, not name the file test_*.py in order to not add it to pytest.
jakobnissen added a commit that referenced this issue Apr 3, 2023
After the embarrassment of #148, we should be more dilligent in testing and CI.
To make this work, I've had to remove the hash-based testing in test/result.py,
or rather, not name the file test_*.py in order to not add it to pytest.
sgalkina pushed a commit to sgalkina/vamb that referenced this issue Jun 28, 2023
In Python 3.11, the definition for rng.choice(seq) got the following expression
added: `if not seq`. This internally calls `bool(seq)`, which throws an error
if `seq` has more than one element.
Now, pick random elements using `rng.randrange`, indexing into the tensor.

Closes RasmussenLab#148
sgalkina pushed a commit to sgalkina/vamb that referenced this issue Jun 28, 2023
After the embarrassment of RasmussenLab#148, we should be more dilligent in testing and CI.
To make this work, I've had to remove the hash-based testing in test/result.py,
or rather, not name the file test_*.py in order to not add it to pytest.
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

3 participants