Comments (12)
A good place to learn is this guide from the developers of edgeR: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7873980/
Milo uses largely the same syntax and format for model contrasts.
from milor.
A good place to learn is this guide from the developers of edgeR: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7873980/
Milo uses largely the same syntax and format for model contrasts.
Thank you for reply. I went through the paper and multiple comparison vignette many times. https://bioconductor.org/packages/release/bioc/vignettes/miloR/inst/doc/milo_contrasts.html
My above pipeline always gives me the identical results. I am almost sure testNhoods(Bcells_milo, design=~ Cancer, design.df=design_matrix, fdr.weighting="graph-overlap", model.contrasts = mod.contrasts)
, model.contrasts = mod.contrasts might be not working. In addition, the published papers (2 decent papers) only use the design
, but not model.contrasts
, for their multiple comparisons by subsetting.
I have been struggling with this part for several days. It will be great if someone could help me to figure out.
I really appreciate your kind help and great packages
from milor.
Dear Mike,
I am wondering if you have good strategies to compare 3 conditions: A, B, C?
I tried the subsetting strategies, the results make sense. But subsetting will not consider the multiple comparisons, which might be not a perfect way.
Here comes results from the subsetting strategies.
Here comes the mod.contrast
contrast.all <- c("CancerControl - CancerNo", "CancerControl - CancerCRC", "CancerNo - CancerCRC")
model <- model.matrix(~ 0 + Cancer, data=design_matrix)
mod.contrasts <- makeContrasts(contrasts=contrast.all, levels = model)
![Screenshot 2024-05-31 at 13 25 25](https://private-user-images.githubusercontent.com/164251298/335676876-fc8cd6e5-a1c5-49ac-a56e-6eb3edd5ee1a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMyNDY5MDcsIm5iZiI6MTcyMzI0NjYwNywicGF0aCI6Ii8xNjQyNTEyOTgvMzM1Njc2ODc2LWZjOGNkNmU1LWExYzUtNDlhYy1hNTZlLTZlYjNlZGQ1ZWUxYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwOVQyMzM2NDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MzdhY2Y3NTVmNzM0NWFhZjI5NWUxMDQyNjQ2MThmNzhkNDZmYmU2OTczMjVmMTFlYTU3MTBlNjlmMTMzMzYwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.FOlaBldsBk8i59Nx4jxfRq4fZuZKEy4E5X7AlcS_8I8)
But after testNhoods, I got the identical results no matter how I change the mod.contrasts[c("CancerControl"), c("CancerControl - CancerCRC")
, Plus the results are all negative LogFC , which does not make senses as well.
ControlVSNo <- testNhoods(Bcells_milo, design=~ Cancer, design.df=design_matrix, fdr.weighting="graph-overlap", model.contrasts = mod.contrasts[c("CancerControl"), c("CancerControl - CancerNo")])
Any comments are welcome!
Thank you very much.
from milor.
GitHub issues are for reporting issues with software, such as bugs and errors. I suggest you post an issue on the Bioconductor forum to explain what you seek to do and ask for advice there.
from milor.
Thanks Mike,
I think this is a bug in the MiloR package. Even in the official multiple comparison vignette, the results are identical after multiple comparisons . I am experiencing the exact same problems.
Thank you very much for looking into that with your team member.
from milor.
If you try running each contrast separately rather than a vector do you get a different result? Fundamentally, Milo doesn't do anything to the model contrasts, it just hands them straight over to edgeR for the QL F-test.
from milor.
OK - the issue is in the vignette, not Milo - the vignette passes mod.contrasts
to testNhoods
when this should be all.contrasts
. Milo converts the vector of contrasts into the correct format internally using the limma
function makeContrasts
. Therefore, you should pass contrast.all
to testNhoods
, not mod.contrasts
. The vignettes have been updated on the devel branch.
from milor.
If you try running each contrast separately rather than a vector do you get a different result? Fundamentally, Milo doesn't do anything to the model contrasts, it just hands them straight over to edgeR for the QL F-test.
Thank you for information. When subsetting, I have different results.
I am curious how to compute the spacialFDR for multiple comparison?
For multiply comparision, P value can be adjusted by "BH", I guess each row will be assumed as one condition? or cell type?
Many thanks
from milor.
OK - the issue is in the vignette, not Milo - the vignette passes
mod.contrasts
totestNhoods
when this should beall.contrasts
. Milo converts the vector of contrasts into the correct format internally using thelimma
functionmakeContrasts
. Therefore, you should passcontrast.all
totestNhoods
, notmod.contrasts
. The vignettes have been updated on the devel branch.
contrast.all <- c("CancerControl - CancerNo", "CancerControl - CancerCRC", "CancerNo - CancerCRC")
model <- model.matrix(~ 0 + Cancer, data=design_matrix)
mod.contrasts <- makeContrasts(contrasts=contrast.all, levels = model)
contrast.res <- testNhoods(Bcells_milo, design=~ Cancer, design.df=design_matrix, fdr.weighting="graph-overlap", model.contrasts = contrast.all)
,
I made the change accordingly, but it gives me errors. Could you pinpoint which code should I modify?
from milor.
You need to provide the code AND the errors - it's impossible to help and debug any problems without the appropriate information.
Next, you need to make sure that what you are doing is consistent. The model contrasts uses the convention of ~ 0 + Variable
but you're passing ~Variable
into testNhoods
<- these are not equivalent behaviours.
I strongly recommend you re-read the guide to making good design matrices, as well as the limma/edgeR guides on contrast, before proceeding further.
from milor.
Hi Mike
I am in a similar boat. And I think your suggestion to past contrast.all instead of mod.contrast fixed the spurious log fold change calculations. However I want to make sure its correctly set up. I am pasting a mock example
contrast_list <- c('Group_varGroup1 - Group_varGroup2','Group_varGroup4 - Group_varGroup3')
contrast.res_Group1vsGroup2 <- testNhoods(milo_obj, design=~ 0 + Group_var, design.df=design_matrix, fdr.weighting="graph-overlap", model.contrasts = contrast_list[1])#first comparison
contrast.res_Group4vsGroup2 <- testNhoods(milo_obj, design=~ 0 + Group_var, design.df=design_matrix, fdr.weighting="graph-overlap", model.contrasts = contrast_list[2])#first comparison```
from milor.
Hi @dravichandar - yes that looks correct. You can also pass contrast_list
in as a single vector to test both contrasts - but this will return an omnibus test p-value/SpatialFDR; LFCs for each test are returned on each nhood.
from milor.
Related Issues (20)
- Cell Condition Relabelling Functionality HOT 3
- Prevention of Neighbourhood Merging of Similar Cell Types into Neighbourhood Groups HOT 1
- Cell type is lost during annotateNhoods HOT 5
- Function Not Found Error HOT 3
- nhood size distribution: some neighbourhoods have over 2000 cells HOT 4
- Progress Bar for GLMM HOT 6
- object 'as.SimpleList' of mode 'function' was not found when running calcNhoodDistance HOT 2
- Does MiloR take into account that the two compared conditions have different number of cells? HOT 2
- Log10 FC or Log2 FC? HOT 1
- How to use MiloR after subsetting the cell types from total cell types? HOT 4
- Direction of test for logFC calculation HOT 1
- Existence of 2 tuitorials for the "Differential abundance testing with Milo - Mouse gastrulation example" HOT 3
- Import precomputed graph HOT 7
- makeNhoods graph refinement (issue with isolated vertices) HOT 4
- No Significant Neighbourhoods Result is Error HOT 1
- Mass cytometry data HOT 1
- MiloR in spatial transcriptomics data HOT 1
- Gene expression testing of only DA neighborhoods within group?? HOT 3
- Can you implement a complete miloR in python ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from milor.