Skip to content
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

Model.wildtype_df BUG #106

Closed
jgallowa07 opened this issue Jul 21, 2023 · 3 comments
Closed

Model.wildtype_df BUG #106

jgallowa07 opened this issue Jul 21, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@jgallowa07
Copy link
Member

jgallowa07 commented Jul 21, 2023

Was running through the spike analysis with multidms 1.9, and found a bug when using Model.wildtype_df.

It's predictions do not match what I get when I crunch the numbers directly from the parameters given in Model.get_mutations_df() + offsets. Concretely

Here is what the method is telling me.

             predicted_latent  predicted_func_score
Delta               -5.285840             -3.343554
Omicron_BA1         -0.853382             -0.103837
Omicron_BA2         -3.605787             -3.107373

but, when I predict the latent wildtype of BA2 by hand

converted_subs = model.data.convert_subs_wrt_ref_seq("Omicron_BA2", "")
print(converted_subs)
# 'T19I A27S V67A I95T I212L V213G L371F T376A D405N R408S S446G S496G K547T K856N F981L'
enc = bmap.sub_str_to_binary(converted_subs)
ba2_non_i_params = model.get_mutations_df(phenotype_as_effect=False).query("mutation.isin(@converted_subs.split())")
latent = (ba2_non_i_params.beta + ba2_non_i_params.shift_Omicron_BA2).sum()
offset = model.params["beta_naught"] + model.params["alpha_Omicron_BA2"]
BA2_wildtype = latent + offset
BA2_wildtype 
-0.7806519

returns $-0.7806519$ as opposed to $-3.605787$ as shown above.

This actually does not effect the spike analysis almost at all, however, that's because we're not looking at the WT "effect" in our analysis - but I'm certain this could be causing @jbloom issues (sorry! 😬).

That being said all the spike results identical! I'll be taking a look at this with fresh eyes tomorrow am.

@jgallowa07
Copy link
Member Author

Er maybe it's not causing issues, yet, if you're only fitting single condition/experiment models

@jgallowa07 jgallowa07 changed the title wildtype_df BUG Model.wildtype_df BUG Jul 21, 2023
@jgallowa07
Copy link
Member Author

Oh, I never pass the condition to from_latent or from_binary. Assuming this is the problem - will fix soon.

@jbloom
Copy link
Collaborator

jbloom commented Jul 21, 2023

I haven't noticed this yet because so far I'm just fitting a single condition.

@jgallowa07 jgallowa07 added the bug Something isn't working label Jul 21, 2023
jgallowa07 added a commit that referenced this issue Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants