Skip to content

Commit

Permalink
improved the atom smarts
Browse files Browse the repository at this point in the history
  • Loading branch information
ntk73 authored and johnmay committed Oct 6, 2016
1 parent d354570 commit f2e3f55
Showing 1 changed file with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.zip.CRC32;
Expand Down Expand Up @@ -527,13 +528,21 @@ public String getFPSmarts(FP fp, IAtomContainer molecule)
return getAtomSmarts(molecule, fp.atoms[0]);

String atStr[] = new String[n];
String indStr[] = new String[n];
String indexStr[] = new String[n];
int addBonds[][] = new int [n][];
int atLayer[] = new int [n];

for (int i = 0; i < n; i++)
{
atLayer[i] = -1;
indexStr[i] = "";
addBonds [i] = null;
}

//Handle first atoms

//Scan atom layers

//Scan atom layers of the first atom
//TODO

return null;
Expand All @@ -545,24 +554,35 @@ private String getAtomSmarts(IAtomContainer mol, int atNum)
Integer chrg = at.getFormalCharge();
String atStr = at.getSymbol();

boolean FlagBrackets = false;

String chStr = "";
if (chrg != null)
if (chrg != 0)
{
chStr = getChargeSmartsStr(chrg);
FlagBrackets = true;
}
/*

if (!FlagBrackets)
{
if (atStr.equals("C")||atStr.equals("N")||atStr.equals("O")||atStr.equals("S")||atStr.equals("P")
||atStr.equals("B")||atStr.equals("Cl")||atStr.equals("Br")||atStr.equals("I")||atStr.equals("F"))
{
//do nothing
}
else
FlagBrackets = true;
}
*/

//Handle aromaticity
if (atomArom[atNum])
atStr = atStr.toLowerCase();

if (FlagBrackets)
atStr = "[" + atStr + chStr + "]";

return atStr = "[" + atStr + chStr + "]";
return atStr;
}

private String getChargeSmartsStr(int chrg)
Expand Down

0 comments on commit f2e3f55

Please sign in to comment.