new LinkedHashMap<Integer, Set<Integer>>();
Map<KamNode, KamNode> onodes = new HashMap<KamNode, KamNode>();
for (final KamEdge e : edges) {
// only evaluate orthologous edges
if (ORTHOLOGOUS.equals(e.getRelationshipType())) {
final KamNode edgeSource = e.getSourceNode();
final KamNode edgeTarget = e.getTargetNode();
// invalid; skip orthologous self edges
if (edgeSource == edgeTarget) {
continue;
}
TermParameter speciesParam = findParameter(kam, kAMStore,
edgeSource, rlocs);
if (speciesParam != null) {
// source node matches target species
Integer id = edgeSource.getId();
Set<Integer> adjacentEdges = oedges.get(id);
if (adjacentEdges == null) {
adjacentEdges = new LinkedHashSet<Integer>();
oedges.put(id, adjacentEdges);
}
// collect adjacent edges (except this edge) for the
// orthologous target node
final Set<KamEdge> orthoEdges = kam.getAdjacentEdges(edgeTarget);
for (final KamEdge orthoEdge : orthoEdges) {
if (orthoEdge != e) {
adjacentEdges.add(orthoEdge.getId());
}
}
onodes.put(edgeTarget, edgeSource);
continue;
}
speciesParam = findParameter(kam, kAMStore, edgeTarget, rlocs);
if (speciesParam != null) {
// target node matches target species
Integer id = edgeTarget.getId();
Set<Integer> adjacentEdges = oedges.get(id);
if (adjacentEdges == null) {
adjacentEdges = new LinkedHashSet<Integer>();
oedges.put(id, adjacentEdges);
}