Comments (3)
Hi Regner,
Thank you for letting me know! This is an excellent question.
If you may take a glance at line 68-89 in EM_model.R, you will find that we initiate the model following specific steps that in respect to your input, especially the signature genes. There are not any steps elsewhere that can introduce random variables in the model, and what you have noticed that the output was identical each time is as expected.
I think a quick workaround is to investigate the probability matrix (results$probabilities), which is also the way I used in my SCINA paper. The rows of the matrix are cell types and each of the columns records the probabilities of one cell to be assigned to any of your presumed cell types. You may save the results$probabilities from the last ~10 (or the number you like) iterations and calculate and summarize the probability vector variation among the 10 iterations for each cell or the entire cell pool.
Hope this information could be of help! Please let me know if I'm not making myself clear on any points. Wish you all the best!
Best regards, Ze
from scina.
Hi @jcao89757 ,
If I understand correctly, this means that SCINA will produce 100% stable results across 10 iterations? I may have confused myself thinking SCINA was similar to another tool called Cell Assign (https://github.com/Irrationone/cellassign). Could you point out the differences between SCINA and Cell Assign?
I investigated the probability matrices for 10 runs of SCINA on the pbmc_small dataset. It seems like in this small example with the pbmc_small dataset, all 80 cells receive the same probability across 10 iterations (please see script below and T cell signature attached). Thanks for your help!
signatures <- as.list(read.delim("./T_cell_signature.txt"))
pbmc <- pbmc_small
desired_length <- 10 # or whatever length you want
prob.fill <- vector(mode = "list", length = desired_length)
for (i in 1:10){
results = SCINA(as.matrix(pbmc@assays$RNA@data), signatures, max_iter = 100, convergence_n = 10,
convergence_rate = 0.999, sensitivity_cutoff = 0.9, rm_overlap=T, allow_unknown=TRUE, log_file='SCINA.log')
prob.fill[[i]] <- results$probabilities
}
head(prob.fill[[1]][,1:2])
head(prob.fill[[2]][,1:2])
head(prob.fill[[3]][,1:2])
head(prob.fill[[4]][,1:2])
head(prob.fill[[5]][,1:2])
head(prob.fill[[6]][,1:2])
head(prob.fill[[7]][,1:2])
head(prob.fill[[8]][,1:2])
head(prob.fill[[9]][,1:2])
head(prob.fill[[10]][,1:2])
head(prob.fill[[1]][,79:80])
head(prob.fill[[2]][,79:80])
head(prob.fill[[3]][,79:80])
head(prob.fill[[4]][,79:80])
head(prob.fill[[5]][,79:80])
head(prob.fill[[6]][,79:80])
head(prob.fill[[7]][,79:80])
head(prob.fill[[8]][,79:80])
head(prob.fill[[9]][,79:80])
head(prob.fill[[10]][,79:80])
cell1.run1 <- prob.fill[[1]][,1]
cell1.run10 <- prob.fill[[10]][,1]
cell1.run5 <- prob.fill[[5]][,1]
print(cell1.run1);print(cell1.run10);print(cell1.run5)
from scina.
Hi Regner,
You are right that SCINA results are 100% stable with the same exp_data and signatures. The CellAssign paper introduced an algorithm that takes similar input as SCINA and has a very close underlying assumption. However, the two methods have a few differences in expectation likelihood calculation. The CellAssign model initiates from randomly drawn priors, therefore it produces different results if run multiple times.
Thanks for sending the code! I see that your code aims to investigate the robustness among runs, not the convergence among iterations. As I explained that our algorithm is deterministic, the probability matrices are also stable with the same exp_data and signatures. You may then need to slightly modify the initiation part of the script EM_model.R to start from different initiations. Please let me know if you have further questions about modifying the code. Thanks!
Best regards, Ze
from scina.
Related Issues (20)
- Conversion to dense matrix HOT 1
- SCINA error HOT 9
- SCINA error message HOT 12
- Signature vector where no cell markers match cell types causes an error HOT 2
- Error when gene in signature list not present in expression matrix HOT 1
- Error Message in SCINA HOT 9
- Cannot annotate my own gene list with an error HOT 3
- Can't install the package using `install_github` HOT 1
- SCINA Python version? HOT 3
- question about 'allow_unknown' parameter HOT 5
- signatures and plotheat.SCINA function
- License for GitHub and CRAN versions HOT 4
- annotat the aggregated cluster profile HOT 2
- cell type assignment with negative expression HOT 1
- Error with SCINA command HOT 16
- Addressing Heatmap Legend Overlap Issue in SCINA: Troubleshooting and Solutions HOT 1
- Error with SCINA command HOT 1
- possible bug in plotheat.SCINA? HOT 2
- function: plotheat.SCINA()
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 scina.