-
Notifications
You must be signed in to change notification settings - Fork 9
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
Error in Differential Expression testing after spatialdecon and reverseDecon #36
Comments
Hi Maddy, I take the reverseDecon output, "rdecon" in my case, and, for each sample, I generate cell type specific gene expression levels. See blow for an example: for (i in 1:ncol(norm)) I am not sure this is correct. Anyway, the resulting cell type specific gene expression matrix, normAstro is a gene X sample matrix, with the same gene names and sample IDs as the original matrix. I then add it to the NanoStringGeoMxSet and git is a 'name', as follow: Then I try to test for differential expression as described in my previous post. Unless there is a problem with the way I add the assayDataElement to the NanoStringGeoMxSet, I cannot see the matrix format to be a problem. Thanks |
Hi Gianfilippo, I was reading your issue incorrectly and noticed my mistake right after I sent my previous comment. I am looking into your issue, now that I understand it correctly, and I will get back to you shortly. Maddy |
Hi Gianfilippo, So you are creating the cell type specific gene expression levels in the expected format so that is not the issue. The issue seems to stem from the significant number of zeros that are created from generating this matrix. Our biostatistician suggests
But if you don't want to reduce the gene list that much, you at least need to remove the genes that have zeros across all of the samples. Having the same value across the row is causing the standard deviation error. Maddy |
How naive of me!! I did not think about re-filtering the matrix. Thank you (and your biostatistician) for noticing it. I will let you know how it goes |
ok, I made some changes but I am still having problems. I get the following error Error in if (maxmingrad > ccl$tol) { : Can you please help ? Below is what I did. In the first few lines, I create a copy of the original data, then I filter out from the Copy data obj
Add cell type specific matrix to data Obj and store into "q_norm_Astro" assay element
Filter genes. Keep only genes with a min expr of 0.0001 in 9 samples or more
log cell type specific matrix and store into "log_q_norm_Astro" assay element
get index for Astrocyte specific samples to be tested
|
Hi, I think I found the issue. In reality this intercept, as I understand it, is part of the model for overall gene expression. So, when I removed it, and estimated cell type gene expression as |
Hi Gianfilippo,
|
Hi,
could you please clarify how to run Differential Expression on the cell type specific data generated by reverseDecon ?
Below is what I did so far:
I followed the GeoMxWorkflows tutorial to QC, filter, process the data from DCC files
Next, I used assayData(myData)[["q_norm"]] as final matrix for analysis and tried to follow the SpatialDecon tutorial:
norm = assayData(myData)[["q_norm"]]
infer background using derive_GeoMx_background
run the spatialdecon function as follow:
spatialdecon(norm = norm, bg = bg, X = mouseAllenBrain, align_genes = TRUE)
where mouseAllenBrain = download_profile_matrix(species = "Mouse", age_group = "Adult", matrixname = "Brain_AllenBrainAtlas")
Then I used reverseDecon to get cell type specific gene expression levels
rdecon = reverseDecon(norm = norm, beta = res$beta)
from here I derived the cell type specific gene expression levels (not sure about this).
for instance, for Actrocytes,
for (i in 1:ncol(norm)) normAstro[,i] = rdecon$coefs[,"Astro"] * res$beta["Astro",i] + rdecon$coefs[,1]
the normAstro matrix has some entries equal (or very close) to zero, so, log2(normAstro) not an option. I use log2(normAstro+1)
and assign it to the GeoMXset object
assayDataElement(object = myData, elt = "log_q_norm_Astro") = log2(normCellType[["Astro"]]+1.0)
At this point I do differential expression testing as follow (as in the tutorial) for each segment.
NOTE: the experimental design is such that each slide has both "Ref" and "Pert" in testClass, but I may have two slides each individual, so I used a LMM without random slope
The code crashes at this point with the following error
"log_q_norm_Astro"
Error in checkForRemoteErrors(val) :
20 nodes produced errors; first error: invalid class “corMatrix” object: 'sd' slot has non-finite entries
Please let me know if you need more details
Thanks
Gianfilippo
The text was updated successfully, but these errors were encountered: