PoonLab / covizu

Rapid analysis and visualization of coronavirus genome variation
https://filogeneti.ca/CoVizu/
MIT License
45 stars 20 forks source link

Minor: Bug fixes #529

Closed GopiGugan closed 2 months ago

GopiGugan commented 2 months ago
GopiGugan commented 2 months ago

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 commented 2 months ago
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 commented 2 months ago
🏄 [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 commented 2 months ago

Patching #530 and rebuilding database

GopiGugan commented 2 months ago

Database has been re-built successfully

ArtPoon commented 2 months ago

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

GopiGugan commented 2 months ago

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