Skip to content

Commit 917569b

Browse files
committed
MSPP overly aggressive node collapse fix
1 parent 7fa445c commit 917569b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/hiv_tx_network.js

+29
Original file line numberDiff line numberDiff line change
@@ -373,16 +373,24 @@ class HIVTxNetwork {
373373
this.json.Nodes,
374374
this.json.Edges
375375
);
376+
376377
let complete_clusters = misc.hivtrace_cluster_depthwise_traversal(
377378
this.json.Nodes,
378379
this.json.Edges,
379380
(d) => d.length <= reduce_distance_within
380381
);
382+
381383
let adjacency = misc.hivtrace_compute_adjacency(
382384
this.json.Nodes,
383385
this.json.Edges,
384386
(d) => d.length <= reduce_distance_between
385387
);
388+
389+
let adjacency05 = misc.hivtrace_compute_adjacency(
390+
this.json.Nodes,
391+
this.json.Edges,
392+
(d) => d.length <= 0.005
393+
);
386394
let nodes_to_delete = new Set();
387395

388396
_.each(clusters, (cluster, cluster_index) => {
@@ -412,6 +420,7 @@ class HIVTxNetwork {
412420
_.each(uel, (dup_seqs, uid) => {
413421
if (dup_seqs.length > 1) {
414422
let dup_ids = new Set(_.map(dup_seqs, (d) => d.id));
423+
415424
let neighborhood = new Set(
416425
_.map(
417426
_.filter(
@@ -420,6 +429,14 @@ class HIVTxNetwork {
420429
)
421430
)
422431
);
432+
let neighborhood05 = new Set(
433+
_.map(
434+
_.filter(
435+
[...adjacency05[dup_seqs[0].id]],
436+
(d) => !dup_ids.has(d)
437+
)
438+
)
439+
);
423440
let reduce = true;
424441

425442
//if (neighborhood.size > 0) {
@@ -432,11 +449,23 @@ class HIVTxNetwork {
432449
)
433450
)
434451
);
452+
let other_nbhd05 = new Set(
453+
_.map(
454+
_.filter(
455+
[...adjacency05[dup_seqs[idx].id]],
456+
(d) => !dup_ids.has(d)
457+
)
458+
)
459+
);
435460

436461
if (
437462
!(
438463
other_nbhd.isSubsetOf(neighborhood) &&
439464
neighborhood.isSubsetOf(other_nbhd)
465+
) ||
466+
!(
467+
other_nbhd.isSubsetOf(neighborhood05) &&
468+
neighborhood.isSubsetOf(other_nbhd05)
440469
)
441470
) {
442471
reduce = false;

0 commit comments

Comments
 (0)