Nucleo: Java Library Reference

Distribution

The following items are included:

  • nucleojni.dll (libnucleojni.so in Linux distribution) — C++ library exposing the JNI interface
  • Nucleo.java — Java wrapper

Operation

com.indigo.Nucleo class object represents a library instance. All operations are represented by methods of this object. Several library instances may be created within one thread to act simultaneously and independently. However, each instance requires a certain amount of memory, thus it is recommended to have as few instances as possible.

The typical workflow is as follows:

  1. Create a library instance
  2. Load the molecules into the library
  3. Get the canonical SMILES, molecular weight, or gross formula of the selected molecules
  4. Specify the chain by a string of space-separated molecule names
  5. Get the canonical SMILES, molecular weight, or gross formula of the whole chain

Note: During calculation of the properties of specific nucleotides, as compared to nucleotide chains, pending R-sites are replaced with hydrogens.

Nucleo Class Public Methods

String getVersion ();

Returns the version of the Nucleo library.

void addUnit (String name, String molecule, String type);

Adds the nucleotide to the library (stored in memory). molecule should contain the MDL (Symyx) Molfile. name will be the unique name representing the given molecule in the library. type is ”terminator”, ”bridge”, ”base”, or null. Terminators are checked to have one R-site, whereas bridges and bases are checked to have two R-sites. Units with no given type (null) are not checked for R-sites count.

void clearUnits ();

Clears the library.

String getUnitSmiles (String name);

Returns the canonical SMILES of the nucleotide specified by name.

float getUnitMolWeight (String name);

Returns the molecular weight of the nucleotide specified by name.

String getUnitGrossFormula (String name);

Returns the gross formula of the nucleotide specified by name.

void setChain (String chain);

You must specify the chain by a string of space-separated molecule names. The first and last molecules should have one R-site; other molecules should have two R-sites.

String getSmiles ();

Returns the canonical SMILES of the whole nucleotide chain.

float getMolWeight ();

Returns the molecular weight of the whole nucleotide chain.

String getGrossFormula ();

Returns the gross formula of the whole nucleotide chain.

Error Handling

Whenever an error occurs, Exception is thrown. The getMessage() method normally gives the error information passed by the underlying C++ library.

Example

package test;

import com.indigo.Nucleo;
import java.io.*;

class NucleoTest
{
   public static void addFile (Nucleo nucleo, String name) throws Exception
   {
      File f = new File("../test/data/" + name + ".mol");
      FileReader rd = new FileReader(f);
      char[] buf = new char[(int)f.length()];
      rd.read(buf);
      nucleo.addUnit(name, new String(buf), null);
   }

   public static void main (String[] args)
   {
      try
      {
         Nucleo nucleo = new Nucleo();

         addFile(nucleo, "x01");
         addFile(nucleo, "x02");
         addFile(nucleo, "a00");
         addFile(nucleo, "c00");
         addFile(nucleo, "g00");
         addFile(nucleo, "u00");
         addFile(nucleo, "p01");
         addFile(nucleo, "p00");
         addFile(nucleo, "p03");

         System.out.println(nucleo.getUnitSmiles("a00"));
         System.out.println(nucleo.getUnitMolWeight("a00"));
         System.out.println(nucleo.getUnitGrossFormula("a00"));
         System.out.println(nucleo.getUnitSmiles("p03"));

         nucleo.setChain("x01 p01 a00 p00 c00 p00 u00 p00 g00 p00 x02");

         System.out.println(nucleo.getSmiles());
         System.out.println(nucleo.getMolWeight());
         System.out.println(nucleo.getGrossFormula());


         nucleo.clearUnits();

         addFile(nucleo, "x01");
         addFile(nucleo, "x02");
         addFile(nucleo, "u01");

         nucleo.setChain("x01 u01 x02");

         System.out.println(nucleo.getSmiles());
         System.out.println(nucleo.getMolWeight());
         System.out.println(nucleo.getGrossFormula());
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
}
 
Back to top
nucleo/jni_reference.txt · Last modified: 2009/09/22 15:15 (external edit)
 
 
This site belongs to SciTouch LLC. Contact us at info@scitouch.net if you have questions or feedback. See also Terms of Use.
This site is driven by Dokuwiki engine.