PoonLab / HexSE

Simulation of molecular evolution with overlapping reading frames
GNU General Public License v3.0
4 stars 2 forks source link

Issues faced after running all test classes in tests\test_sequence_info.py #130

Closed SandeepThokala closed 1 year ago

SandeepThokala commented 1 year ago

Issues faced after fixing KeyError: 'orf_map' by making the following changes in Sequence class of sequnce_info.py

line 132
- orf_map = sum([codon.orf['orf_map'] for codon in nt.codons])
+ orf_map = sum([codon.orf.get('orf_map', np.array([1] + [0]*(len(self.number_orfs) - 1))) for codon in nt.codons])

line 371
- codon_orf = codon.orf['orf_map']  # tuple of 1s and 0s Eg., (1, 0, 0)
+ codon_orf = codon.orf.get('orf_map', np.array([1] + [0]*(len(self.number_orfs) - 1)))

Issues: AssertionError while running testCreateEventTree, testSetSubstitutionRates, testCreateProbabilityTree, testNtInEventTree, testCheckMutationRates

AttributeError while running testCountNtsOnEventTree, testCreateProbabilityTree, testCountNtsOnEventTree

Updated the tests

SandeepThokala commented 1 year ago
SandeepThokala commented 1 year ago

Updated all setUp() methods of all test classes by adding 'orf_map' key to orfs TestSequence1 for example:

         orfs = {'+0': [{'coords': [[0, 21]],
                         'omega_classes': 3, 'omega_shape': 1.5,
-                        'omega_values': [0.1708353283825978, 0.4810288100937172, 1.1481358615121404]}],
+                        'omega_values': [0.1708353283825978, 0.4810288100937172, 1.1481358615121404],
+                        'orf_map': np.array([1])}], 
                 '+1': [], '+2': [], '-0': [], '-1': [], '-2': []}

And fixed the AssertionError by adding a new line random.seed(4001) (line: 797 in File ".tests\test_sequence_info.py") before setting substitution rates for # Non-synonymous mutation in both (+) and (-) strands