Wei-BioMath / NeuronChat

GNU General Public License v3.0
29 stars 3 forks source link

Equivalant of netVisual_diffInteraction #22

Open DelongZHOU opened 6 months ago

DelongZHOU commented 6 months ago

Hello,

I'm looking for an equivalant of netVisual_diffInteraction to show the difference in communication strength between two datasets.

I searched the repo and found netVisual_circle_compare, however when applied to my data it shows all edges with weight of 1 and increase / decrease as solid or dotted lines instead of red and blue. You can find my code below. Thank you.

#load seurat object and subsetting by condition
seurat_1<-...
seurat_2<-...
#create neuronchat object
create_nc<-function(y){
expr=GetAssayData(y, assay = "RNA", slot = "data")
metadata=y[['subtype']]
x<-createNeuronChat(expr,meta=metadata,DB='mouse',group.by=metadata$subtype)
x <- run_NeuronChat(x,M=100)
return(x)
}
nc_list<-lapply(c(seurat_1,seurat_2),create_nc)
names(nc_list)<-c('ctrl','treatment')
net_aggregated_ctrl <- net_aggregation(nc_list[[1]]@net,method='weight')
net_aggregated_trmt <- net_aggregation(nc_list[[2]]@net,method='weight')
netVisual_circle_compare(net_aggregated_sal,net_aggregated_psy,arrow.size = 0.5,margin=0.3,edge.width.max=8,label.edge = TRUE)