HectorRDB / condiments

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

imbalance_score for more than 2 dimensions #23

Closed nickhir closed 10 months ago

nickhir commented 1 year ago

Hi,

I am trying to use the imbalence_score function for my dataset. As far as I can tell, for the majority of examples you used either the UMAP or tSNE to infer trajectories with slingshot. For my dataset, the PCA projection seems more reasonable. When I try to run the function, I receive an error however:

# my code
scores <- condiments::imbalance_score(
  Object = Embeddings(seurat_subset,"pca_mod")[,1:30] %>% as.matrix(), 
  conditions = seurat_subset$perturbation,
  k = 40, smooth = 30)
Error in array(0, n * k) : negative length vectors are not allowed
In addition: Warning messages:
1: In smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) :
  basis dimension, k, increased to minimum possible

2: In array(0, n * k) : NAs introduced by coercion to integer range

I suspect it might be because my input has more than 2 columns because if I just use the first 2 PCs it works fine.

Can I not use the imbalance_score if I have more than 2 dimensions?

I appreciate any insights and am happy to provide the data which produces the error.

HectorRDB commented 10 months ago

Hi, the imbalance score is indeed made for 2D as it is aimed to be a visual tool. However, the rest of the workflow will work fine with PCA.