Skip to content

Commit

Permalink
Update data_preprocess_utility.R
Browse files Browse the repository at this point in the history
  • Loading branch information
QSong-github authored Mar 22, 2021
1 parent e42f352 commit 749b059
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions scGCN/data_preprocess_utility.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,18 @@ GenerateGraph <- function(Dat1,Dat2,Lab1,K,check.unknown){
names.delim = "_")

objects <- list(object1,object2)
objects1 <- lapply(objects,function(indrop){
indrop <- NormalizeData(indrop,verbose=F)
indrop <- FindVariableFeatures(indrop,
objects1 <- lapply(objects,function(obj){
obj <- NormalizeData(obj,verbose=F)
obj <- FindVariableFeatures(obj,
selection.method = "vst",
nfeatures = 2000,verbose=F)
indrop <- ScaleData(indrop,features=rownames(indrop),verbose=F)
return(indrop)})

#' ---------------
#' Inter graph |
#' ---------------
obj <- ScaleData(obj,features=rownames(obj),verbose=FALSE)
obj <- RunPCA(obj, features=rownames(obj), verbose = FALSE)
return(obj)})
#' Inter-data graph
object.nn <- FindIntegrationAnchors(object.list = objects1,k.anchor=K,verbose=F)
arc=object.nn@anchors
d1.arc1=cbind(arc[arc[,4]==1,1],arc[arc[,4]==1,2],arc[arc[,4]==1,3])
#' output
d1.arc1=cbind(arc[arc[,4]==1,1],arc[arc[,4]==1,2],arc[arc[,4]==1,3])
grp1=d1.arc1[d1.arc1[,3]>0,1:2]-1

if (check.unknown){
Expand All @@ -96,9 +93,7 @@ GenerateGraph <- function(Dat1,Dat2,Lab1,K,check.unknown){
scores <- metrics(lab1=Lab1,inter_graph=inter.graph,clusters=hc)
saveRDS(scores,file='./input/statistical_scores.RDS')
}
#' ---------------
#' Intra graph |
#' ---------------
#' Intra-data graph
d2.list <- list(objects1[[2]],objects1[[2]])
d2.nn <- FindIntegrationAnchors(object.list =d2.list,k.anchor=K,verbose=F)
d2.arc=d2.nn@anchors
Expand Down

0 comments on commit 749b059

Please sign in to comment.