public class ExperimentExplorer
extends java.lang.Object
www/views/experiments/explorer
directory
and it's subdirectory.
This class is used two things:
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.
Modifier and Type | Class and Description |
---|---|
static class |
ExperimentExplorer.AnnotationGroup
An annotation group contains statistical information about the spot
values falling into the group.
|
static class |
ExperimentExplorer.AnnotationSummary
An annotation summary object keeps track of intensities and other
statistical information based on the annotation group.
|
private static class |
ExperimentExplorer.InExpression
Creates a list of (numerical) values that can be used as the
right-hand operand to the IN operator.
|
static class |
ExperimentExplorer.ReporterPositions
Cache entry for a reporter with positions.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.Integer> |
annotationTypeIds
The currently selected annotation types on the view page.
|
private java.util.Map<java.lang.Short,java.lang.Integer> |
bioAssays
Maps a bioassays cube column number to it's id for fast
loading by the
getBioAssay(DbControl, short) method. |
private BioAssaySet |
bioAssaySet
The bioassay set we are exploring.
|
private ExperimentExplorer.ReporterPositions[] |
cache
The cache of reporter ids matching the
current reporter filter.
|
static java.lang.String[] |
COLORS
Predefined colors for annotation groups
|
private static ItemContext |
defaultReporterContext
The default context for the reporter search page.
|
private static java.util.Map<RawDataType,ItemContext> |
defaultSpotContexts
Stores default context for the spot data list on the view page.
|
private Experiment |
experiment |
private int |
matchingReporters
Number of reporter that match the reporter search.
|
private int[] |
posCache |
private int |
positionIndex
The index of the curren position on the view page.
|
private int |
reporterIndex
The index of the current reporter on the view page.
|
private SnapshotManager |
snapshotManager
The snapshot manager that loads annotation values.
|
static int |
SPOT_ALL
Special value to use in the
setPositionIndex(int) method
to show all positions. |
static int |
SPOT_AVG
Special value to use in the
setPositionIndex(int) method
to calculate the average for each bioassay. |
private java.util.Map<java.lang.Integer,ExperimentExplorer.AnnotationSummary> |
summaryCache
Caches annotation summaries.
|
Modifier | Constructor and Description |
---|---|
private |
ExperimentExplorer(BioAssaySet bioAssaySet)
Create a new experiment explorer.
|
Modifier and Type | Method and Description |
---|---|
ItemContext |
getAndSetReporterContext(SessionControl sc,
PageContext pageContext)
Get and update the current settings for the reporter context.
|
ItemContext |
getAndSetSpotContext(SessionControl sc,
PageContext pageContext)
Get and update the current settings for the spot context.
|
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.
|
java.util.Set<java.lang.Integer> |
getAnnotationTypeIds()
Get the selected annotation types.
|
java.util.List<AnnotationType> |
getAnnotationTypes(DbControl dc,
boolean includeBioAssayAnnotations)
Get the annotation types that are of interest in this experiment.
|
BioAssay |
getBioAssay(DbControl dc,
short columnNo)
Get the bioassay with the specified column number in the
data cube.
|
BioAssaySet |
getBioAssaySet(DbControl dc)
Get the bioassay set that is currently beeing explored.
|
int |
getCacheSize()
The number of reporter id'd to cache.
|
ItemContext |
getDefaultReporterContext()
Get the default reporter context that is used to initialise the actual context.
|
ItemContext |
getDefaultSpotContext()
Get the default spot context that is used to initialise the actual context.
|
Experiment |
getExperiment(DbControl dc)
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 |
getMatchingReporters(DbControl dc)
Get the number of reporters matching the current reporter
filter.
|
int |
getNumBioAssays()
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 |
getNumReporters()
Get the total number of unique reporters found in the bioassayset.
|
int |
getNumSpots()
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 |
getPositionIndex()
Get the index of the current position.
|
ReporterData |
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 |
getReporterIndex()
Get the index of the current reporter.
|
DynamicReporterQuery |
getReporterQuery(DbControl dc,
java.util.List<java.lang.String> selectionList)
Get a query returning the reporter data used by the reporter search page.
|
SnapshotManager |
getSnapshotManager()
Get the snapshot manager that is used to load annotation
values.
|
DynamicSpotQuery |
getSpotQuery(DbControl dc,
int reporterIndex,
int positionIndex,
java.util.List<TableColumn> selectionList)
Get a query returning spot data for a given reporter and position.
|
java.lang.String |
getSubContext()
Get the subcontext name used for the
ItemContext objects
related to this explorer. |
private void |
initReporterCache(DbControl dc) |
void |
setAnnotationTypeIds(java.util.Collection<java.lang.Integer> ids)
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.
|
public static final int SPOT_ALL
setPositionIndex(int)
method
to show all positions.public static final int SPOT_AVG
setPositionIndex(int)
method
to calculate the average for each bioassay.public static final java.lang.String[] COLORS
private static final ItemContext defaultReporterContext
private static final java.util.Map<RawDataType,ItemContext> defaultSpotContexts
private final BioAssaySet bioAssaySet
private final Experiment experiment
private SnapshotManager snapshotManager
private final java.util.Map<java.lang.Short,java.lang.Integer> bioAssays
getBioAssay(DbControl, short)
method.private int[] posCache
private ExperimentExplorer.ReporterPositions[] cache
private int reporterIndex
getReporterIndex()
private int positionIndex
getPositionIndex()
private int matchingReporters
private java.util.Set<java.lang.Integer> annotationTypeIds
private java.util.Map<java.lang.Integer,ExperimentExplorer.AnnotationSummary> summaryCache
private ExperimentExplorer(BioAssaySet bioAssaySet)
public static ExperimentExplorer getExplorer(BioAssaySet bioAssaySet)
SessionControl
:s session settings.bioAssaySet
- The bioassay set to get an experiment explorer forExperimentExplorer
objectpublic BioAssaySet getBioAssaySet(DbControl dc)
dc
- The DbControl used for access the databaseBioAssaySet
objectBioAssaySet.getById(DbControl, int)
public Experiment getExperiment(DbControl dc)
dc
- The DbControl used for access the databaseExperiment
objectpublic SnapshotManager getSnapshotManager()
public int getNumBioAssays()
public BioAssay getBioAssay(DbControl dc, short columnNo)
getSpotQuery(DbControl, int, int, List)
)
can only return the column number, but we usually want to display
the name, etc.dc
- The DbControl object used to get the bioassaycolumnNo
- The colum numberpublic int getCacheSize()
getMatchingReporters(DbControl)
unless the cache hasn't been initialized.public int getNumReporters()
BioAssaySet.getNumReporters()
public int getNumSpots()
BioAssaySet.getNumSpots()
public java.lang.String getSubContext()
ItemContext
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.public ItemContext getDefaultSpotContext()
ItemContext
objectpublic ItemContext getDefaultReporterContext()
ItemContext
objectpublic ItemContext getAndSetSpotContext(SessionControl sc, PageContext pageContext)
sc
- The SessionControl of the logged in userpageContext
- The PageContext
containing the
updated settings, or null to not update the settingsItemContext
objectBase.getAndSetCurrentContext(SessionControl, Item, PageContext, ItemContext)
public ItemContext getAndSetReporterContext(SessionControl sc, PageContext pageContext)
sc
- The SessionControl of the logged in userpageContext
- The PageContext
containing the
updated settings, or null to not update the settingsItemContext
objectBase.getAndSetCurrentContext(SessionControl, Item, PageContext, ItemContext)
public java.util.Set<java.lang.Integer> getAnnotationTypeIds()
public void setAnnotationTypeIds(java.util.Collection<java.lang.Integer> ids)
ids
- A collection containing the id's of all annotation types
that should currently be selected, all other annotation types are
automatically deselectedpublic java.util.List<AnnotationType> getAnnotationTypes(DbControl dc, boolean includeBioAssayAnnotations)
dc
- The DbControl for database accessincludeBioAssayAnnotations
- If bioassay annotation should be included
even if they are not experimental factorsExperiment.getExperimentalFactors()
public ExperimentExplorer.AnnotationSummary getAnnotationSummary(DbControl dc, AnnotationType annotationType)
dc
- The DbControl for database accessannotationType
- The annotation type, mustn't be nullAnnotationSummary
objectExperimentExplorer.AnnotationGroup.getAnnotationValues()
public int getMatchingReporters(DbControl dc)
dc
- The DbControl for database accessint
of matching reporterspublic int getReporterIndex()
getMatchingReporters(DbControl)
-1.getReporter(DbControl, int)
public void setReporterIndex(int reporterIndex)
getMatchingReporters(DbControl)
it is set
to the nearest index.reporterIndex
- The new indexgetReporter(DbControl, int)
public ReporterData getReporter(DbControl dc, int index)
dc
- The DbControl to use for database accessindex
- The indexgetMatchingReporters(DbControl)
public int getReporterId(int index)
index
- The indexgetMatchingReporters(DbControl)
public int getNumPositions(DbControl dc, int index)
dc
- The DbControl to use for database accessindex
- The reporter indexgetReporter(DbControl, int)
,
getMatchingReporters(DbControl)
public int getPositionIndex()
getNumPositions(DbControl, int)
-1, or one
of the SPOT_ALL
or SPOT_AVG
special values (negative).getPosition(DbControl, int, int)
public void setPositionIndex(int positionIndex)
positionIndex
- The new indexgetPositionIndex()
,
getPosition(DbControl, int, int)
public int getPosition(DbControl dc, int reporterIndex, int positionIndex)
dc
- reporterIndex
- The reporter indexpositionIndex
- The position indexgetMatchingReporters(DbControl)
,
getNumPositions(DbControl, int)
public DynamicReporterQuery getReporterQuery(DbControl dc, java.util.List<java.lang.String> selectionList)
DynamicReporterQuery
and not a
DataQuery
. This means that we don't get
ReporterData
objects as a result and that we must specify the
properties to select (see ItemContext.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.
getMatchingReporters(DbControl)
instead.
Query.setFirstResult(int)
and Query.setMaxResults(int)
)
dc
- The DbControl for database accessselectionList
- The properties that the query should selectItemContext.configureQuery(DbControl, SqlQuery, List)
public DynamicSpotQuery getSpotQuery(DbControl dc, int reporterIndex, int positionIndex, java.util.List<TableColumn> selectionList)
The column number is always included as the first selected property. If the
SPOT_AVG
is specified for positionIndex
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, String)
for more information
about how to specify additional selection properties.
private void initReporterCache(DbControl dc)