BiomedicalMachineLearning / stLearn

A novel machine learning pipeline to analyse spatial transcriptomics data
Other
201 stars 26 forks source link

Trajectory Zoom #282

Closed meaksu closed 8 months ago

meaksu commented 9 months ago

Hi, Thanks for developing this package. I had a few questions about the Trajectory analysis for my Xenium sample.

  1. It seems like generating a zoomed image flips the tissue across the y-axis, is there a way to fix this?
Capture1 Capture2
  1. Also, is there a way to speed up the st.spatial.trajectory.pseudotime function? For example if I'm only interested in a particular region of the tissue, would it be valid to subset based on those zoomed coordinates before running the trajectory, and if so what would be the best way to do this?
duypham2108 commented 8 months ago

Sorry I just back from a long holiday. It might be a problem with the x-y order. I will fix it soon. Currently, we use DBSCAN in one step for spatial clustering. If you see many sub-clusters in .obs['sub_cluster_labels'] then the parameter eps may be too small which causes the slow issue. Increasing it can be a solution. If not, we may update an HDBSCAN option instead of DBSCAN. If you only interested in a region then create a subset of your anndata object, then perform trajectory analysis

duypham2108 commented 8 months ago

I fixed the zoom issue in the master branch version.

pip uninstall stlearn --yes
git clone https://github.com/BiomedicalMachineLearning/stLearn.git
cd stLearn
python setup.py install