Skip to content

Commit

Permalink
Adjusting some of the network statistics to be aware of MSPP
Browse files Browse the repository at this point in the history
  • Loading branch information
spond committed Nov 2, 2024
1 parent 7676260 commit 0618da1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion html/priority-sets-args.html
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ <h5 class="modal-desc">Select CoI from the list</h5>
} else {
d3.select("#app-error").style("display", "none");
hivtrace.histogramDistances(graph, histogram_tag, histogram_label);
hivtrace.graphSummary(graph, graph_summary_tag);
hivtrace.graphSummary(user_graph.json, graph_summary_tag);

[
"#main-tab",
Expand Down
15 changes: 15 additions & 0 deletions src/clusternetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -1711,12 +1711,15 @@ var hivtrace_cluster_network_graph = function (
self.cluster_sizes = [];
self.cluster_sizes_in_entities = {};

let cluster_set = new Set();

graph_data.Nodes.forEach((d) => {
if (typeof self.cluster_sizes[d.cluster - 1] === "undefined") {
self.cluster_sizes[d.cluster - 1] = 1;
} else {
self.cluster_sizes[d.cluster - 1]++;
}
cluster_set.add(d.cluster);
if ("is_lanl" in d) {
d.is_lanl = d.is_lanl === "true";
}
Expand All @@ -1732,13 +1735,25 @@ var hivtrace_cluster_network_graph = function (
});

if (self.has_multiple_sequences) {
let entity_count = 0;
self.apply_to_entities((entity_id, nodes) => {
if (self.cluster_sizes_in_entities[nodes[0].cluster]) {
self.cluster_sizes_in_entities[nodes[0].cluster]++;
} else {
self.cluster_sizes_in_entities[nodes[0].cluster] = 1;
}
entity_count++;
});
self.json["Network Summary"]["Nodes"] = entity_count;
self.json["Network Summary"]["Clusters"] = _.size(
self.cluster_sizes_in_entities
);
self.json["Cluster sizes"] = [];
_.each(self.cluster_sizes_in_entities, (d, c) => {
self.json["Cluster sizes"].push(d);
});
} else {
self.json["Network Summary"]["Clusters"] = cluster_set.size;
}

/* add buttons and handlers */
Expand Down
6 changes: 3 additions & 3 deletions src/hivtraceClusterGraphSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function hivtraceClusterGraphSummary(graph, tag, not_CDC) {
if (!summary_table.empty()) {
_.each(graph["Network Summary"], (value, key) => {
// Handle special case for cluster count
if (key === "Clusters") {
if (not_CDC && key === "Clusters") {
value = _.size(graph["Cluster description"]);
}

Expand Down Expand Up @@ -97,7 +97,7 @@ function hivtraceClusterGraphSummary(graph, tag, not_CDC) {
degrees["min"] + " - " + degrees["max"],
]);
table_data.push([
"&nbsp;&nbsp;<i>" + __("statistics")["interquartile_range"] + "range</i>",
"&nbsp;&nbsp;<i>" + __("statistics")["interquartile_range"] + "</i>",
degrees["Q1"] + " - " + degrees["Q3"],
]);

Expand All @@ -123,7 +123,7 @@ function hivtraceClusterGraphSummary(graph, tag, not_CDC) {
_defaultPercentFormat(degrees["max"]),
]);
table_data.push([
"&nbsp;&nbsp;<i>" + __("statistics")["interquartile_range"] + "range</i>",
"&nbsp;&nbsp;<i>" + __("statistics")["interquartile_range"] + "</i>",
_defaultPercentFormat(degrees["Q1"]) +
" - " +
_defaultPercentFormat(degrees["Q3"]),
Expand Down

0 comments on commit 0618da1

Please sign in to comment.