mckellardw / scMuscle

The Cornell Single-Cell Muscle Project (scMuscle) aims to collect, analyze and provide to the research community skeletal muscle transcriptomic data
18 stars 4 forks source link

Using Phate on Myogenic Data #7

Closed mauripops closed 2 years ago

mauripops commented 2 years ago

Hi! I am confused about this section of myogenic_github_v1.R It states it would run on the harmony values yet it is calling for the data slot of the seurat object. Is this correct?

# Run PHATE on harmony values ####

tmp.phate <- phate(
  t(GetAssayData(myo.seurat,slot="data")),
  gamma=1,
  n.jobs = 25
) 

Context I am trying to replicate the results from the myogenic data, following myo.slim.seurat@commands, I run PCA to 50 dimensions followed by harmony on the PCA reduction grouping by sample. For the last step I don't have parameters since adding the reduction through CreateDimReducObject is not leaving any data in @commnands.

mauripops commented 2 years ago

Running phate on harmony cell embedding: image

mckellardw commented 2 years ago

Mauricio,

Sorry, that looks like a mistake in the code that did not get updated after our preprint! The embedding you are showing in the top left plot (with axes labeled "phateharmony") matches the embedding we computed on harmony values. The code block for computing the harmony/PHATE embedding should be this:

# run PHATE
tmp.phate <- phate(
  myo.seurat@reductions$harmony@cell.embeddings[,1:39], #cells x reduc dims
  gamma=1,
  n.jobs = 50
) 
colnames(tmp.phate$embedding) <- paste0("phate_harmony_", 1:2)
tmp.phate$params$data <- NULL

tmp.phate$embedding[,1] <- tmp.phate$embedding[,1]*-1 #flip x-axis

myo.seurat[["phate_harmony"]] <- CreateDimReducObject(
  embeddings = tmp.phate$embedding,
  key = "phate_harmony_", 
  assay = 'RNA',
  misc = tmp.phate$params
)

Note that I flipped the (arbitrary) x-axis orientation, just to make the plots more intuitive to read (differentiation going left to right). I will update the code, thanks for finding these errors!

mauripops commented 2 years ago

Hey thanks, I was able to replicate the results. My issue seemed to be that I needed to run harmony on the full data set before doing the filtering. Still ended up upside down although it might be due to the the pca just running differently. image