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

Minor: Bug fixes #529

Merged
merged 8 commits into from
Jun 14, 2024
Merged

Minor: Bug fixes #529

merged 8 commits into from
Jun 14, 2024

Conversation

@GopiGugan
Copy link
Contributor Author

Running into an error:

🏄 [5:29:08.903094] Identifying lineage representative genomes
Traceback (most recent call last):
  File "/home/covizu/covizu/batch.py", line 291, in <module>
    timetree, residuals = build_timetree(non_recomb, args, callback=cb.callback)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/covizu/covizu/covizu/utils/batch_utils.py", line 81, in build_timetree
    fasta = covizu.treetime.retrieve_genomes(by_lineage, known_seqs=lineages, ref_file=args.ref,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/covizu/covizu/covizu/treetime.py", line 214, in retrieve_genomes
    records = covizu.utils.batch_utils.unpack_records(records)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/covizu/covizu/covizu/utils/batch_utils.py", line 38, in unpack_records
    typ, pos, alt = mutation.split('|')
    ^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 1)

@GopiGugan
Copy link
Contributor Author

diff --git a/covizu/utils/batch_utils.py b/covizu/utils/batch_utils.py
index fb80882..aeb6bd1 100644
--- a/covizu/utils/batch_utils.py
+++ b/covizu/utils/batch_utils.py
@@ -35,7 +35,11 @@ def unpack_records(records):
         # reconstitute the mutations defining this variant
         diffs = []
         for mutation in key.split(','):
-            typ, pos, alt = mutation.split('|')
+            try:
+                typ, pos, alt = mutation.split('|')
+            except ValueError:
+                # Handle case when there are no diffs
+                continue
             if typ == '-':
                 alt = int(alt)  # number of nucleotides in indel
             diffs.append(tuple([typ, int(pos), alt]))

@GopiGugan
Copy link
Contributor Author

🏄 [6:43:12.942563] Recoding features, compressing variants..
Traceback (most recent call last):
  File "/home/covizu/covizu/batch.py", line 322, in <module>
    result, infection_prediction = make_beadplots(by_lineage, args, cb.callback, t0=cb.t0.timestamp(), updated_lineages=updated_lineages)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/covizu/covizu/covizu/utils/batch_utils.py", line 329, in make_beadplots
    union = dict([("{0}|{1}|{2}".format(*feat), idx) for feat, idx in union.items()])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/covizu/covizu/covizu/utils/batch_utils.py", line 329, in <listcomp>
    union = dict([("{0}|{1}|{2}".format(*feat), idx) for feat, idx in union.items()])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: Replacement index 1 out of range for positional args tuple

@ArtPoon
Copy link
Contributor

ArtPoon commented Jun 4, 2024

Patching #530 and rebuilding database

@GopiGugan
Copy link
Contributor Author

Database has been re-built successfully

@GopiGugan GopiGugan merged commit 0631f5e into master Jun 14, 2024
1 check passed
@ArtPoon
Copy link
Contributor

ArtPoon commented Jun 14, 2024

Has this been deployed to the webserver? Page is still displaying old data.

@GopiGugan
Copy link
Contributor Author

Has this been deployed to the webserver? Page is still displaying old data.

No, a dry run was done previously. I've started another run. The data will be updated by tomorrow

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

Successfully merging this pull request may close these issues.

2 participants