Skip to content

Commit c59d825

Browse files
committed
community split, bump
1 parent da4a2ba commit c59d825

File tree

3 files changed

+53
-53
lines changed

3 files changed

+53
-53
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: ClustIRR
22
Type: Package
33
Title: Clustering of immune receptor repertoires
4-
Version: 1.7.4
4+
Version: 1.7.5
55
Authors@R: c(
66
person("Simo", "Kitanovski", email = "simokitanovski@gmail.com",
77
role = c("aut", "cre"), comment=c(ORCID="0000-0003-2909-5376")),

R/community.R

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -393,55 +393,3 @@ set_chain <- function(graph, chains) {
393393
}
394394
return(graph)
395395
}
396-
397-
get_component_stats <- function(x) {
398-
399-
# what is he
400-
community_id <- V(x)$community[1]
401-
402-
# number of nodes per component
403-
count_n <- table(V(x)$component_id)
404-
405-
# components has more than one node
406-
i <- which(count_n>1)
407-
stats_components <- c()
408-
if(length(i)>0) {
409-
stats_components <- lapply(X = names(i), g = x, FUN = function(x, g) {
410-
o <- subgraph(g, vids = which(V(g)$component_id==x))
411-
412-
ncweight <- E(o)$ncweight
413-
if(length(ncweight)==0) {
414-
ncweight <- NA
415-
}
416-
nweight <- E(o)$nweight
417-
if(length(nweight)==0) {
418-
nweight <- NA
419-
}
420-
421-
return(data.frame(component_id = x,
422-
community = V(o)$community[1],
423-
mean_ncweight = mean(ncweight),
424-
mean_nweight = mean(nweight),
425-
n_nodes = length(o),
426-
n_edges = length(E(o)),
427-
n_clique_edges = length(o)*(length(o)-1)/2,
428-
diameter = diameter(o)))
429-
})
430-
stats_components <- do.call(rbind, stats_components)
431-
}
432-
433-
i <- which(count_n==1)
434-
stats_singletons <- c()
435-
if(length(i)>0) {
436-
stats_singletons <- data.frame(component_id = names(i),
437-
community = community_id,
438-
mean_ncweight = NA,
439-
mean_nweight = NA,
440-
n_nodes = 1,
441-
n_edges = 0,
442-
n_clique_edges = 0,
443-
diameter = 0)
444-
}
445-
446-
return(rbind(stats_components, stats_singletons))
447-
}

R/community_decoder.R

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,58 @@ decode_all_communities <- function(graph,
4040
return(o)
4141
}
4242

43+
get_component_stats <- function(x) {
44+
45+
# what is he
46+
community_id <- V(x)$community[1]
47+
48+
# number of nodes per component
49+
count_n <- table(V(x)$component_id)
50+
51+
# components has more than one node
52+
i <- which(count_n>1)
53+
stats_components <- c()
54+
if(length(i)>0) {
55+
stats_components <- lapply(X = names(i), g = x, FUN = function(x, g) {
56+
o <- subgraph(g, vids = which(V(g)$component_id==x))
57+
58+
ncweight <- E(o)$ncweight
59+
if(length(ncweight)==0) {
60+
ncweight <- NA
61+
}
62+
nweight <- E(o)$nweight
63+
if(length(nweight)==0) {
64+
nweight <- NA
65+
}
66+
67+
return(data.frame(component_id = x,
68+
community = V(o)$community[1],
69+
mean_ncweight = mean(ncweight),
70+
mean_nweight = mean(nweight),
71+
n_nodes = length(o),
72+
n_edges = length(E(o)),
73+
n_clique_edges = length(o)*(length(o)-1)/2,
74+
diameter = diameter(o)))
75+
})
76+
stats_components <- do.call(rbind, stats_components)
77+
}
78+
79+
i <- which(count_n==1)
80+
stats_singletons <- c()
81+
if(length(i)>0) {
82+
stats_singletons <- data.frame(component_id = names(i),
83+
community = community_id,
84+
mean_ncweight = NA,
85+
mean_nweight = NA,
86+
n_nodes = 1,
87+
n_edges = 0,
88+
n_clique_edges = 0,
89+
diameter = 0)
90+
}
91+
92+
return(rbind(stats_components, stats_singletons))
93+
}
94+
4395
check_graph <- function(graph) {
4496
if(missing(graph)) {
4597
stop("missing graph")

0 commit comments

Comments
 (0)