PoonLab / covizu

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

Error while running testBeadplotSerial #453

Closed SandeepThokala closed 1 year ago

SandeepThokala commented 1 year ago
======================================================================
ERROR: testBeadplotSerial (tests.test_batch_utils.TestBeadplotSerial)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sandeep/covizu/tests/test_batch_utils.py", line 69, in testBeadplotSerial
    result = beadplot_serial(lineage, features, args)
  File "/home/sandeep/covizu/covizu/utils/batch_utils.py", line 89, in beadplot_serial
    trees, labels = clustering.build_trees(features, args, callback=callback)
  File "/home/sandeep/covizu/covizu/clustering.py", line 218, in build_trees
    union, labels, indexed = recode_features(records, callback=callback)
  File "/home/sandeep/covizu/covizu/clustering.py", line 33, in recode_features
    for muts, variant in records.items():
AttributeError: 'list' object has no attribute 'items'

----------------------------------------------------------------------

Tried to fix the above error by making the following changes

         lineage = 'B.1.1.171'
-        features = [
-            {
-                'covv_virus_name' : 'hCoV-19/Canada/Qc-L00240569/2020',
-                'covv_accession_id' : 'EPI_ISL_465679',
-                'covv_collection_date': '2020-03-27',
-                'covv_lineage' : 'B.1.1.171',
-                'diffs' : [
-                    tuple(['~', 240, 'T']),
-                    tuple(['~', 1436, 'T']),
-                    tuple(['~', 3036, 'T']),
-                    tuple(['~', 3713, 'T']),
-                    tuple(['~', 5883, 'T']),
-                    tuple(['~', 14407, 'T']),
-                    tuple(['~', 20543, 'T']),
-                    tuple(['~', 23402, 'G']),
-                    tuple(['~', 28880, 'A']),
-                    tuple(['~', 28881, 'A']),
-                    tuple(['~', 28882, 'C'])
-                ],
-                'missing' : [
-                    tuple([0, 6]),
-                    tuple([5203, 5222]),
-                    tuple([29844, 29903])
-                ]
-            }
-        ]
-        args = Namespace(boot_cuttoff=0.5)
+        features = {'~|30|C,~|32|A':
+                        [{'covv_virus_name': 'hCoV-19/Canada/Qc-L00240594/2020',
+                          'covv_accession_id': 'EPI_ISL_465680',
+                          'covv_collection_date': '2020-03-27',
+                          'covv_lineage': 'B.1.1.171',
+                          'diffs' : [
+                            tuple(['~', 240, 'T']),
+                            tuple(['~', 1436, 'T']),
+                            tuple(['~', 3036, 'T']),
+                            tuple(['~', 3713, 'T']),
+                            tuple(['~', 5883, 'T']),
+                            tuple(['~', 14407, 'T']),
+                            tuple(['~', 20543, 'T']),
+                            tuple(['~', 23402, 'G']),
+                            tuple(['~', 28880, 'A']),
+                            tuple(['~', 28881, 'A']),
+                            tuple(['~', 28882, 'C'])
+                         ],
+                          'missing': [
+                            tuple([0, 6]),
+                            tuple([29844, 29903]),
+                            tuple([5203, 5222]),
+                         ]}]
+                   }
+        args = Namespace(boot_cutoff=0.5, nboot=0)
         result = beadplot_serial(lineage, features, args)

But faced the following error

======================================================================
ERROR: testBeadplotSerial (tests.test_batch_utils.TestBeadplotSerial)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sandeep/covizu/tests/test_batch_utils.py", line 53, in testBeadplotSerial
    result = beadplot_serial(lineage, features, args)
  File "/home/sandeep/covizu/covizu/utils/batch_utils.py", line 89, in beadplot_serial
    trees, labels = clustering.build_trees(features, args, callback=callback)
  File "/home/sandeep/covizu/covizu/clustering.py", line 218, in build_trees
    union, labels, indexed = recode_features(records, callback=callback)
  File "/home/sandeep/covizu/covizu/clustering.py", line 38, in recode_features
    label = "{covv_virus_name}|{covv_location}|{covv_accession_id}|{covv_collection_date}".format(**sample)
KeyError: 'covv_location'

----------------------------------------------------------------------

Then tried to run the test again after adding a 'covv_location': '', key to features But facing the following error

======================================================================
ERROR: testBeadplotSerial (tests.test_batch_utils.TestBeadplotSerial)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sandeep/covizu/tests/test_batch_utils.py", line 53, in testBeadplotSerial
    result = beadplot_serial(lineage, features, args)
  File "/home/sandeep/covizu/covizu/utils/batch_utils.py", line 101, in beadplot_serial
    for coldate, accn, label1 in intermed:
ValueError: too many values to unpack (expected 3)

----------------------------------------------------------------------
ArtPoon commented 1 year ago

fix waiting in dev branch

ArtPoon commented 1 year ago

@GopiGugan pointed out that the affected code is actually deprecated, so we can deactivate this unit test for now, and maybe remove the code later