-
Notifications
You must be signed in to change notification settings - Fork 2
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
add isotype to mutation model simulation #83
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple comments on isotype mutations
gctree/isotyping.py
Outdated
def mutate(self, lambda0=0.01): | ||
"""Returns a new isotype object, which may be of the same class, or may be | ||
a later class. | ||
""" | ||
newisotype = self.copy() | ||
if scipy.random.poisson(lambda0) > 0: | ||
n = len(self.order) - newisotype.isotype | ||
if n != 1: | ||
newisotype.isotype = self.isotype + scipy.random.randint(1, n) | ||
return newisotype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the Poisson rv here—you are using it to make a binary choice? Shouldn't n
be based on the Poisson draw, rather than drawn uniformly (but then truncated based on the terminal isotype)?
I would also suggest documenting lambda0
in the docstring.
It's also implicit here that this function simulates for one unit of simulation time, so I wonder if it would be better to put this code in the mutation_model.MutationModel.simulate
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yes this doesn't make sense... I wrote this deferring thought and then forgot to come back and think about it.
I'm not sure how this should be done, though. I think we talked about fixing a probability of switching occurring and then choosing uniformly from the available states. I'm not sure if we want to choose from the available states according to a poisson process, because it's not clear that one isotype transition is more likely than another.
So I propose changing lambda0
to p
, which is the probability that class switching will occur in one time step, and replacing line 168 with a comparison of p to a uniform draw from the unit interval.
What I've done instead is add a parameter |
Without otherwise changing the simulation in
mutation_model.MutationModel.simulate
, adds isotype switching according to a new rate parameterisotype_lambda
.