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

need better documentation for computing posterior for linear combinations of effects #130

Open
stephens999 opened this issue Oct 1, 2024 · 4 comments

Comments

@stephens999
Copy link
Collaborator

We can compute the posterior summaries Ab for any matrix A, but this is not well documented.

Here was a user request (by email)
we have a situation with stimulated and unstimulated cells. We've mapped eQTL for each cell type, and have run mash. What we're interested in is cases where the effect size differs in the stimulated and unstimulated condition. We've been identifying those based on the local false sign rates (e.g. requiring lfsr < 0.1 for discovery, and calling it a context-specific eQTL if the lfsr is > 0.2 or 0.5 in the other condition). It would be wonderful to have something more principled that doesn't rely on arbitrary cutoffs, such as a direct test of whether B1 = B2. Is it possible to extract those summaries from mash currently, or how can we go about doing so?

The answer is that we can do this using the matrix A in mash_compute_posterior_matrices
Eg the following runs mash on simulted 5 conditions, but computes posterior for B1-B2

simdata = simple_sims(50,5,1)
data = mash_set_data(simdata$Bhat, simdata$Shat)
m = mash(data, cov_canonical(data))
mash_compute_posterior_matrices(m,data,A=rbind(c(1,-1,0,0,0)))

The role of A could be better documented in the function (eg add this example), and perhaps also in a vignette.

@stephens999
Copy link
Collaborator Author

it seems the documentation for mash_compute_posterior_matrices and compute_posterior_matrices could be usefully combined?

@gaow
Copy link
Member

gaow commented Oct 1, 2024

A while ago, we looked into this with @yunqiyang0215 and generated a rough vignette
mashr_posterior_demo.R.txt
and a write-up on this application
mashr_posterior.pdf. This may not be exactly what you need but might be similar?

What we hope to achieve is, that for a fine-mapped variant, we can get the posterior difference between contexts, and assess its significance in terms of lfsr. This can be summarized in a figure like the following:

image

I don't think all the technical details are correct now as you can see the lfsr is off. But if this is aligned with what you have in mind, we'd be happy to formalize this as a vignette to users.

@TaurVil
Copy link

TaurVil commented Oct 25, 2024

Thank you, this was very useful! Can you clarify some things about the process and output for me?

  • The A matrix is essentially asking if the -1 and +1 betas are different, right? How should I think about this comparison if I wanted to do multiple comparisons (e.g. A = c(-1, 1, -1, 1, 0, 0, 0, 0))?
  • How are the lfdr and lfsr being calculated?

@gaow
Copy link
Member

gaow commented Oct 25, 2024

@TaurVil I'm working with @yunqiyang0215 to polish up as a pull request to the mashr package for other co-authors to review ... please allow me to touch base with @yunqiyang0215 and get back on this. If it takes longer than I hope I'll get back on more details here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants