Skip to content
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 PseudotimeDE for more than one lineage #16

Open
dvaldes2 opened this issue Feb 6, 2023 · 4 comments
Open

Using PseudotimeDE for more than one lineage #16

dvaldes2 opened this issue Feb 6, 2023 · 4 comments

Comments

@dvaldes2
Copy link

dvaldes2 commented Feb 6, 2023

Dear developers,
thank you very much for a great package that circumvents well known pitfalls in DEG calculation along pseudotime.

I have a dataset with 4 relevant biological lineages. What would be your advice for the workflow of pseudotimeDE?

Right now, I do this:

// preprocessed single cell data seurat object == seu_tropho
sce = as.SingleCellExperiment(seu_tropho, assay = "RNA")
rd = reducedDims(sce)$UMAP
fit_ori = slingshot(sce, colData(sce)$integrated_snn_res.0.3, reducedDim = rd, start.clus = "5")
traj_ori_tbl1 = tibble(cell = colnames(sce), pseudotime = rescale(colData(fit_ori)$slingPseudotime_1))

// subset sce based on cells in lineage1
lin1.sce = fit_ori[, !is.na(colData(fit_ori)$slingPseudotime_1)]
rd = reducedDims(lin1.sce)$UMAP
test = slingshot(lin1.sce, colData(lin1.sce)$integrated_snn_res.0.3, reducedDim = rd, start.clus = "5", end.clus = "1") #give end cluster so there will be only one lineage

n = 1000
set.seed(1234)
traj_indext = mclapply(seq_len(n), function(x, sce) {
sample(x = c(1:dim(sce)[2]), size = 0.8*dim(sce)[2], replace = FALSE) # dim(sce[2]) should == ncol, not a specific pseudotime
}, sce = lin1.sce)

set.seed(1234)
traj_sub_tbl1 = mclapply(traj_indext, function(x, sce, ori_tbl) {
sce = sce[, x]
rd = reducedDims(sce)$UMAP
fit = slingshot(sce, colData(sce)$integrated_snn_res.0.3, reducedDim = rd, start.clus = "5", end.clus = "1")
tbl = tibble(cell = colnames(sce), pseudotime = (rescale(colData(fit)$slingPseudotime_1)))
merge.tbl = left_join(tbl, ori_tbl, by = "cell")
if(cor(merge.tbl$pseudotime.x, merge.tbl$pseudotime.y, use = "complete.obs") < 0) {
tbl = dplyr::mutate(tbl, pseudotime = 1-pseudotime)
}
tbl
}, sce = lin1.sce, ori_tbl = traj_ori_tbl1)

res = PseudotimeDE::runPseudotimeDE(gene.vec = c("PGF", "CGA"),
ori.tbl = traj_ori_tbl1,
sub.tbl = traj_sub_tbl1, #test with 100 subsamples, run with 1k
mat = seu_tropho,
model = "nb",
mc.cores = 20
)

When running the DEG on the 2 genes above, I get a tibble with only NA values. I see from the example some NA's for particular columns are expected. However, I get no numerical nor logical output for any of the columns.

I would appreciate your help with this. Many thanks!!
Daniela Valdes

@SONGDONGYUAN1994
Copy link
Owner

Hi Daniela,
Thanks for your interest in our work! Based on your code, could you check if your ori.tbl and sub.tbl contain any NA? If yes, please remove those rows.

You can also set sub.tbl = NULL and run the code. If it returns results (fix.pv), it means the bug must be related to sub.tbl.

Let me know if it works!

Best,
Dongyuan

@dvaldes2
Copy link
Author

dvaldes2 commented Feb 9, 2023

Hi Dongyuan,

thank you for your response. There are no NAs in my ori.tbl or sub.tbl; running summary(is.na(traj_ori_tbl1)) returns only FALSE, the same with my sub.tbl.

Additionally, when using sub.tbl = NULL I do not get any results, it is all NAs (like before).

Do you know if it is a bug related to a pseudotime inference with >1 lineage?

Best,
Daniela

@SONGDONGYUAN1994
Copy link
Owner

Hi Daniela,
I do not think it is related to multi-lineage pseudotime since you actually extract the individual pseudotime. To solve your problem, it would be nice if I can have reproducible data. Would you mind sharing your traj_ori_tbl1, traj_sub_tbl1 and seu_tropho as rds files with me? If you have any concerns about the data privacy, you may add some random noise on seu_tropho. My email address is [email protected].

Best,
Dongyuan

@SONGDONGYUAN1994
Copy link
Owner

For later users:
Please make sure your expression matrix contains all the cells you want to use; for example, the cells in pseudotime tbl ori.tbl should all be included in your mat. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants