Skip to content

Commit

Permalink
made minor fixes as requested.
Browse files Browse the repository at this point in the history
  • Loading branch information
DataSciBurgoon committed Feb 8, 2018
1 parent 44f003d commit b2cbdc8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* Note: I adapted this fingerprint from Yap Chun Wei's PaDEL source code, which can be found here:
* http://www.yapcwsoft.com/dd/padeldescriptor/
*
* Author: Lyle D. Burgoon, Ph.D. (lyle.d.burgoon@usace.army.mil)
*
* This is the work of a US Government employee. This code is in the public domain.
*
*/


Expand All @@ -26,7 +30,7 @@
* Generates an atom pair 2D fingerprint as implemented in PaDEL given an {@link IAtomContainer}, that
* extends the {@link Fingerprinter}.
*
* @author Lyle Burgoon
* @author Lyle Burgoon (lyle.d.burgoon@usace.army.mil)
* @cdk.created 2018-02-05
* @cdk.keyword fingerprint
* @cdk.keyword similarity
Expand Down Expand Up @@ -59,6 +63,11 @@ public int getSize() {
return pathToBit.size();
}

/**
* Checks if an atom is a halogen
* @param atom
* @return
*/
private static boolean isHalogen(final IAtom atom) {
switch (atom.getAtomicNumber()) {
case 9: // F
Expand All @@ -71,6 +80,11 @@ private static boolean isHalogen(final IAtom atom) {
}
}

/**
* Atoms that we are using in the fingerprint
* @param atom
* @return
*/
private static boolean include(final IAtom atom) {
switch (atom.getAtomicNumber()) {
case 5: // B
Expand All @@ -90,15 +104,34 @@ private static boolean include(final IAtom atom) {
}
}

/**
* Creates the fingerprint name which is used as a key in our hashes
* @param dist
* @param a
* @param b
* @return
*/
private static String encodePath(int dist, IAtom a, IAtom b) {
return dist + "_" + a.getSymbol() + "_" + b.getSymbol();
}

/**
* Encodes name for halogen paths
* @param dist
* @param a
* @param b
* @return
*/
private static String encodeHalPath(int dist, IAtom a, IAtom b) {
return dist + "_" + (isHalogen(a) ? "X" : a.getSymbol()) + "_" +
(isHalogen(b) ? "X" : b.getSymbol());
}

/**
* This performs the calculations used to generate the fingerprint
* @param paths
* @param mol
*/
private void calculate(List<String> paths, IAtomContainer mol) {
AllPairsShortestPaths apsp = new AllPairsShortestPaths(mol);
int numAtoms = mol.getAtomCount();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This work is the product of a US Government employee as part of his/her regular duties
* and is thus in the public domain.
*
* Author: Lyle D. Burgoon, Ph.D.
* Author: Lyle D. Burgoon, Ph.D. (lyle.d.burgoon@usace.army.mil)
* Date: 5 FEBRUARY 2018
*
*/
Expand Down

0 comments on commit b2cbdc8

Please sign in to comment.