chemaxon.descriptors
Class MDDBReader

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

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
Author:
Szilard Dorant

Field Summary
 
Fields inherited from class chemaxon.descriptors.MDReader
cloneResult, firstId, generateDescriptor, generateId, id, idTagName, lastReadMolecule, mdSet, takeTags
 
Constructor Summary
MDDBReader(ConnectionHandler ch, java.lang.String strucTableName, MDSet mdSet, java.lang.String sqlCondition)
          Deprecated. since 2.3 Use MDDBReader(java.lang.String, chemaxon.util.ConnectionHandler, chemaxon.descriptors.MDSet, java.lang.String) instead.
MDDBReader(ConnectionHandler ch, java.lang.String strucTableName, java.lang.String[] mdNames, java.lang.String sqlCondition)
          Deprecated. since 2.3 Use MDDBReader(java.lang.String, chemaxon.util.ConnectionHandler, java.lang.String[], java.lang.String) intead.
MDDBReader(java.lang.String strucTableName, ConnectionHandler ch, MDSet mdSet, java.lang.String query)
          Constructs a new MDDBReader object.
MDDBReader(java.lang.String strucTableName, ConnectionHandler ch, java.lang.String[] mdNames, java.lang.String query)
          Constructs a new MDDBReader object.
MDDBReader(java.lang.String strucTableName, ConnectionHandler ch, java.lang.String[] mdNames, java.lang.String query, int[] filterIDList, boolean indexTable)
          Constructs a new MDDBReader object.
 
Method Summary
 void close()
          Closes down the descriptor stream.
 int getLastID()
          Gets the cd_id that belongs to the last processed descriptor from the structure table
 MDSet getMDSet()
          Gets the molecular descriptor set.
 Molecule getMolecule()
          Gets the molecule that belongs to the last processed descriptor from the structure table
 MDSet next()
          Fetches the next element form the stream or returns null when there are no more accessible data.
 void reset()
          Initializes the MolecularDescriptor stream.
 
Methods inherited from class chemaxon.descriptors.MDReader
createMDSetComponent, getCloneResult, setCloneResult, setFirstId, setGenerateId, setIdTagName, setTakeTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MDDBReader

@Deprecated
public MDDBReader(ConnectionHandler ch,
                             java.lang.String strucTableName,
                             MDSet mdSet,
                             java.lang.String sqlCondition)
Deprecated. since 2.3 Use MDDBReader(java.lang.String, chemaxon.util.ConnectionHandler, chemaxon.descriptors.MDSet, java.lang.String) instead.

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 retreived.

MDDBReader

public MDDBReader(java.lang.String strucTableName,
                  ConnectionHandler ch,
                  MDSet mdSet,
                  java.lang.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 retreived.

MDDBReader

@Deprecated
public MDDBReader(ConnectionHandler ch,
                             java.lang.String strucTableName,
                             java.lang.String[] mdNames,
                             java.lang.String sqlCondition)
Deprecated. since 2.3 Use MDDBReader(java.lang.String, chemaxon.util.ConnectionHandler, java.lang.String[], java.lang.String) intead.

Constructs a new MDDBReader object. Using this constructor the descriptors will be read from datatabase

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 retreived.

MDDBReader

public MDDBReader(java.lang.String strucTableName,
                  ConnectionHandler ch,
                  java.lang.String[] mdNames,
                  java.lang.String query)
Constructs a new MDDBReader object. Using this constructor the descriptors will be read from datatabase

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 retreived.

MDDBReader

public MDDBReader(java.lang.String strucTableName,
                  ConnectionHandler ch,
                  java.lang.String[] mdNames,
                  java.lang.String query,
                  int[] filterIDList,
                  boolean indexTable)
Constructs a new MDDBReader object. Using this constructor the descriptors will be read from datatabase

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 retreived.
filterIDList - a cd_id list to filter with. No filtering if null.
Since:
JChem 3.1
Method Detail

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

getLastID

public int getLastID()
              throws MDReaderException
Gets the cd_id that belongs to the last processed descriptor from the structure table

Returns:
the ID, or -1 if not found
Throws:
MDReaderException

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