Skip to content

Commit

Permalink
loe package deletion and make.KNNG update
Browse files Browse the repository at this point in the history
  • Loading branch information
reyvnth committed May 31, 2024
1 parent b3b8d3b commit 8fca81b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Date: 2024-01-24
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
URL: https://github.com/fanzhanglab/STew
BugReports: https://github.com/fanzhanglab/STew/issues
Depends:
Expand All @@ -23,7 +23,6 @@ Remotes:
JEFworks-Lab/MERINGUE,
satijalab/Seurat
Imports:
loe (>= 1.1),
Matrix (>= 1.5.4),
ggpubr (>= 0.6.0),
future,
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import(ggplot2)
import(ggpubr)
import(ggrepel)
import(gridExtra)
import(loe)
import(matrixStats)
import(parallel)
import(parameters)
Expand Down
3 changes: 1 addition & 2 deletions R/expression_adjacency_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#'
#' @export
#'
#'@import loe
#'Matrix
#'@import Matrix
expression_adjacency_matrix <- function(obj, nk = 200, symm = FALSE, weight = TRUE, mode = "undirected", weighted = FALSE) {
# Calculate the Euclidean distance between each pair of cells using the gene expression matrix
mat <- t(obj$count_exp)
Expand Down
23 changes: 23 additions & 0 deletions R/makeKNNG.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
make.kNNG <-
function(DM, k=as.integer( 2*log(nrow(DM)) ), symm =FALSE, weight=FALSE ) {#begin function
N <- nrow(DM)
ADM <- matrix(0, N, N)
#Search kNN point
if(weight==TRUE){
for (i in 1:N) {
nid <- order(DM[i,])
ADM[ i, nid[2:(k+1)] ] <- DM[ i, nid[2:(k+1)] ]
}
}else{
for (i in 1:N) {
nid <- order(DM[i,])
ADM[i,nid[2:(k+1)] ] <- 1
}
}
if(symm==TRUE){
SADM <- ADM+t(ADM)
SADM[SADM==2*ADM] <- ADM[SADM==2*ADM]
ADM <- SADM
}
return(ADM)
}
18 changes: 18 additions & 0 deletions citation.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cff-version: 1.0.3
message: "If you use this software, please cite it using the following reference."
authors:
- family-names: Guo
given-names: N.
- family-names: Vargas
given-names: J.
- family-names: Fritz
given-names: D.
- family-names: Krishna
given-names: R.
- family-names: Zhang
given-names: F.
title: "Uncover spatially informed variations for single-cell spatial transcriptomics with STew"
date-released: 2024
url: "https://doi.org/10.1093/bioadv/vbae064"
journal: "Bioinformatics Advances"
doi: "10.1093/bioadv/vbae064"

0 comments on commit 8fca81b

Please sign in to comment.