File: main.java

package info (click to toggle)
rdkit 201203-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 37,840 kB
  • sloc: cpp: 93,902; python: 51,897; java: 5,192; ansic: 3,497; xml: 2,499; sql: 1,641; yacc: 1,518; lex: 1,076; makefile: 325; fortran: 183; sh: 153; cs: 51
file content (32 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// $Id: main.java 741 2008-07-04 04:18:58Z glandrum $
// Copyright (C) 2008 Greg Landrum
//
// @@  All Rights Reserved @@

import org.RDKit.*;

public class main {
  static {
    try {
	System.loadLibrary("RDKFuncs");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
      System.exit(1);
    }
  }
  public static void main(String argv[]) {
      String smiles="c1ccccc1";
      ROMol mol= RDKFuncs.MolFromSmiles(smiles);
      long nAtoms = mol.getNumAtoms();
      System.out.println("nAtoms: " + nAtoms);
      System.out.println("smi: " + RDKFuncs.MolToSmiles(mol));
      System.out.println("atom: " + mol.getAtomWithIdx(0).getAtomicNum());
      System.out.println("bond: " + mol.getBondWithIdx(0).getIdx());
      System.out.println("bond: " + mol.getBondWithIdx(0).getBondType());
      System.out.println("hss: " + mol.hasSubstructMatch(RDKFuncs.MolFromSmarts("c")));
      System.out.println("hss: " + mol.hasSubstructMatch(RDKFuncs.MolFromSmarts("C")));
      System.out.println("hss: " + mol.hasSubstructMatch(RDKFuncs.MolFromSmarts("C")));
      RingInfo rI= mol.getRingInfo();
      System.out.println("ri: " + rI.isAtomInRingOfSize(0,6) + " " + rI.isAtomInRingOfSize(0,5) );
  }
}