Skip to content
Snippets Groups Projects
Commit f2765635 authored by Workum, Dirk-Jan van's avatar Workum, Dirk-Jan van
Browse files

also update frequency property on nucleotide nodes

parent ea2936ff
No related tags found
1 merge request!198Draft: construct pangenome database from GFA
Pipeline #102418 passed
...@@ -1341,8 +1341,6 @@ public class GenomeLayer { ...@@ -1341,8 +1341,6 @@ public class GenomeLayer {
targetNode = createNewNodeGfa(edge.getTarget(), new int[]{genomeNr, sequenceNr, pathPosition}, index, nodeCache); targetNode = createNewNodeGfa(edge.getTarget(), new int[]{genomeNr, sequenceNr, pathPosition}, index, nodeCache);
createNewRelationshipGfa(sourceNode, edge.getType(), edge.getSourceEndOnTarget(), targetNode, origin, pathPosition, trsc); createNewRelationshipGfa(sourceNode, edge.getType(), edge.getSourceEndOnTarget(), targetNode, origin, pathPosition, trsc);
sourceNode = targetNode; sourceNode = targetNode;
//TODO: update the localization information in the edge to the next node
} }
// connect the last node to the sequence node with FF // connect the last node to the sequence node with FF
...@@ -1374,6 +1372,7 @@ public class GenomeLayer { ...@@ -1374,6 +1372,7 @@ public class GenomeLayer {
newNode.setProperty("address", address); newNode.setProperty("address", address);
newNode.setProperty("length", node.getLength()); newNode.setProperty("length", node.getLength());
newNode.setProperty("frequencies", new long[GENOME_DB.num_genomes + 1]); newNode.setProperty("frequencies", new long[GENOME_DB.num_genomes + 1]);
newNode.setProperty("frequency", 0);
newNode.setProperty("sequence", node.getSequence()); newNode.setProperty("sequence", node.getSequence());
num_bases += node.getLength(); num_bases += node.getLength();
...@@ -1438,6 +1437,15 @@ public class GenomeLayer { ...@@ -1438,6 +1437,15 @@ public class GenomeLayer {
frequencies[address[0]]++; frequencies[address[0]]++;
newNode.setProperty("frequencies", frequencies); 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 the new node
return newNode; return newNode;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment