5 Normalisation and dimensionality reduction

5.1 Just got back to 1 worker for this analysis seems to work much better

plan("multisession", workers = 1)

5.2 Log normalise

cropped.obj <- NormalizeData(cropped.obj)
cropped.obj <- FindVariableFeatures(cropped.obj, selection.method = "vst")

5.3 Identify the 20 most highly variable genes

t20 <- head(VariableFeatures(cropped.obj), 20) 
t20

5.4 Scale data and run PCA

cropped.obj <- ScaleData(cropped.obj)
cropped.obj <- RunPCA(cropped.obj, features = VariableFeatures(object = cropped.obj))
print(cropped.obj[["pca"]], dims = 1:5, nfeatures = 5)

5.5 Find neighbour cells (in PCA space, not real space)

cropped.obj <- FindNeighbors(cropped.obj, dims = 1:30)

5.6 Run with default cluster params

cropped.obj <- FindClusters(cropped.obj)

5.7 Run UMAP

cropped.obj <- RunUMAP(cropped.obj, dims = 1:30)

5.8 Markers of each cluster

marks <- FindAllMarkers(cropped.obj)

5.9 Visualise the UMAP

DimPlot(cropped.obj,label = T)+ NoLegend()