private int getStoichiometry(Set<Stoichiometry> stois, Set<PhysicalEntity> pes) { int total = 0; Map<PhysicalEntity, Float> stoiMap = new HashMap<PhysicalEntity, Float>(); for(Stoichiometry s: stois) stoiMap.put(s.getPhysicalEntity(), s.getStoichiometricCoefficient()); for(PhysicalEntity pe: pes) { if(pe instanceof Complex) { Complex c = (Complex) pe; total += getStoichiometry(c.getComponentStoichiometry(), c.getComponent()); } else { Float k = stoiMap.get(pe); if( k == null ) k = 1.0f; total += k; } } return total; }
private org.opencb.bionetdb.core.models.Complex createComplex(BioPAXElement bioPAXElement) { org.opencb.bionetdb.core.models.Complex complex = new org.opencb.bionetdb.core.models.Complex(); Complex complexBP = (Complex) bioPAXElement; // Common properties setPhysicalEntityCommonProperties(complexBP, complex); // Complex properties // Components Set<PhysicalEntity> components = complexBP.getComponent(); for (PhysicalEntity component : components) { complex.getComponents().add(component.getRDFId().split("#")[1]); } // Stoichiometry List<Map<String, Object>> stoichiometry = new ArrayList<>(); Set<Stoichiometry> stoichiometryItems = complexBP.getComponentStoichiometry(); for (Stoichiometry stoichiometryItem : stoichiometryItems) { Map<String, Object> stchmtr = new HashMap<>(); stchmtr.put("component", stoichiometryItem.getPhysicalEntity().toString().split("#")[1]); stchmtr.put("coefficient", stoichiometryItem.getStoichiometricCoefficient()); stoichiometry.add(stchmtr); } complex.setStoichiometry(stoichiometry); return complex; }
Set<Stoichiometry> stoi = thing.getComponentStoichiometry(); String msg = "has one component"; if(stoi.isEmpty()) {
Set<Stoichiometry> stoi = thing.getComponentStoichiometry(); String msg = "has one component"; if(stoi.isEmpty()) {