require(Yano)
Loading required package: Yano
── Attaching packages ────────────────────────────────────────────── Yano 1.0 ──
✔ dplyr 1.1.4 ✔ Seurat 5.1.0
✔ ggplot2 3.5.1
.1 <- ReadPISA("./visium/section1/Anterior/exp/")
exp.1 <- Read10X_Image("./visium/section1/Anterior/spatial/")
image
## QuickRecipe() is actually an integration function of Seurat workflow
.1 <- QuickRecipe(exp.1[, Cells(image.1)], verbose = FALSE) obj
Normalizing layer: counts
.1[['slice1']] <- image.1[colnames(obj.1),]
obj.1$orig.ident <- "sec1_ant"
obj
.2 <- ReadPISA("./visium/section1/Posterior/exp/")
exp.2 <- Read10X_Image("./visium/section1/Posterior/spatial/")
image.2 <- QuickRecipe(exp.2[,Cells(image.2)], verbose = FALSE) obj
Normalizing layer: counts
.2[['slice2']] <- image.2[colnames(obj.2),]
obj.2$orig.ident <- "sec1_pos"
obj
.3 <- ReadPISA("./visium/section2/Anterior/exp/")
exp.3 <- Read10X_Image("./visium/section2/Anterior/spatial/")
image.3 <- QuickRecipe(exp.3[, Cells(image.3)], verbose = FALSE) obj
Normalizing layer: counts
.3[['slice3']] <- image.3[colnames(obj.3),]
obj.3$orig.ident <- "sec2_ant"
obj
.4 <- ReadPISA("./visium/section2/Posterior/exp/")
exp.4 <- Read10X_Image("./visium/section2/Posterior/spatial/")
image.4 <- QuickRecipe(exp.4[, Cells(image.4)], verbose = FALSE) obj
Normalizing layer: counts
.4[['slice4']] <- image.4[colnames(obj.4),]
obj.4$orig.ident <- "sec2_pos"
obj
# Merge all processed Seurat object
<- merge(obj.1, y = list(obj.2, obj.3, obj.4), add.cell.ids = c("sec1_ant", "sec1_pos", "sec2_ant", "sec2_pos"))
obj
<- QuickRecipe(obj) obj
Set default assay to RNA
object <- NormalizeData(object, normalization.method = "LogNormalize", scale.factor = 10000)
Normalizing layer: counts.1
Normalizing layer: counts.2
Normalizing layer: counts.3
Normalizing layer: counts.4
object <- FindVariableFeatures(object, selection.method = "vst", nfeatures = 3000)
Finding variable features for layer counts.1
Finding variable features for layer counts.2
Finding variable features for layer counts.3
Finding variable features for layer counts.4
object <- ScaleData(object, features = @features, vars.to.regress = "nCount_RNA")
Regressing out nCount_RNA
Centering and scaling data matrix
object <- RunPCA(object, features = @features
PC_ 1
Positive: Dbi, Pcp2, Car8, Sparc, Zic1, Cbln1, Pvalb, Ppp1r17, Lhx1os, Homer3
Sept4, Metrn, Gm2694, Atp2a3, Hopx, Inpp5a, Ank1, Fam107b, Neurod1, Kcnc3
Timp4, Icmt, Col18a1, Aldoc, Tspan9, Dner, Slc1a6, Calb2, Chn2, Kcng4
Negative: Nrgn, Ctxn1, Cx3cl1, Chn1, Ngef, Ptk2b, Camkv, Camk2n1, Pde2a, Hpca
Arpp21, Fbxl16, Enc1, Ddn, Pld3, Basp1, Ppp3ca, Rgs4, Chst1, Camk2a
Arf3, Chrm1, Ptpn5, Icam5, Phactr1, Hpcal4, Rprml, Kcnip2, Syt5, Foxg1
PC_ 2
Positive: Snap25, Neurod1, Snhg11, Dnm1, Adcy1, Stmn2, Ywhah, Scn1b, Stmn3, Gm2694
Cbln1, Cacna1a, Shf, Sh3gl2, Stxbp1, Grin2c, Gm42742, Zbtb18, Nrep, Mir124a-1hg
Diras2, Tmem132a, Meg3, Sphkap, Grm4, Ndrg3, Dgkz, Nptx1, Car8, Cadm3
Negative: Apod, Plp1, Mal, Cldn11, Gsn, Enpp2, Mbp, Mobp, Cryab, Mog
Mag, Tmsb4x, Car2, Gfap, Cnp, Plekhb1, Trf, Ndrg1, Ermn, Ugt8a
Efnb3, Bcas1, Gatm, Ppp1r14a, Fa2h, Gpr37, Pllp, Pdlim2, Gltp, Gm20425
PC_ 3
Positive: Penk, Rgs9, Pde10a, Adora2a, Ppp1r1b, Gpr88, Drd1, Tac1, Syndig1l, Gpr6
Rxrg, Lrrc10b, Pde1b, Adcy5, Rasd2, Scn4b, Tmem158, Gng7, Rarb, Slc32a1
Slc35d3, Actn2, Strip2, Ankrd63, Serpina9, Pcp4l1, Meis2, Sez6, Gnal, Pcp4
Negative: Cck, 3110035E14Rik, Nrn1, Olfm1, Stmn1, Slc17a7, Lingo1, Stx1a, Tbr1, Gnas
Slc30a3, Vsnl1, Dkk3, Ncald, 1110008P14Rik, Efhd2, Basp1, Rtn4r, Neurod6, Miat
Gm11549, Mpped1, Pde1a, Mical2, Fxyd7, Nptxr, E130012A19Rik, Gabbr2, Satb2, Syt13
PC_ 4
Positive: Mbp, Mobp, Qdpr, Plp1, Mag, Trf, Plekhb1, Cnp, Bcas1, Mal
Mog, Tspan2, Ermn, Sept4, Cryab, Car2, Cldn11, Nefm, Pllp, Ppp1r14a
Tmem88b, Gpr37, Vamp1, Ugt8a, Gatm, Fa2h, Scn4b, Nefl, Nefh, Prr18
Negative: Islr, Igf2, Igfbp2, Mgp, Fmod, Slc6a20a, Slc13a4, Ogn, Aebp1, Slc6a13
Fabp7, Aldh1a2, Gjb2, Slc22a6, Col1a2, Rbp1, Fn1, Slc13a3, Bmp7, Crabp2
Pcolce, Serping1, Efemp1, Col1a1, Ifitm3, Nupr1, Bgn, Cpne6, Nbl1, Thbd
PC_ 5
Positive: Gng4, Slc6a11, Ptpro, Sp8, Dlx1, Nrip3, Hap1, Cdhr1, Scg2, Doc2g
Th, Pcbp3, Tubb2a, Cpne4, Dcx, Scgn, Ppm1e, Tshz1, Zcchc12, A230065H16Rik
Pbx3, Dlx2, Lgr6, Lgr5, Cacng5, Sp9, Wdr6, Tmem130, Adamts19, Nmb
Negative: Itpka, Itpr1, Zbtb18, Hpca, Ppp1r1b, Arpp19, Cplx2, Rnf112, Adcy1, Camk4
Cnr1, Nptx1, Mmp17, Cnksr2, Lmo4, Prkcb, Sepw1, Neurod2, Calb1, Lzts3
Sptbn2, Tmem132a, Tesc, Foxp1, Fbxl16, Lingo3, Dkk3, Ppp3ca, Atp1a1, Lrrc10b
object <- FindNeighbors(object, dims = 1:20)
Computing nearest neighbor graph
Computing SNN
object <- FindClusters(object, resolution = 0.5)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 12148
Number of edges: 386668
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.9273
Number of communities: 17
Elapsed time: 0 seconds
object <- RunUMAP(object, dims = 1:20)
23:29:59 UMAP embedding parameters a = 0.9922 b = 1.112
23:29:59 Read 12148 rows and found 20 numeric columns
23:29:59 Using Annoy for neighbor search, n_neighbors = 30
23:29:59 Building Annoy index with metric = cosine, n_trees = 50
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
23:30:00 Writing NN index file to temp file /var/folders/38/qfwf72jx3413kwjx7lgqv3xr0000gn/T//RtmpWK6jSu/file85b761505099
23:30:00 Searching Annoy index using 1 thread, search_k = 3000
23:30:02 Annoy recall = 100%
23:30:02 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
23:30:02 Initializing from normalized Laplacian + noise (using RSpectra)
23:30:02 Commencing optimization for 200 epochs, with 498054 positive edges
23:30:07 Optimization finished
<- DimPlot(obj, group.by = "orig.ident")
p1 <- DimPlot(obj)
p2 + p2 p1
SpatialPlot(obj, pt.size.factor = 2)
.1 <- ReadPISA("./visium/section1/Anterior/exon/", prefix = "sec1_ant_", cells = Cells(obj))
exon.2 <- ReadPISA("./visium/section1/Posterior/exon/", prefix = "sec1_pos_", cells = Cells(obj))
exon.3 <- ReadPISA("./visium/section2/Anterior/exon/", prefix = "sec2_ant_", cells = Cells(obj))
exon.4 <- ReadPISA("./visium/section2/Posterior/exon/", prefix = "sec2_pos_", cells = Cells(obj))
exon<- mergeMatrix(exon.1, exon.2, exon.3, exon.4) exon
'as(<dgTMatrix>, "dgCMatrix")' is deprecated.
Use 'as(., "CsparseMatrix")' instead.
See help("Deprecated") and help("Matrix-deprecated").
'exon']] <- CreateAssayObject(exon[, Cells(obj)], min.cells = 20)
obj[[DefaultAssay(obj) <- "exon"
<- NormalizeData(obj)
obj <- ParseExonName(obj) obj
Working on assay exon
<- RunAutoCorr(obj) obj
Working on assay : exon
Run autocorrelation test for 80178 features.
Runtime : 40.62745 secs
<- SetAutoCorrFeatures(obj) obj
39414 autocorrelated features.
<- RunBlockCorr(obj, bind.name = "gene_name", bind.assay = "RNA") obj
Working on assay exon.
Working on binding assay RNA.
Processing 39414 features.
Processing 15785 blocks.
Retrieve binding data from assay RNA.
Use "data" layer for test features and binding features.
Using 7 threads.
Using method "D" with mode 1.
Use predefined weight matrix "pca_wm".
Runtime : 30.41442 mins.
FbtPlot(obj, val = "gene_name.padj")
'exon']][[]] %>% filter(gene_name.pval<1e-40) obj[[
chr start end gene_name strand
chr11:30106785-30109152/-/Sptbn1 chr11 30106785 30109152 Sptbn1 -
chr11:53548291-53549565/+/Sept8 chr11 53548291 53549565 Sept8 +
chr12:111806315-111806775/+/Klc1 chr12 111806315 111806775 Klc1 +
chr12:111806315-111806727/+/Klc1 chr12 111806315 111806727 Klc1 +
chr12:111806315-111806711/+/Klc1 chr12 111806315 111806711 Klc1 +
chr12:111806315-111806726/+/Klc1 chr12 111806315 111806726 Klc1 +
chr17:25717528-25717581/+/Gng13 chr17 25717528 25717581 Gng13 +
chrX:163926903-163929546/+/Ap1s2 chrX 163926903 163929546 Ap1s2 +
moransi.pval moransi autocorr.variable
chr11:30106785-30109152/-/Sptbn1 0 0.15018334 TRUE
chr11:53548291-53549565/+/Sept8 0 0.41877021 TRUE
chr12:111806315-111806775/+/Klc1 0 0.10144477 TRUE
chr12:111806315-111806727/+/Klc1 0 0.10131377 TRUE
chr12:111806315-111806711/+/Klc1 0 0.09578263 TRUE
chr12:111806315-111806726/+/Klc1 0 0.09829769 TRUE
chr17:25717528-25717581/+/Gng13 0 0.15957157 TRUE
chrX:163926903-163929546/+/Ap1s2 0 0.14138305 TRUE
gene_name.D gene_name.r gene_name.pval
chr11:30106785-30109152/-/Sptbn1 0.4957796 -0.02554239 7.057288e-60
chr11:53548291-53549565/+/Sept8 0.3818213 0.05181663 1.718951e-44
chr12:111806315-111806775/+/Klc1 0.4438596 0.09998905 2.876458e-55
chr12:111806315-111806727/+/Klc1 0.4439723 0.10056806 2.817245e-55
chr12:111806315-111806711/+/Klc1 0.4384527 0.11168103 1.359610e-53
chr12:111806315-111806726/+/Klc1 0.4388710 0.10047243 1.271424e-53
chr17:25717528-25717581/+/Gng13 0.3935489 -0.02563280 3.712364e-43
chrX:163926903-163929546/+/Ap1s2 0.3609878 0.02473633 4.911901e-46
gene_name.mean gene_name.var gene_name.padj
chr11:30106785-30109152/-/Sptbn1 0.1250099 0.010071091 2.735405e-55
chr11:53548291-53549565/+/Sept8 0.1223685 0.010483515 9.518079e-41
chr12:111806315-111806775/+/Klc1 0.1257658 0.009702447 3.716384e-51
chr12:111806315-111806727/+/Klc1 0.1257633 0.009703739 3.716384e-51
chr12:111806315-111806711/+/Klc1 0.1254133 0.009964339 1.053970e-49
chr12:111806315-111806726/+/Klc1 0.1258574 0.009956102 1.053970e-49
chr17:25717528-25717581/+/Gng13 0.1232859 0.011322626 1.798640e-39
chrX:163926903-163929546/+/Ap1s2 0.1235875 0.009203270 3.173088e-42