-
Notifications
You must be signed in to change notification settings - Fork 224
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
Running velocyto on multiple samples with 10X #54
Comments
Yes, it has. Merge the eight matrices (genes by cells) to one giant matrix, then feed it to velocyto.R. Take the pure R's pipeline for example, the required input RDS file is generated by dropEst (see here) and it is nothing but a R's 'list' of which the content is a triplets: exon, intron and spanning matrices. Here is the pseudo R codes: merged_exon_mat <- matrix()
merged_intron_mat <- matrix()
merged_spanning_mat <- matrix()
for rds_x in c(rds1, rds2, ..., rds8):
mat <- read.rds(rds_x)
mat_exon <- mat$exon
mat_intron <- mat$intron
mat_spanning <- mat$spanning
## avoid collision of same cell barcode
colnames(mat_exon) <- paste(rds_x, colnames(mat_exon))
colnames(mat_intron) <- paste(rds_x, colnames(mat_intron))
colnames(mat_spanning) <- paste(rds_x, colnames(mat_spanning))
merged_exon_mat <- cbind(merged_exon_mat, mat_exon)
merged_intron_mat <- cbind(merged_intron_mat, mat_intron)
merged_spanning_mat <- cbind(merged_spanning_mat, mat_spanning)
merged_mats <- list(
exon=merged_exon_mat,
intron=merged_intron_mat,
spanning=merged_spanning_mat)
## use merged_mats to run velocyto.R
## ... You could probably do the same operation on loom file, though I never give a try. A final suggestion would be considering the batch effect. |
Hi, @Puriney , The reason is that after the batch effect correction has been applied, the resultant output came with logcounts only. Thanks! |
I don't think it is good to use logCounts for the input. Because velocity.R internally relies on raw counts. Here are some examples:
Maybe you can manually convert the logcounts back to raw counts. Read |
Hi, Regarding your suggestion of Seurat Integration. How do you bring seurat integration here, just by using the UMAP/tSNE from seurat integrated analysis to show velocity in velocity.R? Kindly advice. It would be great for me and I suppose many to have clarity over this as Seurat Integration is also popular for batch correction. Thanks in advance! |
Just if I could chime in, I think https://github.com/satijalab/seurat-wrappers has what you need, and which I am using (I am not starting from .loom file, but essentially it requires only small modification). The vignette is http://htmlpreview.github.io/?https://github.com/satijalab/seurat-wrappers/blob/master/docs/velocity.html |
This is what I did, It would be great if a contributor can comment to confirm.
It works, but I am not very sure this pipeline stays true with the things that go in the background with velocity. |
I am really questioning the use of batch correction on multiple samples to run velocyto on the corrected matrices. Does anyone have any insight on this? |
This is reasonable |
I tried this, it takes a lot of times but can not get the result. Could you help me to deal with this? |
@kaizen89 , As far as I understand, In the end at least in Seurat Integration, you are only using 'correction' to cluster and for dimensionality reduction. Your 'expression values' are not per se batch corrected. Velocyto is using the original 10x data to make loom output file. You are only super imposing the velocyto analysis on the 'corrected' umap? |
Sorry, what error message do you get? |
Hi, |
Hi @ZxyChopcat Your SO should have the same number of cells. Before making the assay objects, filter your seura object to contain only cells that are also present int eh integrated object
It is also a good practice to check the number of cells frequently in you r seurat objects using dim(Seurat.Object) Hope it works! |
Thank you for providing a very clear idea, but I think we should notice that cell ids from loom file are not exactily the same format as 10x cellranger output files under most conditions. Thus, before running GetAssayObject, we should run RenameCells() to make sure that cell names from VelocytoObj and 10xSeuratObj are exactly the same.
|
Thanks for the code!But I found another problem while running------ Matrices must have same number of rows in cbind2(.Call(dense_to_Csparse, x), y). |
Using this method, if I have filtered the cells in advance, how can I solve it? |
Dear Velocyto team,
I have a question about running velocyto on eight 10x samples. Since 10X pipeline gives bam file for each sample, I can run velocyto on each bam file one by one and generate eight loom files. I am wondering is there a way to visualize the vector fields on a single TSNE plot of aggregate cells of all eight samples? I would like to have some advise on how to run velocyto and achieve that map efficiently?
Yours,
Ying DIng
The text was updated successfully, but these errors were encountered: