Class JChemSearch
- All Implemented Interfaces:
TableTypeConstants
,chemaxon.license.Licensable
,SearchConstants
Example for using the class:
searcher = new JChemSearch(); searcher.setQueryStructure("c1cnccc1Cl"); searcher.setConnectionHandler(conHandler); searcher.setStructureTable("cduser.structures"); searchOptions = new JChemSearchOptions(JChemSearch.SIMILARITY); searchOptions.setDissimilarityThreshold(0.8F); searchOptions.setMaxResultCount(100); searcher.setSearchOptions(searchOptions); searcher.setRunMode(JChemSearch.RUN_MODE_SYNCH_COMPLETE); searcher.run();
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class for presenting the available dissimilarity metrics for similarity search. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant for the generation of result tables.static final int
Constant for the generation of result tables.static final int
Deprecated.static final int
Constant for ordering the result.static final int
Constant for the generation of result tables.static final int
Constant for ordering the result.static final int
Constant for ordering the result.static final int
Constant for ordering the result.static final int
Runs the search in a new thread;run()
orsetRunning(boolean)
return immediately.static final int
Runs the search in a new thread;run()
orsetRunning(boolean)
return immediately.static final int
The "runner" methods (run()
orsetRunning(boolean)
return only after all hits has been found.protected final JChemSearchOptions
Object to store all search parameters.Fields inherited from class chemaxon.util.ErrorHandler
CLASS_NOT_FOUND_ERROR, DATABASE_SEARCH_ERROR, exception, ILLEGAL_ACCESS_ERROR, INSTANTIATION_ERROR, IO_ERROR, MAX_SEARCH_FREQUENCY_EXCEEDED_ERROR, MOL_FORMAT_ERROR, NO_ERROR, SQL_ERROR, UNIDENTIFIED_ERROR
Fields inherited from interface chemaxon.sss.SearchConstants
ABS_STEREO_ALWAYS_ON, ABS_STEREO_CHIRAL_FLAG, ABS_STEREO_TABLE_OPTION, ATTACHED_DATA_MATCH_EXACT, ATTACHED_DATA_MATCH_GENERAL, ATTACHED_DATA_MATCH_IGNORE, ATTACHMENT_ATOM, ATTACHMENT_LABEL, ATTACHMENT_MAP, ATTACHMENT_NONE, ATTACHMENT_POINT, ATTACHMENT_RLABEL, CHARGE_MATCHING_DEFAULT, CHARGE_MATCHING_EXACT, CHARGE_MATCHING_IGNORE, DEFAULT_DISSIMILARITY_THRESHOLD, DEFAULT_SEARCHTYPE, DISSIMILARITY_PROPERTY_NAME, DUPLICATE, FULL, FULL_FRAGMENT, HCOUNT_MATCHING_AUTO, HCOUNT_MATCHING_EQUAL, HCOUNT_MATCHING_GREATER_OR_EQUAL, HIT_EXCLUDEDQ, HIT_LP, HIT_MULTICENTER, HIT_NON_R, HIT_ORDERING_NONE, HIT_ORDERING_UNDEF_R_MATCHING_GROUP_FIRST, HIT_R, HIT_R_EMPTY_MATCH, HIT_UNMAPABLE, IMPLICIT_H_MATCHING_DEFAULT, IMPLICIT_H_MATCHING_DISABLED, IMPLICIT_H_MATCHING_ENABLED, IMPLICIT_H_MATCHING_IGNORE, ISOTOPE_MATCHING_DEFAULT, ISOTOPE_MATCHING_EXACT, ISOTOPE_MATCHING_IGNORE, MARKUSH_HIT_INNER, MARKUSH_HIT_ORIGINAL, MATCH_COUNT_BETWEEN, MATCH_COUNT_RELATION, NO_ABAS, NO_SCREEN, POSITION_ON_0TH_HEAVY_ATOM, RADICAL_MATCHING_DEFAULT, RADICAL_MATCHING_EXACT, RADICAL_MATCHING_IGNORE, SEARCH_MODE_NAMES, SEARCH_TYPE_NAMES, SIMILARITY, STEREO_DIASTEREOMER, STEREO_ENANTIOMER, STEREO_EXACT, STEREO_IGNORE, STEREO_MODEL_COMPREHENSIVE, STEREO_MODEL_DEFAULT, STEREO_MODEL_GLOBAL, STEREO_MODEL_LOCAL, STEREO_SPECIFIC, SUBSTRUCTURE, SUPERSTRUCTURE, TAUTOMER_SEARCH_DEFAULT, TAUTOMER_SEARCH_OFF, TAUTOMER_SEARCH_ON, TAUTOMER_SEARCH_ON_IGNORE_TAUTOMERSTEREO, UNDEF_R_MATCHING_ALL, UNDEF_R_MATCHING_GROUP, UNDEF_R_MATCHING_GROUP_H, UNDEF_R_MATCHING_GROUP_H_EMPTY, UNDEF_R_MATCHING_UNDEF_R, VAGUE_BOND_DEFAULT, VAGUE_BOND_LEVEL_HALF, VAGUE_BOND_LEVEL1, VAGUE_BOND_LEVEL2, VAGUE_BOND_LEVEL3, VAGUE_BOND_LEVEL4, VAGUE_BOND_OFF
Fields inherited from interface chemaxon.jchem.db.TableTypeConstants
FP_DEFAULT_BITS_PER_PATTERN, FP_DEFAULT_LENGTH_IN_INTS, FP_DEFAULT_PATTERN_LENGTH, MYSQL_DEFAULT_TABLE_TYPE, MYSQL_FORCE_INNO_DB, MYSQL_FORCE_MYISAM, TABLE_TYPE_ANY_STRUCTURES, TABLE_TYPE_DEFAULT, TABLE_TYPE_EXPLANATIONS, TABLE_TYPE_IS_NOT_SUPPORTED, TABLE_TYPE_MARKUSH_LIBRARIES, TABLE_TYPE_MOLECULES, TABLE_TYPE_NAMES, TABLE_TYPE_QUERY_STRUCTURES, TABLE_TYPE_REACTIONS
-
Constructor Summary
ConstructorDescriptionCreates new JChemSearch classJChemSearch
(chemaxon.jchem.db.distributed.DistributedNodes distributedNodes) Creates a new JChemSearch class for distributed search.JChemSearch
(chemaxon.jchem.db.distributed.DistributedNodes distributedNodes, String indexedTable, String indexedColumn) For internal use only.JChemSearch
(String indexedTable, String indexedColumn) For internal use only. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Throws the exception stored in the object.void
Cleans stored search results.List<byte[]>
getAvailableExtraInformation
(int minimumHitSize) For internal use only.int[]
getAvailableNewHits
(int minimumHitSize) Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.For checking for cache errors.long
Gets the time spent with cache loading for the target structure table.double
Returns the size of the cache for the target structure table.double
Returns an estimate of the cache size for the target structure table.Getter for property connection.Getter for property connectionHandler.float[]
Getter for dissimilarity results.float
getDissimilarity
(int index) Indexed getter for property dissimilarity.getDissimilarityMetrics
(ConnectionHandler ch, String tableName) Returns the available dissimilarity metrics for the given table.getDissimilarityMetrics
(ConnectionHandler ch, String tableName, String indexedTable, String indexedColumn) int
Gets the number of enumerates used while screening the databaseList<byte[]>
For internal use only.long
Gets the first hit's retrieving time (measured from start of screening).getHitsAsHitDisplayTool
(int[] idList, HitColoringAndAlignmentOptions options, List<String> dataFieldNames, List<Object[]> dataFieldValues, List<? super Molecule> molecules, List<byte[]> sources) Gets a HitDisplayTool object from which the results can be retrieved.Molecule[]
getHitsAsMolecules
(int[] idList, HitColoringAndAlignmentOptions options, List<String> dataFieldNames, List<Object[]> dataFieldValues) Returns hits ready for display.getHitsAsRgDecomp
(int[] hits, int attachmentType) Returns hits as result of r-group decomposition according to the original query.int
Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.int
Gets the number of processing threads.int
getOrder()
Getter for property order.Getter for property progressMessage.Getter for property queryStructure.int
getResult
(int index) Indexed getter for property results.chemaxon.jchem.db.SearchCoreReturnedValue
For internal use only.int
Getter for property resultCount.int[]
Returns anint
array containing thecd_id
values of found compounds.Getter for property resultTable.int
Getter for property resultTableMode.int
Retruns the current run mode.int
Gets the number of total screened structures.int
Gets the number of total screened structures.int
Gets the number of unique screened structures.int[]
Gets the screened unique structures' ids.long
Gets the screening time.Returns the SearchOptions object associated with this Search object.long
Gets the total search time.Getter for property structureTable.boolean
Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.boolean
Getter for property infoToStdError.boolean
boolean
Getter for property maxResultCountReached.boolean
Getter for property maxTimeReached.boolean
Getter for property running.boolean
Gets whether target structure table is a Markush tablevoid
run()
Starts searching.void
setConnectionHandler
(ConnectionHandler connectionHandler) Sets the database connection.void
setFilterIDList
(int[] ids) Specifies a list of cd_id values that are allowed to be included in the result set.void
setFilterIDNotList
(int[] ids) Specifies a list of cd_id values that should not be included in the result set.void
setInfoToStdError
(boolean infoToStdError) Setter for property infoToStdError.void
void
setNumberOfProcessingThreads
(int threads) Sets the number of processing threads.void
setOrder
(int order) Setter for property order.void
setProgressMessage
(String message) void
setQueryFingerprint
(int[] queryFp) Currently internal use only.void
setQueryStructure
(Molecule queryMol) Sets the query structure.void
setQueryStructure
(String queryStructure) Setter for property queryStructure.void
setResultTable
(String resultTable) Setter for property resultTable.void
setResultTableMode
(int resultTableMode) Setter for property resultTableMode.void
setRunMode
(int runMode) Specifies whether the search is performed synchronously or asychronously and if performed asynchronously, whether the hits can be obtained as soon as they are found or only after the search has completed.void
setRunning
(boolean run) Setter for property running.void
setSearchOptions
(JChemSearchOptions options) Sets search parameters.void
setStructureTable
(String structureTable) Setter for property structureTable.void
setTargetCollection
(chemaxon.jchem.base.storage.search.CurrentTargetCollection targetCollection) For internal use only.void
setThreadPriority
(int priority) Sets the priority of the processing threads.toString()
void
Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.Methods inherited from class chemaxon.util.ErrorHandler
checkError, getError, getErrorMessage, getException, getStackTrace
-
Field Details
-
NO_RESULT_TABLE
public static final int NO_RESULT_TABLEConstant for the generation of result tables. Meaning: Don't store the results in a table. (Value=0)- See Also:
-
CREATE_OR_REPLACE_RESULT_TABLE
public static final int CREATE_OR_REPLACE_RESULT_TABLEConstant for the generation of result tables. Meaning: Create a result table. If a table with same name exists, replace it with the new one. (Value=2)- See Also:
-
APPEND_TO_RESULT_TABLE
public static final int APPEND_TO_RESULT_TABLEConstant for the generation of result tables. Meaning: Append to an existing result table. Create a new one if it doesn't exist (Value=3)- See Also:
-
NO_ORDERING
public static final int NO_ORDERINGConstant for ordering the result. Meaning: Don't order the result (Value=0)- See Also:
-
ORDERING_BY_ID
public static final int ORDERING_BY_IDConstant for ordering the result. Meaning: Order the result according to thecd_id
values (Value=1)- See Also:
-
ORDERING_BY_ID_OR_SIMILARITY
public static final int ORDERING_BY_ID_OR_SIMILARITYConstant for ordering the result. Meaning: Order the result according to the calculated dissimilarity in the case of dissimilarity searching, use thecd_id
values otherwise (Value=2)- See Also:
-
ORDERING_BY_FILTER_ID_LIST
public static final int ORDERING_BY_FILTER_ID_LISTConstant for ordering the result. Meaning: Order the result according to thefilterIDList
- See Also:
-
RUN_MODE_SYNCH_COMPLETE
public static final int RUN_MODE_SYNCH_COMPLETEThe "runner" methods (run()
orsetRunning(boolean)
return only after all hits has been found.- Since:
- JChem 5.0
- See Also:
-
RUN_MODE_ASYNCH_COMPLETE
public static final int RUN_MODE_ASYNCH_COMPLETERuns the search in a new thread;run()
orsetRunning(boolean)
return immediately. Exceptions are not thrown by therun()
method they should be checked by thecheckException()
orErrorHandler.checkError()
methods.- Since:
- JChem 5.0
- See Also:
-
RUN_MODE_ASYNCH_PROGRESSIVE
public static final int RUN_MODE_ASYNCH_PROGRESSIVERuns the search in a new thread;run()
orsetRunning(boolean)
return immediately. The methodshasMoreHits()
,getNextHit()
andgetAvailableNewHits(int)
can be used retrieve hits as soon as they become available. Exceptions are not thrown by therun()
method they should be checked by thecheckException()
orErrorHandler.checkError()
methods.
This mode doesn't support- SIMILARITY search, (
SearchOptions(int)
), - MD - search,
- Inverse hits (
JChemSearchOptions.setReturnsNonHits(boolean)
) - return order other than
NO_ORDERING
(setOrder(int)
).
- Since:
- JChem 5.0
- See Also:
- SIMILARITY search, (
-
searchOptions
Object to store all search parameters. This is used during the search and stores the settings of the previous search. -
MAXIMAL_ACCEPTEDSEARCHTIME_MINUTES
Deprecated.- See Also:
-
-
Constructor Details
-
JChemSearch
public JChemSearch()Creates new JChemSearch class -
JChemSearch
For internal use only.- Parameters:
indexedTable
- the name of the tableindexedColumn
- the name of the column
-
JChemSearch
public JChemSearch(chemaxon.jchem.db.distributed.DistributedNodes distributedNodes, String indexedTable, String indexedColumn) For internal use only.- Parameters:
distributedNodes
- the distributed nodesindexedTable
- the name of the tableindexedColumn
- the name of the column
-
JChemSearch
public JChemSearch(chemaxon.jchem.db.distributed.DistributedNodes distributedNodes) Creates a new JChemSearch class for distributed search.For internal use only.
- Parameters:
distributedNodes
- the distributed nodes
-
-
Method Details
-
checkException
Description copied from class:ErrorHandler
Throws the exception stored in the object. Needed because Tomcat errorpages don't handle errors of typeThrowable
that are not inheritors ofException
.- Overrides:
checkException
in classErrorHandler
- Throws:
Exception
- the exception stored, boxed as Exception
-
getConnectionHandler
Getter for property connectionHandler.- Returns:
- Value of property connectionHandler.
-
setConnectionHandler
Sets the database connection.- Parameters:
connectionHandler
- a ConnectionHandler object containing a live connection to the database
-
getConnection
Getter for property connection.- Returns:
- Value of property connection.
-
getDissimilarityMetrics
public static JChemSearch.DissimilarityMetrics getDissimilarityMetrics(ConnectionHandler ch, String tableName) throws SQLException Returns the available dissimilarity metrics for the given table.- Parameters:
ch
- ConnectionHandler with live connectiontableName
- the name of the JChem structure table- Returns:
- the information about the available metrics, or
null
if no metrics are available - Throws:
SQLException
- in case it encounters an sql problem.- Since:
- JChem 3.2
- See Also:
-
getDissimilarityMetrics
public static JChemSearch.DissimilarityMetrics getDissimilarityMetrics(ConnectionHandler ch, String tableName, String indexedTable, String indexedColumn) throws SQLException - Throws:
SQLException
-
getCacheError
For checking for cache errors. Should be called after the search is finished.- Returns:
- the error text, or
null
in case of normal execution. - Since:
- JChem 3.0
-
getQueryStructure
Getter for property queryStructure.- Returns:
- Value of property queryStructure.
-
setQueryStructure
Setter for property queryStructure. The query structure may be in MDL Molfile, Smiles or other format recognized by JChem. If the specified value isnull
or empty string, then it is interpreted as an empty query structure. (For more information, see the user's guide.)NOTE for Daylight formats: If search type is
SearchConstants.DUPLICATE
,SearchConstants.SUPERSTRUCTURE
orSearchConstants.SIMILARITY
, treats SMILES/SMARTS input strings as SMILES, otherwise as SMARTS.- Parameters:
queryStructure
- New value of property queryStructure.
-
setQueryStructure
Sets the query structure. If the specified value isnull
, then it is interpreted as an empty query structure. (For more information, see the user's guide.)- Parameters:
queryMol
- the query structure.
-
setQueryFingerprint
public void setQueryFingerprint(int[] queryFp) Currently internal use only.- Parameters:
queryFp
- the query fingerprint.
-
getStructureTable
Getter for property structureTable.- Returns:
- Value of property structureTable.
-
setStructureTable
Setter for property structureTable. It specifies the name of the table to be searched for structures containing the query.- Parameters:
structureTable
- New value of property structureTable.
-
setFilterIDList
public void setFilterIDList(int[] ids) Specifies a list of cd_id values that are allowed to be included in the result set. Useful for narrowing the result set of the search (e.g., based on the {#getResults() results} of a previous search).If the given array is empty, no hits will be returned. Resetting the list is possible by calling the method with
null
parameter.- Parameters:
ids
- the cd_id values in an array- Since:
- JChem 3.1
-
setFilterIDNotList
public void setFilterIDNotList(int[] ids) Specifies a list of cd_id values that should not be included in the result set.- Parameters:
ids
- the cd_id values in an array- Since:
- JChem 3.1.2
-
isInfoToStdError
public boolean isInfoToStdError()Getter for property infoToStdError.- Returns:
- Value of property infoToStdError.
-
setInfoToStdError
public void setInfoToStdError(boolean infoToStdError) Setter for property infoToStdError. If set to true, information useful for testing will be written in the servlet server's error log file. (Default:false
)- Parameters:
infoToStdError
- New value of property infoToStdError.
-
getRunMode
public int getRunMode()Retruns the current run mode.- Returns:
- the current run mode.
- Since:
- JChem 5.0
- See Also:
-
setRunMode
public void setRunMode(int runMode) Specifies whether the search is performed synchronously or asychronously and if performed asynchronously, whether the hits can be obtained as soon as they are found or only after the search has completed.The default run mode is
RUN_MODE_SYNCH_COMPLETE
- Parameters:
runMode
- Accepted values:- Since:
- JChem 5.0
-
setSearchOptions
Sets search parameters.- Parameters:
options
- search options. Will be copied, modification of the original object does not affect future searches unless this method is called again. The timeout limit of the new options will be applied to further searches.- Since:
- JChem 5.0
- See Also:
-
getSearchOptions
Returns the SearchOptions object associated with this Search object. The object returned is linked with this Search object, so modifications in the returned SearchOptions object (e.g timeout limit) will change directly the behaviour of this Search object.- Returns:
- the current serarch options.
- Since:
- JChem 5.0
- See Also:
-
getOrder
public int getOrder()Getter for property order.- Returns:
- Value of property order.
-
setOrder
public void setOrder(int order) Setter for property order. Determines the order of the result.- Parameters:
order
- New value of property order. Acceptable values:NO_ORDERING
,ORDERING_BY_ID
,ORDERING_BY_ID_OR_SIMILARITY
(default), andORDERING_BY_FILTER_ID_LIST
.If an "ORDER BY" clause is used in
filter query
, and noinverse hit list
is requested, this setting is ignored, and the "ORDER BY" clause takes precedence.
-
setResultTable
Setter for property resultTable. Sets the result table that will contain thecd_id
of hits. In the case of searching similar structures, the similarity value is also stored in columnsimilarity
.- Parameters:
resultTable
- New value of property resultTable.- See Also:
-
getResultTableMode
public int getResultTableMode()Getter for property resultTableMode.- Returns:
- Value of property resultTableMode.
-
setResultTableMode
public void setResultTableMode(int resultTableMode) Setter for property resultTableMode. It instructs the searcher about the way of handling the result table. Modes:
Don't store the results in a table. (Value=0)NO_RESULT_TABLE
-
Create a result table. If a table with the same name exists, replace it with the new one. (Value=1)CREATE_OR_REPLACE_RESULT_TABLE
Append to an existing result table. Create a new one if it doesn't exist (Value=2)APPEND_TO_RESULT_TABLE
NO_RESULT_TABLE
)- Parameters:
resultTableMode
- New value of property resultTableMode.- See Also:
-
getResultTable
Getter for property resultTable.- Returns:
- Value of property resultTable.
-
setNumberOfProcessingThreads
public void setNumberOfProcessingThreads(int threads) Sets the number of processing threads.- Parameters:
threads
- the number of threads.
If set to 0, the number of threads will be equal to the number of logical processors available for the Java Vitual Machine (default).
NOTE: Under Java Runtime Environment 1.3.1 or older the number of processors cannot be determined. In this case the default number of threads is 16.- Since:
- JChem 3.0
-
getNumberOfProcessingThreads
public int getNumberOfProcessingThreads()Gets the number of processing threads.- Returns:
- number of threads executed the database search.
-
setThreadPriority
public void setThreadPriority(int priority) Sets the priority of the processing threads. Only effective, ifsetRunMode(int)
is set to eitherRUN_MODE_ASYNCH_COMPLETE
orRUN_MODE_ASYNCH_PROGRESSIVE
.- Parameters:
priority
- the priority ranging 1 (Thread.MIN_PRIORITY
) to 10 (Thread.MAX_PRIORITY
).
The default and recommended setting is 1 (Thread.MIN_PRIORITY
).
NOTE: if all other threads are not constantly calculating, a low priority setting will not slow down the search process, and it will help user interfaces to be responsive.- Since:
- JChem 3.0
-
getResult
public int getResult(int index) Indexed getter for property results. Returns acd_id
value of the found compound specified byindex
. If result table is generated,getResult
throwsNullPointerException
.- Parameters:
index
- Index of the property.- Returns:
- Value of the property at
index
. - See Also:
-
getResultContext
public chemaxon.jchem.db.SearchCoreReturnedValue getResultContext()For internal use only.- Returns:
- the result
-
getResults
public int[] getResults()Returns anint
array containing thecd_id
values of found compounds. If a result table is generated in the database, it returnsnull
.- Returns:
- an array of
cd_id
s
-
getExtraInformation
For internal use only.- Returns:
- extrainformation for all results
-
cleanResults
public void cleanResults()Cleans stored search results. Can be called to save memory while keeping the JChemSearch object. since JChem 3.0 -
getDissimilarity
public float getDissimilarity(int index) Indexed getter for property dissimilarity. Returns the calculated dissimilarity value of the found compound specified byindex
and the query structure. If searching has not been finished yet or if a result table is generated,getDissimilarity
throwsNullPointerException
.- Parameters:
index
- Index of the property.- Returns:
- Value of the property at
index
. - See Also:
-
getDissimilarity
public float[] getDissimilarity()Getter for dissimilarity results. Returns the calculated dissimilarity values calculated for the last query strucutre. If searching has not been finished yet or if a result table is generated,getDissimilarity
throwsNullPointerException
.- Returns:
- the dissimilarity results.
- See Also:
-
getProgressMessage
Getter for property progressMessage. It returns a message that shows the state of the search. It can be used for showing the progress of the search.- Returns:
- Value of property progressMessage.
-
isMaxResultCountReached
public boolean isMaxResultCountReached()Getter for property maxResultCountReached. It returns true if the search was stopped because the number of hits had reached the maximum value, false otherwise.- Returns:
- Value of property maxResultCountReached.
-
isMaxTimeReached
public boolean isMaxTimeReached()Getter for property maxTimeReached. It returns true if the search stopped because the time that passed since the start of the searched had reached the maximum value, false otherwise.- Returns:
- Value of property maxTimeReached.
-
getResultCount
public int getResultCount()Getter for property resultCount. It returns the number of hits found by the search.- Returns:
- Value of property resultCount.
-
isRunning
public boolean isRunning()Getter for property running.- Returns:
- Value of property running.
-
setRunning
Setter for property running. If it is set totrue
and the search has not been started yet, then searching is unleashed. If it is set tofalse
and a search is running, the the process will be stopped. (Default:false
)- Parameters:
run
- New value of property run.- Throws:
IOException
- if an io error is encounteredDatabaseSearchException
- if a search error occursSQLException
- if an sql exception is encountered
-
run
Starts searching. Same assetRunning
(true)- Throws:
IOException
- if an io error is encounteredDatabaseSearchException
- if a search error occursSQLException
- if an sql exception is encountered
-
hasMoreHits
Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.
Returnstrue
if there are more hits to retrieve withgetNextHit()
orgetAvailableNewHits(int)
,false
otherwise.- Returns:
true
if there are more hits to retrieve withgetNextHit()
orgetAvailableNewHits(int)
,false
otherwise.- Throws:
InterruptedException
- if the thread is interrupted during waiting- Since:
- JChem 5.0
-
getNextHit
Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.
Returns the next available hit. Waits until at least one is available or throws NoSuchElementException, there are no more hits to return.- Returns:
- the next available hit. Waits until at least one is available or throws NoSuchElementException, there are no more hits to return.
- Throws:
InterruptedException
- if the calling thread was interrupted while waiting for the next available hit.- Since:
- JChem 5.0
-
getAvailableNewHits
public int[] getAvailableNewHits(int minimumHitSize) throws InterruptedException, DatabaseSearchException Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.
Returns all new hits available at the time of return, but at leastminimumHitSize
new hits.- Parameters:
minimumHitSize
- the minimum number of hits to return, which will be waited if not yet available.- Returns:
- all new hits available at the time of return, but at
least
minimumHitSize
new hits. - Throws:
InterruptedException
- if the calling thread was interrupted while waiting.DatabaseSearchException
- if there was an error during searching.- Since:
- JChem 5.0
-
getAvailableExtraInformation
public List<byte[]> getAvailableExtraInformation(int minimumHitSize) throws InterruptedException, DatabaseSearchException For internal use only.- Parameters:
minimumHitSize
- minmum size of hits to collect- Returns:
- list of extrainformation
- Throws:
InterruptedException
- if the thread is interrupted during waitingDatabaseSearchException
- if the search ecountered a problem
-
waitUntilSearchComplete
Used with run mode =RUN_MODE_ASYNCH_PROGRESSIVE
.
Waits until after the search has completed.- Throws:
InterruptedException
- if the calling thread was interrupted while waiting.- Since:
- JChem 5.0
-
getScreenedCount
public int getScreenedCount()Gets the number of total screened structures.- Returns:
- the number of total screened structures, or -1 if the screened count was not calculated
- Since:
- JChem 5.6
-
getScreenedCountUnique
public int getScreenedCountUnique()Gets the number of unique screened structures.- Returns:
- the number of unique screened structures, or -1 if the screened count was not calculated
- Since:
- JChem 5.6
-
getScreenedCountTotal
public int getScreenedCountTotal()Gets the number of total screened structures.- Returns:
- the number of total screened structures, or -1 if the screened count was not calculated
- Since:
- JChem 5.6
-
getScreenedResults
public int[] getScreenedResults()Gets the screened unique structures' ids.- Returns:
- the screened structures' ids
- Since:
- JChem 5.6
-
getScreeningTime
public long getScreeningTime()Gets the screening time.- Returns:
- the screening time in milliseconds
-
getFirstHitTime
public long getFirstHitTime()Gets the first hit's retrieving time (measured from start of screening).- Returns:
- the retrieving time of first hit in milliseconds
-
getSearchTime
public long getSearchTime()Gets the total search time.- Returns:
- the search time in milliseconds (includes screening time) If the returned value is -1 then the search time is invalid (e.g search hasn't finished yet).
-
isTargetMarkush
public boolean isTargetMarkush()Gets whether target structure table is a Markush table- Returns:
true
if target table is a Markush table,false
if not
-
getEnumerationCount
public int getEnumerationCount()Gets the number of enumerates used while screening the database- Returns:
- the number of enumerates for the query
-
isLicensed
public boolean isLicensed()- Specified by:
isLicensed
in interfacechemaxon.license.Licensable
-
setLicenseEnvironment
- Specified by:
setLicenseEnvironment
in interfacechemaxon.license.Licensable
-
setProgressMessage
-
getCacheLoadTime
Gets the time spent with cache loading for the target structure table. Returns- Returns:
- duration for the last successful cache loading in milliseconds
- Throws:
IllegalStateException
- if no cache is loaded yet
-
getCacheSizeEstimate
Returns an estimate of the cache size for the target structure table.- Returns:
- estimated size of the cache for the target structure table in MBs
- Throws:
IllegalStateException
- if no cache is loaded yet
-
getCacheSize
Returns the size of the cache for the target structure table.Warning: the calculation performed by this function may be slow and may consume a large amount of memory. Consider to use
getCacheSizeEstimate()
to obtain an estimation of the cache size much faster.- Returns:
- the size of the cache for the target structure table in MBs
- Throws:
IllegalStateException
- if no cache is loaded yet
-
getHitsAsRgDecomp
public RgDecompResults getHitsAsRgDecomp(int[] hits, int attachmentType) throws SearchException, MolFormatException, SQLException Returns hits as result of r-group decomposition according to the original query. Various results are returned in one RgDecompResults object:- scaffold of query (
RgDecompResults.getScaffold()
) - number of ligands (
RgDecompResults.getLigandsNumber()
) - matched target indexes (
RgDecompResults.getIncludedIds()
) - non-matched target indexes (
RgDecompResults.getSkippedIds()
) - hits in a Markush molecule (
RgDecompResults.getHitsAsMarkush()
) - r-group decomposed hits (
RgDecompResults.getHitsAsRgDecomp()
) - r-group decomposed hits in colored table format (
RgDecompResults.getHitsAsTable()
) Format of the table (first row is header row, following rows contain targets, 1 hit/target):[query]: molecule R1 R2 R3 ... --------------------------------------------------------- [target1]: molecule1 ligand1.1 ligand1.2 ligand1.3 [target2]: molecule2 ligand2.1 ligand2.2 ligand2.3
As an example see decomposition table.
RGroupDecomposition API documentation.
- Parameters:
hits
- cd_ids of target structuresattachmentType
- Type of visualization of attachment of ligands.- Returns:
- An RGDecompResults object.
- Throws:
SQLException
- if an sql exception is encounteredSearchException
- Search failureMolFormatException
- if the molecule can't be read- Since:
- JChem 5.3
- See Also:
- scaffold of query (
-
getHitsAsMolecules
public Molecule[] getHitsAsMolecules(int[] idList, HitColoringAndAlignmentOptions options, List<String> dataFieldNames, List<Object[]> dataFieldValues) throws SQLException, IOException, SearchException, DatabaseSearchException Returns hits ready for display. If hit alignment or coloring is needed, the graph search must be repeated for the selected structures to obtain the atom indexes of hits. (Storing this data would consume too much memory for large hit sets) If alignment mode has been set to rotate, and query has 0 dimension, it will be cleaned in 2d. If alignment mode has been set to partial clean, this option will be changed to rotate in this case.- Parameters:
idList
- the cd_id list of hits to be retrieved.options
- the options for coloring and alignment. Ifnull
the structures will be displayed in their original form.dataFieldNames
- fields of the jchem table that should be fetched together with the structure ornull
.dataFieldValues
- an empty List required or it can benull
. The fetched values will be stored in this object as Object[] elements.- Returns:
- the hits as Molecules, colored and aligned if needed. If coloring
is specified in case of
SearchConstants.SUPERSTRUCTURE
search mode, always the query structure is returned, the target subgraph is colored. If there is no hit for a target then the appropriate element of the result array isnull
. - Throws:
SQLException
- if the fetched row is deletedIOException
- if an io error is encounteredSearchException
- if an error occurred during searchDatabaseSearchException
- if an error occurred during search- Since:
- JChem 5.0
-
getHitsAsHitDisplayTool
public HitDisplayTool getHitsAsHitDisplayTool(int[] idList, HitColoringAndAlignmentOptions options, List<String> dataFieldNames, List<Object[]> dataFieldValues, List<? super Molecule> molecules, List<byte[]> sources) throws SQLException, IOException, SearchException, DatabaseSearchException Gets a HitDisplayTool object from which the results can be retrieved. Parameters are similar togetHitsAsMolecules(int[], HitColoringAndAlignmentOptions, List, List)
Additional parameters: molecules, sources Example usage:List<Molecule> molecules = new ArrayList<Molecule>(); List<byte[]> sources = new ArrayList<byte[]>(); HitDisplayTool colorUtil = getHitsAsHitDisplayTool(idList, options, dataFieldNames, dataFieldValues, molecules, sources); for (int x = 0, n = molecules.size(); x < n; x++) { if (molecules.get(x) == null) { // not found continue; } colorUtil.setMoleculeMarkushSourceTarget(molecules.get(x), sources.get(x)); // fetch the hits using colorUtil.getNextHit() or colorUtil.getHits(int) // ... }
- Parameters:
idList
- the cd_id list of hits to be retrieved.options
- the options for coloring and alignment. Ifnull
the structures will be displayed in their original form.dataFieldNames
- fields of the jchem table that should be fetched together with the structure ornull
.dataFieldValues
- an empty List required or it can benull
. The fetched values will be stored in this object as Object[] elements.molecules
- An empty list that will contain the molecules to be set on the hitdisplaytool object. For not found IDs (e.g. deleted) null is set.sources
- An empty list that will contain the byte array sources to be set on the hitdisplaytool object.- Returns:
- the hitDisplayTool object
- Throws:
SQLException
- if an sql error encounteredIOException
- if an io exception is encounteredSearchException
- if an error occurred during searchDatabaseSearchException
- if an error occurred during search- Since:
- version 5.4
-
setTargetCollection
@Beta public void setTargetCollection(chemaxon.jchem.base.storage.search.CurrentTargetCollection targetCollection) For internal use only.- Parameters:
targetCollection
- the targetcollection to use
-
toString
-