-
Notifications
You must be signed in to change notification settings - Fork 46
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
Using known cell type fractions #90
Comments
Hi Oriol,
Apologize for the delay.
Thank you for your interest in our method. To answer your question, it is
generally not recommended to use the known fractions due to the reason that
the cell type fraction inferred by BayesPrism represents reads% from each
cell type rather than cell count%. I assume that the known fraction you
mentioned would represent cell count%, so if you would like to rely on this
information to impute gene expression, you may need to first convert it to
reads% by multiplying a cell size factor, e.g. inferred from scRNA-seq.
After this, you can then compute the expected mean of cell
type-specifc gene expression conditional on bulk data and reads% of each
cell type using the following function, which is essentially a part of the
Gibbs sampling of BayesPrism .
#' function to compute E[Z | X, theta, phi], the expected cell
type-specific gene expression Z
#' conditional on observed mixture X, cell type fraction theta and
scRNA-seq reference phi
#'
#' @param X, observed mixture, a N-by-G matrix
#' @param theta, MAP estimator of cell type fraction, a N-by-K matrix
#' @param phi, scRNA-seq reference, a K-by-G matrix
E.Z <- function(X,
theta,
phi){
N <- nrow(X)
G <- ncol(phi)
K <- nrow(phi)
Z <- array(NA,c(N, G, K),
dimnames=list(rownames(X),colnames(X),rownames(phi)))
X_over_theta_phi <- X / (theta %*% phi) #N*G
for(n in 1:N) {
Z[n,,] <- t(phi * theta[n,]) * X_over_theta_phi[n,]
}
return(Z)
}
Best,
Tinyi
…On Wed, Jun 19, 2024 at 5:57 AM Oriol Pich ***@***.***> wrote:
Dear Tinyi,
Thanks so much for developing (and maintaining) such great software.
This is more of a question rather than an issue. We were wondering whether
it would be possible to start from known fractions and use BayesPrism to do
in sillico gene expression purification of the different cell-types.
Thanks so much in advance.
Best wishes,
Oriol
—
Reply to this email directly, view it on GitHub
<#90>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4NHS4IWOT6JPP5GD7RMDTZIFIYPAVCNFSM6AAAAABJRW5BUKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM3DCOJRHA2TINQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Fantastic, thanks Tinyi! |
Hi Tinyi,
Thanks a lot! Oriol |
Dear Tinyi,
Thanks so much for developing (and maintaining) such great software.
This is more of a question rather than an issue. We were wondering whether it would be possible to start from known fractions and use BayesPrism to do in sillico gene expression purification of the different cell-types.
Thanks so much in advance.
Best wishes,
Oriol
The text was updated successfully, but these errors were encountered: