From f27656357cdc14bd9261fd1e3a7d9d76edc2d260 Mon Sep 17 00:00:00 2001 From: worku005 <dirk-jan.vanworkum@wur.nl> Date: Fri, 27 Sep 2024 09:24:29 +0200 Subject: [PATCH] also update frequency property on nucleotide nodes --- .../construction/build_pangenome/GenomeLayer.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/nl/wur/bif/pantools/construction/build_pangenome/GenomeLayer.java b/src/main/java/nl/wur/bif/pantools/construction/build_pangenome/GenomeLayer.java index 85aeeecf7..1b09464a4 100644 --- a/src/main/java/nl/wur/bif/pantools/construction/build_pangenome/GenomeLayer.java +++ b/src/main/java/nl/wur/bif/pantools/construction/build_pangenome/GenomeLayer.java @@ -1341,8 +1341,6 @@ public class GenomeLayer { targetNode = createNewNodeGfa(edge.getTarget(), new int[]{genomeNr, sequenceNr, pathPosition}, index, nodeCache); createNewRelationshipGfa(sourceNode, edge.getType(), edge.getSourceEndOnTarget(), targetNode, origin, pathPosition, trsc); sourceNode = targetNode; - - //TODO: update the localization information in the edge to the next node } // connect the last node to the sequence node with FF @@ -1374,6 +1372,7 @@ public class GenomeLayer { newNode.setProperty("address", address); newNode.setProperty("length", node.getLength()); newNode.setProperty("frequencies", new long[GENOME_DB.num_genomes + 1]); + newNode.setProperty("frequency", 0); newNode.setProperty("sequence", node.getSequence()); num_bases += node.getLength(); @@ -1438,6 +1437,15 @@ public class GenomeLayer { frequencies[address[0]]++; newNode.setProperty("frequencies", frequencies); + // update the frequency property of the node + final long frequency = Arrays.stream(frequencies).sum(); + newNode.setProperty("frequency", frequency); + + // update global highest_frequency integer + if (frequency > highest_frequency) { + highest_frequency = frequency; + } + // return the new node return newNode; } -- GitLab