/** * Returns atom index of the given atom in the target molecule * * @param atom * @return */ public synchronized int getTargetIndex(IAtom atom) { return getTarget().indexOf(atom); }
/** * Returns common mapped fragment in the target molecule. * * @return common mapped fragment in the target molecule * @throws CloneNotSupportedException */ public synchronized IAtomContainer getMapCommonFragmentOnTarget() throws CloneNotSupportedException { IAtomContainer ac = getTarget().clone(); List<IAtom> uniqueAtoms = Collections.synchronizedList(new ArrayList<IAtom>()); for (IAtom atom : getTarget().atoms()) { if (!mapping.containsValue(atom)) { uniqueAtoms.add(ac.getAtom(getTargetIndex(atom))); } } uniqueAtoms.stream().forEach((atom) -> { ac.removeAtomAndConnectedElectronContainers(atom); }); return ac; }
/** * Returns atom index of the given atom in the target molecule * * @param atom * @return */ public synchronized int getTargetIndex(IAtom atom) { return getTarget().getAtomNumber(atom); }
/** * Returns common mapped fragment in the target molecule. * * @return common mapped fragment in the target molecule * @throws CloneNotSupportedException */ public synchronized IAtomContainer getMapCommonFragmentOnTarget() throws CloneNotSupportedException { IAtomContainer ac = getTarget().clone(); List<IAtom> uniqueAtoms = Collections.synchronizedList(new ArrayList<>()); for (IAtom atom : getTarget().atoms()) { if (!mapping.containsValue(atom)) { uniqueAtoms.add(ac.getAtom(getTargetIndex(atom))); } } uniqueAtoms.stream().forEach((atom) -> { ac.removeAtom(atom); }); return ac; }
/** * Returns atom index of the given atom in the target molecule * * @param atom * @return */ public synchronized int getTargetIndex(IAtom atom) { return getTarget().indexOf(atom); }
/** * Returns common mapped fragment in the target molecule. * * @return common mapped fragment in the target molecule * @throws CloneNotSupportedException */ public synchronized IAtomContainer getMapCommonFragmentOnTarget() throws CloneNotSupportedException { IAtomContainer ac = getTarget().clone(); List<IAtom> uniqueAtoms = Collections.synchronizedList(new ArrayList<>()); for (IAtom atom : getTarget().atoms()) { if (!mapping.containsValue(atom)) { uniqueAtoms.add(ac.getAtom(getTargetIndex(atom))); } } uniqueAtoms.stream().forEach((atom) -> { ac.removeAtom(atom); }); return ac; }
@Override public int hashCode() { int hash = 7; hash = 67 * hash + (this.getQuery() != null ? this.getQuery().hashCode() : 0); hash = 67 * hash + (this.getTarget() != null ? this.getTarget().hashCode() : 0); hash = 67 * hash + (this.mapping != null ? this.getMappingsByAtoms().hashCode() : 0); hash = 67 * hash + (this.mappingIndex != null ? this.getMappingsByIndex().hashCode() : 0); return hash; }
@Override public int hashCode() { int hash = 7; hash = 67 * hash + (this.getQuery() != null ? this.getQuery().hashCode() : 0); hash = 67 * hash + (this.getTarget() != null ? this.getTarget().hashCode() : 0); hash = 67 * hash + (this.mapping != null ? this.getMappingsByAtoms().hashCode() : 0); hash = 67 * hash + (this.mappingIndex != null ? this.getMappingsByIndex().hashCode() : 0); return hash; }
@Override public int hashCode() { int hash = 7; hash = 67 * hash + (this.getQuery() != null ? this.getQuery().hashCode() : 0); hash = 67 * hash + (this.getTarget() != null ? this.getTarget().hashCode() : 0); hash = 67 * hash + (this.mapping != null ? this.getMappingsByAtoms().hashCode() : 0); hash = 67 * hash + (this.mappingIndex != null ? this.getMappingsByIndex().hashCode() : 0); return hash; }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AtomAtomMapping other = (AtomAtomMapping) obj; if (this.getQuery() != other.getQuery() && (this.getQuery() == null || !this.query.equals(other.query))) { return false; } if (this.getTarget() != other.getTarget() && (this.getTarget() == null || !this.target.equals(other.target))) { return false; } if (this.mapping != other.getMappingsByAtoms() && (this.mapping == null || !this.mapping.equals(other.mapping))) { return false; } return this.mappingIndex == other.getMappingsByIndex() || (this.mappingIndex != null && this.mappingIndex.equals(other.mappingIndex)); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AtomAtomMapping other = (AtomAtomMapping) obj; if (this.getQuery() != other.getQuery() && (this.getQuery() == null || !this.query.equals(other.query))) { return false; } if (this.getTarget() != other.getTarget() && (this.getTarget() == null || !this.target.equals(other.target))) { return false; } if (this.mapping != other.getMappingsByAtoms() && (this.mapping == null || !this.mapping.equals(other.mapping))) { return false; } return this.mappingIndex == other.getMappingsByIndex() || (this.mappingIndex != null && this.mappingIndex.equals(other.mappingIndex)); }
/** * * @param atom1 * @param atom2 */ public synchronized void put(IAtom atom1, IAtom atom2) { mapping.put(atom1, atom2); mappingIndex.put(getQuery().getAtomNumber(atom1), getTarget().getAtomNumber(atom2)); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AtomAtomMapping other = (AtomAtomMapping) obj; if (this.getQuery() != other.getQuery() && (this.getQuery() == null || !this.query.equals(other.query))) { return false; } if (this.getTarget() != other.getTarget() && (this.getTarget() == null || !this.target.equals(other.target))) { return false; } if (this.mapping != other.getMappingsByAtoms() && (this.mapping == null || !this.mapping.equals(other.mapping))) { return false; } return this.mappingIndex == other.getMappingsByIndex() || (this.mappingIndex != null && this.mappingIndex.equals(other.mappingIndex)); }
/** * * @param atom1 * @param atom2 */ public synchronized void put(IAtom atom1, IAtom atom2) { mapping.put(atom1, atom2); mappingIndex.put(getQuery().indexOf(atom1), getTarget().indexOf(atom2)); }
/** * {@inheritDoc} */ @Override public synchronized double getEuclideanDistance() { int decimalPlaces = 4; double sourceAtomCount; double targetAtomCount; double euclidean = -1.; if (getMappingCount() > 0) { AtomAtomMapping firstAtomMCS = getMCSList().iterator().next(); if (!firstAtomMCS.isEmpty()) { sourceAtomCount = (double) this.getMCSList().iterator() .next().getQuery().getAtomCount(); targetAtomCount = (double) this.getMCSList().iterator() .next().getTarget().getAtomCount(); double common = (double) firstAtomMCS.getCount(); euclidean = Math.sqrt(sourceAtomCount + targetAtomCount - 2 * common); BigDecimal dist = new BigDecimal(euclidean); dist = dist.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); euclidean = dist.doubleValue(); } } return euclidean; }
/** * {@inheritDoc} */ @Override public synchronized double getEuclideanDistance() { int decimalPlaces = 4; double sourceAtomCount; double targetAtomCount; double euclidean = -1.; if (getMappingCount() > 0) { AtomAtomMapping firstAtomMCS = getMCSList().iterator().next(); if (!firstAtomMCS.isEmpty()) { sourceAtomCount = (double) this.getMCSList().iterator() .next().getQuery().getAtomCount(); targetAtomCount = (double) this.getMCSList().iterator() .next().getTarget().getAtomCount(); double common = (double) firstAtomMCS.getCount(); euclidean = Math.sqrt(sourceAtomCount + targetAtomCount - 2 * common); BigDecimal dist = new BigDecimal(euclidean); dist = dist.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); euclidean = dist.doubleValue(); } } return euclidean; }
/** * {@inheritDoc} */ @Override public synchronized double getTanimotoSimilarity() { int decimalPlaces = 4; double rAtomCount; double pAtomCount; double tanimotoAtom = 0.0; if (getMappingCount() > 0) { AtomAtomMapping firstAtomMCS = getMCSList().iterator().next(); if (!firstAtomMCS.isEmpty()) { rAtomCount = (double) this.getMCSList().iterator().next().getQuery().getAtomCount(); pAtomCount = (double) this.getMCSList().iterator().next().getTarget().getAtomCount(); double matchCount = (double) firstAtomMCS.getCount(); tanimotoAtom = (matchCount) / (rAtomCount + pAtomCount - matchCount); BigDecimal tan = new BigDecimal(tanimotoAtom); tan = tan.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); tanimotoAtom = tan.doubleValue(); } } return tanimotoAtom; }
/** * {@inheritDoc} */ @Override public synchronized double getTanimotoSimilarity() { int decimalPlaces = 4; double rAtomCount; double pAtomCount; double tanimotoAtom = 0.0; if (getMappingCount() > 0) { AtomAtomMapping firstAtomMCS = getMCSList().iterator().next(); if (!firstAtomMCS.isEmpty()) { rAtomCount = (double) this.getMCSList().iterator().next().getQuery().getAtomCount(); pAtomCount = (double) this.getMCSList().iterator().next().getTarget().getAtomCount(); double matchCount = (double) firstAtomMCS.getCount(); tanimotoAtom = (matchCount) / (rAtomCount + pAtomCount - matchCount); BigDecimal tan = new BigDecimal(tanimotoAtom); tan = tan.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); tanimotoAtom = tan.doubleValue(); } } return tanimotoAtom; }
/** * {@inheritDoc} */ @Override public synchronized double getTanimotoSimilarity() { int decimalPlaces = 4; double rAtomCount; double pAtomCount; double tanimotoAtom = 0.0; if (getMappingCount() > 0) { AtomAtomMapping firstAtomMCS = getMCSList().iterator().next(); if (!firstAtomMCS.isEmpty()) { rAtomCount = (double) this.getMCSList().iterator().next().getQuery().getAtomCount(); pAtomCount = (double) this.getMCSList().iterator().next().getTarget().getAtomCount(); double matchCount = (double) firstAtomMCS.getCount(); tanimotoAtom = (matchCount) / (rAtomCount + pAtomCount - matchCount); BigDecimal tan = new BigDecimal(tanimotoAtom); tan = tan.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); tanimotoAtom = tan.doubleValue(); } } return tanimotoAtom; }
/** * * @param atom1 * @param atom2 */ public synchronized void put(IAtom atom1, IAtom atom2) { try { atom1.setID(atom1.getID() == null ? getQuery().indexOf(atom1) + "" : atom1.getID()); atom2.setID(atom2.getID() == null ? getTarget().indexOf(atom2) + "" : atom2.getID()); mapping.put(atom1, atom2); mappingIndex.put(getQuery().indexOf(atom1), getTarget().indexOf(atom2)); } catch (Exception e) { LOGGER.error("Error: Add Mapping to the Map", e.getMessage()); } }