Skip to content

Issues with mutationsTSV input #18

Description

@jmcbroome

I'm trying to use phastSim to simulate mutations onto the newick output from VGsim. Accordingly, I'm using --mutationsTSVinput to pass haplotype information from my VGsim simulations. However, phastSim fails with the following traceback when attempting to apply said mutations:

Traceback (most recent call last):
  File "/Users/jmcbr/opt/anaconda3/envs/vgsim/bin/phastSim", line 174, in <module>
    genome_tree.mutateBranchETEhierarchy(t, genome_tree.genomeRoot, 1, sim_run.args.createNewick, preMutationsBranches)
  File "/Users/jmcbr/opt/anaconda3/envs/vgsim/lib/python3.10/site-packages/phastSim/phastSim.py", line 1538, in mutateBranchETEhierarchy
    self.mutateBranchETEhierarchy(c, newGenomeNode, level + 1, createNewick, preMutationsBranches)
  File "/Users/jmcbr/opt/anaconda3/envs/vgsim/lib/python3.10/site-packages/phastSim/phastSim.py", line 1538, in mutateBranchETEhierarchy
    self.mutateBranchETEhierarchy(c, newGenomeNode, level + 1, createNewick, preMutationsBranches)
  File "/Users/jmcbr/opt/anaconda3/envs/vgsim/lib/python3.10/site-packages/phastSim/phastSim.py", line 1538, in mutateBranchETEhierarchy
    self.mutateBranchETEhierarchy(c, newGenomeNode, level + 1, createNewick, preMutationsBranches)
  [Previous line repeated 7 more times]
  File "/Users/jmcbr/opt/anaconda3/envs/vgsim/lib/python3.10/site-packages/phastSim/phastSim.py", line 1481, in mutateBranchETEhierarchy
    self.applyMutation(newGenomeNode, level, mutEvent)
  File "/Users/jmcbr/opt/anaconda3/envs/vgsim/lib/python3.10/site-packages/phastSim/phastSim.py", line 1397, in applyMutation
    node = parentGenomeNode.refNode
AttributeError: 'genomeNode' object has no attribute 'refNode'

It appears to be attempting to access uninitalized attributes- the genomeNode object passed as input to applyMutations in the recursive step (newGenomeNode, in mutateBranchETEhierarchy, line 1472) never has these attributes defined in its __init__ or afterwards. mutationsTSV input requires the hierarchical mode, so I cannot work around this.

I should note that I installed the latest version today simply with

pip install phastsim

So this is a current issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions