Class MDDBReader

java.lang.Object
chemaxon.descriptors.MDReader
chemaxon.descriptors.MDDBReader

@PublicApi public class MDDBReader extends MDReader
Class for reading MolecularDescriptors from a database. Capable of generating MolecularDescriptors on-the-fly from molecules if required.
Since:
JChem 2.0
  • Constructor Details

    • MDDBReader

      @Deprecated public MDDBReader(ConnectionHandler ch, String strucTableName, MDSet mdSet, String sqlCondition)
      Constructs a new MDDBReader object. Using this constructor the descriptors will be generated on-the-fly.
      Parameters:
      ch - a ConnectionHandler with an open connection to the database
      strucTableName - name of the structure table
      mdSet - the contains the appropriate descriptors
      sqlCondition - a condition to be used in an SQL where clause (e.g: "cd_id > 1000"). If null, then all rows are retrieved.
    • MDDBReader

      public MDDBReader(String strucTableName, ConnectionHandler ch, MDSet mdSet, String query)
      Constructs a new MDDBReader object. Using this constructor the descriptors will be generated on-the-fly.
      Parameters:
      ch - a ConnectionHandler with an open connection to the database
      strucTableName - name of the structure table
      mdSet - the contains the appropriate descriptors
      query - SQL query for filtering. It should contain the cd_id values. Example "select cd_id from mystructures where cd_id > 1000"). If null, then all rows are retrieved.
    • MDDBReader

      @Deprecated public MDDBReader(ConnectionHandler ch, String strucTableName, String[] mdNames, String sqlCondition)
      Constructs a new MDDBReader object. Using this constructor the descriptors will be read from database
      Parameters:
      ch - a ConnectionHandler with an open connection to the database
      strucTableName - name of the structure table
      mdNames - the names of the descriptors stored in the database
      sqlCondition - a condition to be used in an SQL where clause (e.g: "cd_id > 1000").If null or empty string all rows are retrieved.
    • MDDBReader

      public MDDBReader(String strucTableName, ConnectionHandler ch, String[] mdNames, String query)
      Constructs a new MDDBReader object. Using this constructor the descriptors will be read from database
      Parameters:
      ch - a ConnectionHandler with an open connection to the database
      strucTableName - name of the structure table
      mdNames - the names of the descriptors stored in the database
      query - SQL query for filtering. It should contain the cd_id values. Example "select cd_id from mystructures where cd_id > 1000"). If null, then all rows are retrieved.
    • MDDBReader

      public MDDBReader(String strucTableName, ConnectionHandler ch, String[] mdNames, String query, int[] filterIDList, int[] filterIDNotList, boolean indexTable)
      Constructs a new MDDBReader object. Using this constructor the descriptors will be read from database
      Parameters:
      ch - a ConnectionHandler with an open connection to the database
      strucTableName - name of the structure table
      mdNames - the names of the descriptors stored in the database
      query - SQL query for filtering. It should contain the cd_id values. Example "select cd_id from mystructures where cd_id > 1000"). If null, then all rows are retrieved.
      filterIDList - a cd_id list to filter with. No filtering if null.
      filterIDNotList - excluded cd_id list
      indexTable - true if used from cartridge
      Since:
      JChem 3.1
  • Method Details

    • getMDSet

      public MDSet getMDSet()
      Gets the molecular descriptor set. This method is provided in order to allow the used intervene into descriptor generation (for instance by overriding parameter settings).
      Overrides:
      getMDSet in class MDReader
      Returns:
      the MDSet object
    • reset

      public void reset() throws MDReaderException
      Initializes the MolecularDescriptor stream. If the stream is not empty the consequent call to next() returns the first element.
      Overrides:
      reset in class MDReader
      Throws:
      MDReaderException - when failed to reset the reader
    • next

      public MDSet next() throws MDReaderException
      Fetches the next element form the stream or returns null when there are no more accessible data. Also initializes the stream, if necessary.
      Specified by:
      next in class MDReader
      Returns:
      null if couldn't read descriptor or no more descriptors to read
      Throws:
      MDReaderException - when failed reading the next descriptor set
    • getMolecule

      public Molecule getMolecule() throws MDReaderException
      Gets the molecule that belongs to the last processed descriptor from the structure table
      Overrides:
      getMolecule in class MDReader
      Returns:
      the requested molecule, or null if not found
      Throws:
      MDReaderException - when failed reading the next descriptor set
    • getLastID

      public int getLastID()
      Gets the cd_id that belongs to the last processed descriptor from the structure table
      Returns:
      the ID, or -1 if not found
    • close

      public void close() throws MDReaderException
      Closes down the descriptor stream. After this, no more operation is permitted on the stream.
      NOTE: Doesn't close the database connection specified in the ConnectionHandler.
      Specified by:
      close in class MDReader
      Throws:
      MDReaderException - when failed to close the input stream