Class ExperimentExplorer
www/views/experiments/explorer
directory
and it's subdirectory.
This class is used two things:
- Storing the settings
- Creating the queries that retrieves the data according to the settings
Most of the settings are stored in regular ItemContext
: objects. This
means that they will be saved to the database when the user logs out and
loaded again the next time they are needed. Each experiment explorer uses
two ItemContext
objects. One for storing the settings for the
reporter search page and one for the view page. The reporter search settings
are stored in the context SessionControl.getCurrentContext(Item.REPORTER,
"explorer.id")
and the view page settings are stored in
SessionControl.getCurrentContext(Item.SPOTDATA, "explorer.id")
where
"id" is replaced by the bioassayset's id.
- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2021-06-03 13:47:50 +0200 (Thu, 03 Jun 2021) $
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An annotation group contains statistical information about the spot values falling into the group.static class
An annotation summary object keeps track of intensities and other statistical information based on the annotation group.private static class
Creates a list of (numerical) values that can be used as the right-hand operand to the IN operator.static class
Cache entry for a reporter with positions. -
Field Summary
Modifier and TypeFieldDescriptionThe currently selected annotation types on the view page.Maps a bioassays cube column number to it's id for fast loading by thegetBioAssay(DbControl, short)
method.private final BioAssaySet
The bioassay set we are exploring.private ExperimentExplorer.ReporterPositions[]
The cache of reporter ids matching the current reporter filter.static final String[]
Predefined colors for annotation groupsprivate static final ItemContext
The default context for the reporter search page.private static final Map<RawDataType,
ItemContext> Stores default context for the spot data list on the view page.private final Experiment
private int
Number of reporter that match the reporter search.private int[]
private int
The index of the curren position on the view page.private int
The index of the current reporter on the view page.private SnapshotManager
The snapshot manager that loads annotation values.static final int
Special value to use in thesetPositionIndex(int)
method to show all positions.static final int
Special value to use in thesetPositionIndex(int)
method to calculate the average for each bioassay.Caches annotation summaries. -
Constructor Summary
ModifierConstructorDescriptionprivate
ExperimentExplorer
(BioAssaySet bioAssaySet) Create a new experiment explorer. -
Method Summary
Modifier and TypeMethodDescriptiongetAndSetReporterContext
(SessionControl sc, PageContext pageContext) Get and update the current settings for the reporter context.getAndSetSpotContext
(SessionControl sc, PageContext pageContext) Get and update the current settings for the spot context.getAnnotationSummary
(DbControl dc, AnnotationType annotationType) Get an AnnotationSummary object which can be used to calculate means and other values for each annotation group.Get the selected annotation types.getAnnotationTypes
(DbControl dc, boolean includeBioAssayAnnotations) Get the annotation types that are of interest in this experiment.getBioAssay
(DbControl dc, short columnNo) Get the bioassay with the specified column number in the data cube.Get the bioassay set that is currently beeing explored.int
The number of reporter id'd to cache.Get the default reporter context that is used to initialise the actual context.Get the default spot context that is used to initialise the actual context.Get the experiment that is currently beeing explored.static ExperimentExplorer
getExplorer
(BioAssaySet bioAssaySet) Get the existing experiment explorer for a bioassayset or create a new one if none exist yet.int
Get the number of reporters matching the current reporter filter.int
Get the number of bioassays in the bioassayset.int
getNumPositions
(DbControl dc, int index) Get the number of unique positions the reporter of the specifed index is present in among all the bioassays in the bioassay set.int
Get the total number of unique reporters found in the bioassayset.int
Get the total number of spots in the bioassayset.int
getPosition
(DbControl dc, int reporterIndex, int positionIndex) Get the position number of the position specified by the given reporter and position index.int
Get the index of the current position.getReporter
(DbControl dc, int index) Get the reporter for the specified index.int
getReporterId
(int index) Get the reporter id for the specified index.int
Get the index of the current reporter.getReporterQuery
(DbControl dc, List<String> selectionList) Get a query returning the reporter data used by the reporter search page.Get the snapshot manager that is used to load annotation values.getSpotQuery
(DbControl dc, int reporterIndex, int positionIndex, List<TableColumn> selectionList) Get a query returning spot data for a given reporter and position.Get the subcontext name used for theItemContext
objects related to this explorer.private void
void
Update the selected annotation types.void
setPositionIndex
(int positionIndex) Set the index of the curren position.void
setReporterIndex
(int reporterIndex) Set the index of the currently viewed reporter.
-
Field Details
-
SPOT_ALL
public static final int SPOT_ALLSpecial value to use in thesetPositionIndex(int)
method to show all positions.- See Also:
-
SPOT_AVG
public static final int SPOT_AVGSpecial value to use in thesetPositionIndex(int)
method to calculate the average for each bioassay.- See Also:
-
COLORS
Predefined colors for annotation groups -
defaultReporterContext
The default context for the reporter search page. -
defaultSpotContexts
Stores default context for the spot data list on the view page. Different defaults for each raw data type since they can have different number of channels. -
bioAssaySet
The bioassay set we are exploring. -
experiment
-
snapshotManager
The snapshot manager that loads annotation values. -
bioAssays
Maps a bioassays cube column number to it's id for fast loading by thegetBioAssay(DbControl, short)
method. -
posCache
private int[] posCache -
cache
The cache of reporter ids matching the current reporter filter. -
reporterIndex
private int reporterIndexThe index of the current reporter on the view page.- See Also:
-
positionIndex
private int positionIndexThe index of the curren position on the view page.- See Also:
-
matchingReporters
private int matchingReportersNumber of reporter that match the reporter search. -
annotationTypeIds
The currently selected annotation types on the view page. -
summaryCache
Caches annotation summaries.
-
-
Constructor Details
-
ExperimentExplorer
Create a new experiment explorer.
-
-
Method Details
-
getExplorer
Get the existing experiment explorer for a bioassayset or create a new one if none exist yet. The returned object is cached in theSessionControl
:s session settings.- Parameters:
bioAssaySet
- The bioassay set to get an experiment explorer for- Returns:
- An
ExperimentExplorer
object
-
getBioAssaySet
Get the bioassay set that is currently beeing explored.- Parameters:
dc
- The DbControl used for access the database- Returns:
- The
BioAssaySet
object - See Also:
-
getExperiment
Get the experiment that is currently beeing explored.- Parameters:
dc
- The DbControl used for access the database- Returns:
- The
Experiment
object
-
getSnapshotManager
Get the snapshot manager that is used to load annotation values.- Since:
- 2.14
-
getNumBioAssays
public int getNumBioAssays()Get the number of bioassays in the bioassayset. -
getBioAssay
Get the bioassay with the specified column number in the data cube. This method is useful since spot queries (seegetSpotQuery(DbControl, int, int, List)
) can only return the column number, but we usually want to display the name, etc.- Parameters:
dc
- The DbControl object used to get the bioassaycolumnNo
- The colum number- Returns:
- The bioassay with the specified column number or null if no bioassay is found
-
getCacheSize
public int getCacheSize()The number of reporter id'd to cache. For performance reasons the id's of the reporters matching the reporter search are cached. This means we can step forwards and backwards more quickly on the view page since we don't have to execute the reporter search each time. This method should return the same value asgetMatchingReporters(DbControl)
unless the cache hasn't been initialized.- Returns:
- The size of the cache, or 0 if the cache has not been initialized
-
getNumReporters
public int getNumReporters()Get the total number of unique reporters found in the bioassayset.- See Also:
-
getNumSpots
public int getNumSpots()Get the total number of spots in the bioassayset.- See Also:
-
getSubContext
Get the subcontext name used for theItemContext
objects related to this explorer. The name is created like this:explorer.id
where id is replaced with the id of the bioassayset we are exploring.- Returns:
- The subcontext name
-
getDefaultSpotContext
Get the default spot context that is used to initialise the actual context.- Returns:
- An
ItemContext
object
-
getDefaultReporterContext
Get the default reporter context that is used to initialise the actual context.- Returns:
- An
ItemContext
object
-
getAndSetSpotContext
Get and update the current settings for the spot context. The spot context is used on the view page for the list with spot data.- Parameters:
sc
- The SessionControl of the logged in userpageContext
- ThePageContext
containing the updated settings, or null to not update the settings- Returns:
- An
ItemContext
object - See Also:
-
getAndSetReporterContext
Get and update the current settings for the reporter context. The reporter context is used on the reporter search page.- Parameters:
sc
- The SessionControl of the logged in userpageContext
- ThePageContext
containing the updated settings, or null to not update the settings- Returns:
- An
ItemContext
object - See Also:
-
getAnnotationTypeIds
Get the selected annotation types.- Returns:
- A set with the id's of the selected annotation types
- Since:
- 2.14
-
setAnnotationTypeIds
Update the selected annotation types.- Parameters:
ids
- A collection containing the id's of all annotation types that should currently be selected, all other annotation types are automatically deselected- Since:
- 2.14
-
getAnnotationTypes
Get the annotation types that are of interest in this experiment. Ie. the experimental factors of the experiment the bioassayset we are exploring belongs to. Optionally, you can also get annotations for bioassays.- Parameters:
dc
- The DbControl for database accessincludeBioAssayAnnotations
- If bioassay annotation should be included even if they are not experimental factors- Returns:
- A list of annotation types, null may be returned if no annotation types exists
- See Also:
-
getAnnotationSummary
public ExperimentExplorer.AnnotationSummary getAnnotationSummary(DbControl dc, AnnotationType annotationType) Get an AnnotationSummary object which can be used to calculate means and other values for each annotation group. When the annotation summary object is create each bioassay is placed in one annotation group based on which annotatations it have. Each annotation group is unique and is the only one with the same combination of annotation values. More than one bioassay may be placed in the same group if they are annotated with the same values.- Parameters:
dc
- The DbControl for database accessannotationType
- The annotation type, mustn't be null- Returns:
- An
AnnotationSummary
object - See Also:
-
getMatchingReporters
Get the number of reporters matching the current reporter filter.- Parameters:
dc
- The DbControl for database access- Returns:
- an
int
of matching reporters
-
getReporterIndex
public int getReporterIndex()Get the index of the current reporter. It should be a value between 0 andgetMatchingReporters(DbControl)
-1.- See Also:
-
setReporterIndex
public void setReporterIndex(int reporterIndex) Set the index of the currently viewed reporter. If the index is below zero or greater than or equal togetMatchingReporters(DbControl)
it is set to the nearest index.- Parameters:
reporterIndex
- The new index- See Also:
-
getReporter
Get the reporter for the specified index. The index should be between 0 and the number of matching reporters minus 1. The returned reporter information is taken from the cloned table if that is present in the current experiment.- Parameters:
dc
- The DbControl to use for database accessindex
- The index- Returns:
- The reporter or null if no reporter is found at the specified index
- See Also:
-
getReporterId
public int getReporterId(int index) Get the reporter id for the specified index. The index should be between 0 and the number of matching reporters minus 1. This method assumed that the reporter/position cache has already been initialized.- Parameters:
index
- The index- Returns:
- The internal id of the reporter, or 0 if the cache is not initialized or if the index is outside the allowed range
- Since:
- 3.0
- See Also:
-
getNumPositions
Get the number of unique positions the reporter of the specifed index is present in among all the bioassays in the bioassay set. The index should be between 0 and the number of matching reporters minus 1.- Parameters:
dc
- The DbControl to use for database accessindex
- The reporter index- Returns:
- The number of positions, or 0 if the index is outside the valid range
- Since:
- 2.11
- See Also:
-
getPositionIndex
public int getPositionIndex()Get the index of the current position. It should be a value between 0 andgetNumPositions(DbControl, int)
-1, or one of theSPOT_ALL
orSPOT_AVG
special values (negative).- Returns:
- The current index
- See Also:
-
setPositionIndex
public void setPositionIndex(int positionIndex) Set the index of the curren position.- Parameters:
positionIndex
- The new index- See Also:
-
getPosition
Get the position number of the position specified by the given reporter and position index. For a given reporter the positions are sorted in ascending order. The reporter index should be a value between 0 and the number of matching reporter minus 1. The position index should be a value between 0 and the number of positions for the given reporter minus 1.- Parameters:
reporterIndex
- The reporter indexpositionIndex
- The position index- Returns:
- The position number or -1 if no position can be found with the given indexes
- Since:
- 2.11
- See Also:
-
getReporterQuery
Get a query returning the reporter data used by the reporter search page. Note that the query isDynamicReporterQuery
and not aDataQuery
. This means that we don't getReporterData
objects as a result and that we must specify the properties to select (seeItemContext.configureQuery(DbControl, SqlQuery, List)
).The reporter id is always included as the first selected property so it doesn't have to be in the selection list.
NOTE! The query is restricted using information in the reporter/position cache to only return the exactly the reporter information that is displayed on the current page. Thus, some things do not work in the same way as most other queries used when listing items.
- The query doesn't return a total count. Use
getMatchingReporters(DbControl)
instead. - Paging options do not work (eg.
Query.setFirstResult(int)
andQuery.setMaxResults(int)
)
- Parameters:
dc
- The DbControl for database accessselectionList
- The properties that the query should select- Returns:
- A query
- See Also:
- The query doesn't return a total count. Use
-
getSpotQuery
public DynamicSpotQuery getSpotQuery(DbControl dc, int reporterIndex, int positionIndex, List<TableColumn> selectionList) Get a query returning spot data for a given reporter and position. This query is used by the view page to list the spot data for each bioassay.The column number is always included as the first selected property. If the
SPOT_AVG
is specified forpositionIndex
a count of the number of positions is included as the second selected property. Otherwise, the position number is included as the second selected property.Then, all channel intensities are selected.
See
ItemContext.getDynamicExpression(DbControl, SqlQuery, String)
for more information about how to specify additional selection properties. -
initReporterCache
-