Commit 79e4783c authored by cfrainay's avatar cfrainay
Browse files

Use 'merged degree' for percentile filter

parent 241b672b
......@@ -92,13 +92,29 @@ public class SideCompoundsScan extends AbstractMet4jApplication {
//perform scan
//------------
System.err.println("Scaning...");
//if merging compartment
Map<String, Integer> mergedDegree = new HashMap<>();
if(merge){
mergedDegree = graph.vertexSet().stream().collect(
Collectors.groupingBy(
BioMetabolite::getName,
Collectors.summingInt(v -> graph.degreeOf(v))
)
);
}
//degree statistics
DescriptiveStatistics degreeStats = new DescriptiveStatistics();
double dt = degree;
if (!Double.isNaN(degreePrecentile)) {
for (BioMetabolite v : graph.vertexSet()) {
if (merge){
degreeStats.addValue(mergedDegree.get(v.getName()));
}else{
degreeStats.addValue(graph.degreeOf(v));
}
}
dt = degreeStats.getPercentile(degreePrecentile);
}
......@@ -117,17 +133,6 @@ public class SideCompoundsScan extends AbstractMet4jApplication {
//if ids only, report side only
if (noReportValue) sideOnly = true;
//if merging compartment
Map<String, Integer> mergedDegree = new HashMap<>();
if(merge){
mergedDegree = graph.vertexSet().stream().collect(
Collectors.groupingBy(
BioMetabolite::getName,
Collectors.summingInt(v -> graph.degreeOf(v))
)
);
}
int count = 0;
for (BioMetabolite v : graph.vertexSet()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment