HectorRDB / condiments

Trajectory inference across multiple conditions with condiments: differential topology, progression, differentiation, and expression
https://hectorrdb.github.io/condiments/
Other
24 stars 3 forks source link

Provide reordered counts matrix after "condiments::slingshot_conditions" for TradeSeq "fitGAM" #30

Closed Jaimelan closed 3 months ago

Jaimelan commented 8 months ago

Hi, first of all, I wanted to thank the authors of this package for implementing this utility.

I am running an analysis in which I want to examine two lineages in two separate conditions. I apply the condiments pipeline, and when performing the differential expression analysis I have to provide the "counts" matrix.

I have been providng the count matrix from the original experiment, but the order of the cells when the lineages are split by conditions is changed. Should I reorder the count matrix to match the order of the cells in the "sds" which is merged, or should I give the matrix without reordering.

I have observed that the results are dramatically different depending on the matrix you provide.

Thanks in advance

HectorRDB commented 8 months ago

Hi, The results should not be changing based on the order. Just to make I understand, you have two lineages, each appearing on just one condition ? Or two lineages, each having a mixture of cells from either conditions. Could you also share the code that leads to this error ?

Jaimelan commented 8 months ago

Hi, My situation is that I have two lineages computed with slingshot, with cells appearing on multiple conditions. I split them with condiments into four lineages, one for lineage and for condition. The lineages initiate from the same cluster so I'm guessing there could be shared cells in the starting times.

sds_conditions <- condiments::slingshot_conditions(sds=sds, conditions=sds$Condition, approx_points=FALSE, extend="n", reweight=FALSE, reassign = FALSE)

Where I think the actual problem comes is in the following step of merging the lists:

sds_conditions$condition_id <- names(sds_conditions)

sds_conditions$mapping <- matrix(rep(1:2, each = 2), nrow = 2, ncol = 2, byrow = TRUE)

sds_conditions_merge <- do.call(merge_sds, sds_conditions)

I have the seurat object from which the slingshot datasets are originated, and while the "not-split" slingshot meets: all(sds@NAMES == colnames(seurat_object)) as True, when I do all(cellnames(sds_conditions_merge) == colnames(seurat_object)) it is False.

HectorRDB commented 4 months ago

Ok, I think I understand. A few points then:

Jaimelan commented 3 months ago

Hello. I proceeded according to the differential tests (the results from topologyTest) and determined the necessity to split by conditions. I reordered the data and the analysis seems to make sense.

Thanks for your attention!