private synchronized void setAllAtomMapping(List<Map<IAtom, IAtom>> mappings) { try { int counter = 0; for (Map<IAtom, IAtom> solution : mappings) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); for (Map.Entry<IAtom, IAtom> map : solution.entrySet()) { IAtom sourceAtom = map.getKey(); IAtom targetAtom = map.getValue(); atomMappings.put(sourceAtom, targetAtom); } allAtomMCS.add(counter, atomMappings); counter++; } } catch (Exception I) { I.getCause(); } }
private synchronized void setAllAtomMapping(List<Map<IAtom, IAtom>> mappings) { try { int counter = 0; for (Map<IAtom, IAtom> solution : mappings) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); solution.entrySet().stream().forEach((map) -> { IAtom sourceAtom = map.getKey(); IAtom targetAtom = map.getValue(); atomMappings.put(sourceAtom, targetAtom); }); allAtomMCS.add(counter, atomMappings); counter++; } } catch (Exception I) { I.getCause(); } }
private synchronized void setAllAtomMapping(List<Map<IAtom, IAtom>> mappings) { try { int counter = 0; for (Map<IAtom, IAtom> solution : mappings) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); solution.entrySet().forEach((map) -> { IAtom sourceAtom = map.getKey(); IAtom targetAtom = map.getValue(); atomMappings.put(sourceAtom, targetAtom); }); allAtomMCS.add(counter, atomMappings); counter++; } } catch (Exception I) { I.getCause(); } }
private synchronized void setAllAtomMapping() { List<Map<Integer, Integer>> sol = allMCS; int counter = 0; for (Map<Integer, Integer> final_solution : sol) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); final_solution.entrySet().stream().forEach((Solutions) -> { int IIndex = Solutions.getKey(); int JIndex = Solutions.getValue(); IAtom sourceAtom = null; IAtom targetAtom = null; sourceAtom = source.getAtom(IIndex); targetAtom = target.getAtom(JIndex); atomMappings.put(sourceAtom, targetAtom); }); allAtomMCS.add(counter++, atomMappings); } }
private synchronized void setAllAtomMapping() { List<Map<Integer, Integer>> sol = allMCS; int counter = 0; for (Map<Integer, Integer> final_solution : sol) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); final_solution.entrySet().forEach((Solutions) -> { int IIndex = Solutions.getKey(); int JIndex = Solutions.getValue(); IAtom sourceAtom = null; IAtom targetAtom = null; sourceAtom = source.getAtom(IIndex); targetAtom = target.getAtom(JIndex); atomMappings.put(sourceAtom, targetAtom); }); allAtomMCS.add(counter++, atomMappings); } }
private synchronized void setAllAtomMapping() { List<Map<Integer, Integer>> sol = allMCS; int counter = 0; for (Map<Integer, Integer> final_solution : sol) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); for (Map.Entry<Integer, Integer> Solutions : final_solution.entrySet()) { int IIndex = Solutions.getKey(); int JIndex = Solutions.getValue(); IAtom sourceAtom = null; IAtom targetAtom = null; sourceAtom = source.getAtom(IIndex); targetAtom = target.getAtom(JIndex); atomMappings.put(sourceAtom, targetAtom); } allAtomMCS.add(counter++, atomMappings); } }
private synchronized void setAllAtomMapping() { try { int counter = 0; for (Map<Integer, Integer> solution : allMCS) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); solution.entrySet().forEach((map) -> { int IIndex = map.getKey(); int JIndex = map.getValue(); IAtom sourceAtom; IAtom targetAtom; sourceAtom = source.getAtom(IIndex); targetAtom = target.getAtom(JIndex); atomMappings.put(sourceAtom, targetAtom); }); allAtomMCS.add(counter++, atomMappings); } } catch (Exception I) { I.getCause(); } }
private synchronized void setAllAtomMapping() { try { int counter = 0; for (Map<Integer, Integer> solution : allMCS) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); solution.entrySet().forEach((map) -> { int IIndex = map.getKey(); int JIndex = map.getValue(); IAtom sourceAtom; IAtom targetAtom; sourceAtom = source.getAtom(IIndex); targetAtom = target.getAtom(JIndex); atomMappings.put(sourceAtom, targetAtom); }); allAtomMCS.add(counter++, atomMappings); } } catch (Exception I) { I.getCause(); } }
private synchronized void setAllAtomMapping() { try { int counter = 0; for (Map<Integer, Integer> solution : allMCS) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); for (Map.Entry<Integer, Integer> map : solution.entrySet()) { int IIndex = map.getKey(); int JIndex = map.getValue(); IAtom sourceAtom; IAtom targetAtom; sourceAtom = source.getAtom(IIndex); targetAtom = target.getAtom(JIndex); atomMappings.put(sourceAtom, targetAtom); } allAtomMCS.add(counter++, atomMappings); } } catch (Exception I) { I.getCause(); } }
private synchronized void setAllAtomMapping() { int counter = 0; for (Map<Integer, Integer> final_solution : allMCS) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); final_solution.keySet().stream().forEach((indexI) -> { IAtom sourceAtom = source.getAtom(indexI); IAtom targetAtom = target.getAtom(final_solution.get(indexI)); if (sourceAtom != null && targetAtom != null) { atomMappings.put(sourceAtom, targetAtom); } }); if (!allAtomMCS.contains(atomMappings)) { if (!atomMappings.isEmpty()) { allAtomMCS.add(counter, atomMappings); counter += 1; } } } }
private synchronized void setAllAtomMapping() { int counter = 0; for (Map<Integer, Integer> final_solution : allMCS) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); final_solution.keySet().forEach((indexI) -> { IAtom sourceAtom = source.getAtom(indexI); IAtom targetAtom = target.getAtom(final_solution.get(indexI)); if (sourceAtom != null && targetAtom != null) { atomMappings.put(sourceAtom, targetAtom); } }); if (!allAtomMCS.contains(atomMappings)) { if (!atomMappings.isEmpty()) { allAtomMCS.add(counter, atomMappings); counter += 1; } } } }
private synchronized void setAllAtomMapping() { int counter = 0; for (Map<Integer, Integer> final_solution : allMCS) { AtomAtomMapping atomMappings = new AtomAtomMapping(source, target); for (Integer indexI : final_solution.keySet()) { IAtom sourceAtom = source.getAtom(indexI); IAtom targetAtom = target.getAtom(final_solution.get(indexI)); if (sourceAtom != null && targetAtom != null) { atomMappings.put(sourceAtom, targetAtom); } } if (!allAtomMCS.contains(atomMappings)) { if (!atomMappings.isEmpty()) { allAtomMCS.add(counter, atomMappings); counter += 1; } } } }
private synchronized void setAllAtomMapping() { if (DEBUG) { System.out.println("setAllAtomMapping"); System.out.println("source size " + source.getAtomCount()); System.out.println("target size " + target.getAtomCount()); } try { allMCS.stream().map((solution) -> { AtomAtomMapping atomMapping = new AtomAtomMapping(source, target); // System.out.println("solution " + solution); solution.entrySet().stream().forEach((m) -> { int indexI = m.getKey(); int indexJ = m.getValue(); // System.out.println("indexI " + indexI + ", " + "indexJ " + indexJ); IAtom sourceAtom = this.source.getAtom(indexI); IAtom targetAtom = this.target.getAtom(indexJ); atomMapping.put(sourceAtom, targetAtom); }); return atomMapping; }).forEach((atomMapping) -> { allAtomMCS.add(atomMapping); }); } catch (Exception e) { LOGGER.error(SEVERE, null, e); } if (DEBUG) { System.out.println("Number of MCSPlus solution - : allAtomMCS " + allAtomMCS.size()); } }
AtomAtomMapping getMapping() { AtomAtomMapping mapping = new AtomAtomMapping(source, target); for (int i = 0; i < size; i++) { mapping.put(source.getAtom(i), target.getAtom(sharedState.sourceMapping[i])); } return mapping; }
AtomAtomMapping getMapping() { AtomAtomMapping mapping = new AtomAtomMapping(source, target); for (int i = 0; i < size; i++) { mapping.put(source.getAtom(i), target.getAtom(sharedState.sourceMapping[i])); } return mapping; }
AtomAtomMapping getMapping() { AtomAtomMapping mapping = new AtomAtomMapping(source, target); for (int i = 0; i < size; i++) { mapping.put(source.getAtom(i), target.getAtom(sharedState.sourceMapping[i])); } return mapping; }
synchronized MCSSolution copyOldSolutionToNew(int queryPosition, int targetPosition, IAtomContainer compound1, IAtomContainer compound2, MCSSolution oldSolution) { AtomAtomMapping atomAtomMapping = oldSolution.getAtomAtomMapping(); Map<Integer, Integer> mappingsByIndex = atomAtomMapping.getMappingsByIndex(); AtomAtomMapping atomAtomMappingNew = new AtomAtomMapping(compound1, compound2); mappingsByIndex.entrySet().forEach((m) -> { atomAtomMappingNew.put(compound1.getAtom(m.getKey()), compound2.getAtom(m.getValue())); }); MCSSolution mcsSolution = new MCSSolution(queryPosition, targetPosition, compound1, compound2, atomAtomMappingNew); mcsSolution.setEnergy(oldSolution.getEnergy()); mcsSolution.setFragmentSize(oldSolution.getFragmentSize()); mcsSolution.setStereoScore(oldSolution.getStereoScore()); return mcsSolution; }
synchronized MCSSolution copyOldSolutionToNew(int queryPosition, int targetPosition, IAtomContainer compound1, IAtomContainer compound2, MCSSolution oldSolution) { AtomAtomMapping atomAtomMapping = oldSolution.getAtomAtomMapping(); Map<Integer, Integer> mappingsByIndex = atomAtomMapping.getMappingsByIndex(); AtomAtomMapping atomAtomMappingNew = new AtomAtomMapping(compound1, compound2); mappingsByIndex.entrySet().forEach((m) -> { atomAtomMappingNew.put(compound1.getAtom(m.getKey()), compound2.getAtom(m.getValue())); }); MCSSolution mcsSolution = new MCSSolution(queryPosition, targetPosition, compound1, compound2, atomAtomMappingNew); mcsSolution.setEnergy(oldSolution.getEnergy()); mcsSolution.setFragmentSize(oldSolution.getFragmentSize()); mcsSolution.setStereoScore(oldSolution.getStereoScore()); return mcsSolution; }
private synchronized void setVFMappings(List<AtomAtomMapping> mappingsVF2) { int counter = 0; for (AtomAtomMapping solution : mappingsVF2) { AtomAtomMapping atomatomMapping = new AtomAtomMapping(getQuery(), getTarget()); if (solution.getCount() > vfMappingSize) { this.vfMappingSize = solution.getCount(); counter = 0; } for (Map.Entry<IAtom, IAtom> mapping : solution.getMappingsByAtoms().entrySet()) { IAtom qAtom; IAtom tAtom; qAtom = mapping.getKey(); tAtom = mapping.getValue(); if (qAtom != null && tAtom != null) { atomatomMapping.put(qAtom, tAtom); } else { try { throw new CDKException("Atom index pointing to NULL"); } catch (CDKException ex) { Logger.error(Level.SEVERE, null, ex); } } } if (!atomatomMapping.isEmpty() && !hasMap(atomatomMapping, getMCSList()) && atomatomMapping.getCount() == vfMappingSize) { getMCSList().add(counter, atomatomMapping); counter++; } } }
private synchronized void setVFMappings(List<AtomAtomMapping> mappingsVF2) { int counter = 0; for (AtomAtomMapping solution : mappingsVF2) { AtomAtomMapping atomatomMapping = new AtomAtomMapping(getQuery(), getTarget()); if (solution.getCount() > vfMappingSize) { this.vfMappingSize = solution.getCount(); counter = 0; } for (Map.Entry<IAtom, IAtom> mapping : solution.getMappingsByAtoms().entrySet()) { IAtom qAtom; IAtom tAtom; qAtom = mapping.getKey(); tAtom = mapping.getValue(); if (qAtom != null && tAtom != null) { atomatomMapping.put(qAtom, tAtom); } else { try { throw new CDKException("Atom index pointing to NULL"); } catch (CDKException ex) { Logger.error(Level.SEVERE, null, ex); } } } if (!atomatomMapping.isEmpty() && !hasMap(atomatomMapping, getMCSList()) && atomatomMapping.getCount() == vfMappingSize) { getMCSList().add(counter, atomatomMapping); counter++; } } }