Skip to content

Instantly share code, notes, and snippets.

@johnmay
Last active May 15, 2016 20:07
Show Gist options
  • Select an option

  • Save johnmay/a0096ee3bc281a3af5f81d40b58b64c0 to your computer and use it in GitHub Desktop.

Select an option

Save johnmay/a0096ee3bc281a3af5f81d40b58b64c0 to your computer and use it in GitHub Desktop.
IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
SmilesParser smipar = new SmilesParser(bldr);
final String fname = "/data/nci_aug00.smi";
SMARTSQueryTool sqt = new SMARTSQueryTool("O=[C,N]aa[N,O;!H0]");
int num_hits = 0;
try (BufferedReader brdr = new BufferedReader(new FileReader(fname))) {
String line;
while ((line = brdr.readLine()) != null) {
IMolecule mol = smipar.parseSmiles(line);
if (sqt.matches(mol))
num_hits++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment