use of cbit.vcell.bionetgen.BNGSpecies in project vcell by virtualcell.
the class BNGExecutorServiceMultipass method isIdentityReaction.
private static boolean isIdentityReaction(BNGReaction r) {
// System.out.println("check if we ended up with an identity reaction because of repairing");
if (r.getReactants().length != r.getProducts().length) {
return false;
}
Set<String> reactants = new HashSet<>();
Set<String> products = new HashSet<>();
for (BNGSpecies reactant : r.getReactants()) {
String rStr = reactant.getName();
reactants.add(rStr);
}
for (BNGSpecies product : r.getProducts()) {
String pStr = product.getName();
products.add(pStr);
}
// extract products from reactants
reactants.removeAll(products);
if (reactants.size() == 0) {
// it's identity reaction
return true;
}
return false;
}
Aggregations