public class BioAssaySet extends ChildItem implements Nameable, Removable, Annotatable, FileStoreEnabled
Transformation
has been applied to it. The first
transformation is called a root transformation. A bioassayset created
by a root transformation is called a root bioassayset.
A bioassayset is created by the Transformation.newProduct(String, String, boolean)
method. Bioassaysets can only be created if the transformation hasn't been
committed to the database.
Transformation.newProduct(String, String, boolean)
Modifier and Type | Field and Description |
---|---|
private Map<Integer,Integer> |
bioAssaySpots
Stores the result of
getSpotCount(int) . |
private FilterBatcher |
filterBatcher
The one and only filter batcher for this bioassayset.
|
private Query |
findChildren
Query to retrieve children for a bioassayset.
|
private Map<ExtraValueType,PositionExtraValueBatcher<?>> |
positionExtraValueBatchers
Cache of already created position extra value batchers.
|
private SpotBatcher |
spotBatcher
The one and only spot batcher for this bioassayset.
|
private Map<ExtraValueType,SpotExtraValueBatcher<?>> |
spotExtraValueBatchers
Cache of already created spot extra value batchers.
|
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
BioAssaySet(BioAssaySetData data)
Creates a new experiment item from the given data.
|
Modifier and Type | Method and Description |
---|---|
private void |
addChildBioAssaySets(BioAssaySetData parent,
Set<BioAssaySetData> all)
Find all bioassaysets that are children to the specified parent (ie.
|
private void |
checkAndCreateTables() |
private void |
countBioAssaySpots() |
private void |
countSpotsAndReporters()
Count the number of unique reporters and spots in all bioassays in this bioassayset.
|
private void |
deleteAnalysedData()
Called when a bioassayset is about to be deleted.
|
Set<Annotatable> |
getAnnotatableParents()
Get the parent bioassay set (if any) and the experiment.
|
AnnotationSet |
getAnnotationSet()
Get the annotation set containing the annotations for this item.
|
ItemQuery<BioAssay> |
getBioAssays()
Get a query returning the bioassays that are part of this
bioassayset.
|
static BioAssaySet |
getById(DbControl dc,
int id)
Get a
BioAssaySet item when you know the id. |
(package private) BioAssaySetData |
getData()
Get the
BasicData object that holds all data for this item. |
(package private) DataCube |
getDataCube()
Get the data cube this biossayset stores it's data in.
|
(package private) DataCubeFilter |
getDataCubeFilter()
Get the data cube filter this biossayset uses to filter spot data.
|
short |
getDataCubeFilterNo()
Get the number of the filter that this bioassayset is using, or 0 if
no filter is used.
|
(package private) DataCubeLayer |
getDataCubeLayer()
Get the data cube layer this biossayset stores it's data in.
|
short |
getDataCubeLayerNo()
Get the layer coordinate in the data cube that this bioassayset stores it's data in.
|
short |
getDataCubeNo()
Get the number of the data cube this bioassayset stores it's data in.
|
String |
getDescription()
Get the description for the item.
|
Experiment |
getExperiment()
Get the experiment this bioassayset belongs to.
|
ExtraValue |
getExtraValue(ExtraValueType extraValueType)
Get the extra value of the specified type in this bioassayset.
|
ItemQuery<ExtraValue> |
getExtraValues()
Get a query returning the extra values that are part of this
bioassayset.
|
ItemQuery<ExtraValueType> |
getExtraValueTypes()
Get a query returning all extra values types that are used in
this bioassay set.
|
FileSet |
getFileSet()
Get the file set that collects all files that holds data
for this item.
|
FilterBatcher |
getFilterBatcher()
Get a batcher used to insert the position/column coordinates that remain
after some filter has been applied to the spot data of a bioassayset.
|
IntensityTransform |
getIntensityTransform()
Get information about in what way the spot intensities has been
transformed before they were stored in the database.
|
MappingBatcher |
getMappingBatcher()
Get a batcher used to insert mappings to raw data.
|
int |
getMaxRawMappingsForSpot()
Get the number of mappings to raw data spots for the spot with
the most number of mappings.
|
String |
getName()
Get the name of the item.
|
(package private) static BioAssaySet |
getNew(DbControl dc,
Transformation transformation,
DataCubeLayer layer)
Create a new
BioAssaySet item. |
int |
getNumFileReporters()
Get the number of unique reporters for data that is stored in files.
|
int |
getNumFileSpots()
Get the number of spots that are stored in files.
|
int |
getNumReporters()
Get the number of unique reporters among all bioassays in this bioassayset.
|
int |
getNumSpots()
Get the number of spots in all bioassays in this bioassayset.
|
Collection<FileSet> |
getParentFileSets()
Get the file set from the parent bioassay set if it exists.
|
(package private) Permission |
getPermissionForWriteDeleteAndCreate()
USE permission is enough to be able to manage bioassay sets.
|
Platform |
getPlatform()
Get the platform the item is related to.
|
PositionBatcher |
getPositionBatcher()
Get a batcher that links position coordinates to reporters
for the data cube this bioassayset uses.
|
DynamicPositionQuery |
getPositionData()
Get a query that returns position data for the data cube where this bioassayset
is located.
|
<I> PositionExtraValueBatcher<I> |
getPositionExtraValueBatcher(Class<I> clazz,
ExtraValueType extraValueType,
Job job)
Get a batcher that is used to insert extra values per position of the specified
type.
|
Protocol |
getProtocol()
Default implementation returns null.
|
static ItemQuery<BioAssaySet> |
getQuery(Experiment experiment)
Get a query configured to retrieve bioassaysets for
a given experiment.
|
static ItemQuery<BioAssaySet> |
getQuery(Transformation transformation)
Get a query configured to retrieve bioassaysets
created by a given transformation.
|
RawDataType |
getRawDataType()
Get the raw data type this experiment uses for the raw data.
|
User |
getRemovedBy()
Get the user that flagged this item for removal.
|
(package private) SharedData |
getSharedParent()
Get the experiment.
|
SpotBatcher |
getSpotBatcher()
Get a batcher used to insert spot data for this bioassayset.
|
(package private) int |
getSpotCount(int column)
Get the number of spots in a single bioassay.
|
DynamicSpotQuery |
getSpotData()
Get a query that returns spot data for this bioassayset.
|
<I> SpotExtraValueBatcher<I> |
getSpotExtraValueBatcher(Class<I> clazz,
ExtraValueType extraValueType,
Job job)
Get a batcher that is used to insert extra values per spot of the specified type.
|
Transformation |
getTransformation()
Get the transformation that created this bioassayset.
|
ItemQuery<Transformation> |
getTransformations()
Get a query that return all transformations using this bioassayset
as a source.
|
Item |
getType()
Get the type of item represented by the object.
|
PlatformVariant |
getVariant()
Get the platform variant the item is related to.
|
(package private) VirtualDb |
getVirtualDb()
Get the virtual database this bioassayset stores it's data in.
|
boolean |
hasFileSet()
Check if this item has a file set.
|
boolean |
isAnnotated()
Check if this item has an annotation set.
|
boolean |
isRemoved()
Check if the removed flag is set for this item.
|
BioAssay |
newBioAssay(BioAssay parent)
Create a new
BioAssay in this bioassayset using a
single parent. |
BioAssay |
newBioAssay(Collection<BioAssay> parents)
Create a new
BioAssay with links to multiple parent
bioassays. |
private BioAssay |
newBioAssay(DataCubeColumn column,
Collection<BioAssay> parents)
Create a new bioassay and link to the parents.
|
BioAssay |
newRootBioAssay(Collection<RawBioAssay> rawParents)
Create a new
BioAssay with links to raw
bioassays. |
Transformation |
newTransformation(Job job)
Create a new transformation using this bioassayset as it's
source bioassayset.
|
(package private) void |
onBeforeCommit(Transactional.Action action)
On creation, count the number of spots and reporters in the bioassays
attached to this bioassayset.
|
void |
removeAnnotations()
Remove all annotations from this item, by deleting the annotation set.
|
private void |
setDataCubeFilter(DataCubeFilter filter) |
private void |
setDataCubeLayer(DataCubeLayer layer) |
void |
setDescription(String description)
Set the description for the item.
|
private void |
setExperiment(Experiment experiment)
Set the experiment.
|
void |
setIntensityTransform(IntensityTransform transform)
Sets the transform used on the spot intensities before they were stored
in the database.
|
void |
setName(String name)
Set the name of the item.
|
void |
setNumFileReporters(int numReporters)
Set the number of unique reporters for data that is stored in files.
|
void |
setNumFileSpots(int numSpots)
Set the number of spots that are stored in files.
|
void |
setRemoved(boolean removed)
Set the removed flag for this item.
|
private void |
setTransformation(Transformation transformation)
Set the transformation that created this bioassayset.
|
getPermissionForUse, getPluginPermissions, initPermissions
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getVersion
checkPermission, getPermissions, hasPermission
public static final Item TYPE
Item.BIOASSAYSET
,
getType()
private SpotBatcher spotBatcher
getSpotBatcher()
private FilterBatcher filterBatcher
getFilterBatcher()
private Map<ExtraValueType,SpotExtraValueBatcher<?>> spotExtraValueBatchers
private Map<ExtraValueType,PositionExtraValueBatcher<?>> positionExtraValueBatchers
private Map<Integer,Integer> bioAssaySpots
getSpotCount(int)
.private Query findChildren
BioAssaySet(BioAssaySetData data)
data
- the datastatic BioAssaySet getNew(DbControl dc, Transformation transformation, DataCubeLayer layer) throws PermissionDeniedException, InvalidDataException, BaseException
BioAssaySet
item.dc
- The DbControl
which will be used for
permission checking and database access.transformation
- The transformation that created the bioassaysetlayer
- The data cube layer where the bioassayset should store
it's dataBioAssaySet
itemPermissionDeniedException
- If the logged in user
doesn't have write permission for the experiment the
transformation belongs toInvalidDataException
- If the transformation is nullBaseException
- If there is an errorTransformation.newProduct(String, String, boolean)
public static BioAssaySet getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
BioAssaySet
item when you know the id.dc
- The DbControl
which will be used for
permission checking and database access.id
- The id of the item to loadBioAssaySet
itemItemNotFoundException
- If an item with the specified id
is not foundPermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permission to the itemBaseException
- If there is another errorpublic static ItemQuery<BioAssaySet> getQuery(Experiment experiment) throws InvalidDataException
experiment
- The experiment to retreive bioassaysets for, null
is not allowedItemQuery
objectInvalidDataException
- If the parameter is null.public static ItemQuery<BioAssaySet> getQuery(Transformation transformation) throws InvalidDataException
transformation
- The transformation to retreive bioassaysets for, null
is not allowedItemQuery
objectInvalidDataException
- If the transformation parameter is null.BioAssaySetData getData()
BasicItem
BasicData
object that holds all data for this item.public Item getType()
Identifiable
Item
enumeration.getType
in interface Identifiable
public String getName()
Nameable
public void setName(String name) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_NAME_LENGTH
constant.setName
in interface Nameable
name
- The new name for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH
constantpublic String getDescription()
Nameable
getDescription
in interface Nameable
String
with a description of the itempublic void setDescription(String description) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_DESCRIPTION_LENGTH
constant.setDescription
in interface Nameable
description
- The new description for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH
constantpublic boolean isRemoved()
Removable
public void setRemoved(boolean removed) throws PermissionDeniedException
Removable
setRemoved
in interface Removable
removed
- TRUE if the item should be flagged as removed,
FALSE otherwisePermissionDeniedException
- If the logged in user doesn't
have Permission.DELETE
permission for setting the flag
to TRUE or Permission.WRITE
permission for setting the
flag to FALSEpublic User getRemovedBy() throws PermissionDeniedException, ItemNotFoundException
Removable
getRemovedBy
in interface Removable
PermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permission for the userItemNotFoundException
- If the user that removed this item
can't be foundpublic AnnotationSet getAnnotationSet() throws PermissionDeniedException, BaseException
Annotatable
DbControl.commit()
is
called. To check if an item has annotations without creating a new
annotation set use the Annotatable.isAnnotated()
method.getAnnotationSet
in interface Annotatable
AnnotationSet
PermissionDeniedException
- If the logged in user doesn't have
enough permissionsBaseException
- If there is another errorpublic boolean isAnnotated()
Annotatable
isAnnotated
in interface Annotatable
public void removeAnnotations() throws PermissionDeniedException, BaseException
Annotatable
removeAnnotations
in interface Annotatable
PermissionDeniedException
- If the logged in user doesn't have
write permissionBaseException
- If there is another errorpublic Protocol getProtocol()
getProtocol
in interface Annotatable
public Set<Annotatable> getAnnotatableParents() throws BaseException
getAnnotatableParents
in interface Annotatable
BaseException
- If there is an errorpublic FileSet getFileSet()
FileStoreEnabled
DbControl.commit()
is called. To check if an item has files without creating a new
file set use the FileStoreEnabled.hasFileSet()
method.getFileSet
in interface FileStoreEnabled
public boolean hasFileSet()
FileStoreEnabled
FileStoreEnabled.getFileSet()
to avoid creating a new file set when there is
no need for it.hasFileSet
in interface FileStoreEnabled
public Platform getPlatform()
FileStoreEnabled
DataFileType
:s that can be added to the file set.getPlatform
in interface FileStoreEnabled
public PlatformVariant getVariant()
FileStoreEnabled
DataFileType
:s that can be added to the file set.getVariant
in interface FileStoreEnabled
public Collection<FileSet> getParentFileSets()
getParentFileSets
in interface FileStoreEnabled
FileSet
or nullvoid onBeforeCommit(Transactional.Action action) throws BaseException
onBeforeCommit
in class BasicItem
BaseException
- If there is an errorTransactional
,
Developer documentation: Transactions,
Developer documentation: Coding rules and guidelines for item classesSharedData getSharedParent()
getSharedParent
in class ChildItem
Permission getPermissionForWriteDeleteAndCreate()
getPermissionForWriteDeleteAndCreate
in class ChildItem
public Experiment getExperiment() throws PermissionDeniedException, BaseException
Experiment
objectPermissionDeniedException
- If the logged in user doesn't have
read permission to the experimentBaseException
- If there is another errorprivate void setExperiment(Experiment experiment) throws PermissionDeniedException, InvalidDataException
public Transformation getTransformation() throws PermissionDeniedException, BaseException
Transformation
objectPermissionDeniedException
- If the logged in user doesn't have
read permission to the experimentBaseException
- If there is another errorprivate void setTransformation(Transformation transformation) throws PermissionDeniedException, InvalidDataException
public RawDataType getRawDataType()
RawDataType
objectpublic int getNumReporters()
public int getNumSpots()
public int getNumFileReporters()
public void setNumFileReporters(int numReporters)
numReporters
- The number of reporterspublic int getNumFileSpots()
public void setNumFileSpots(int numSpots)
numSpots
- The number of spotspublic int getMaxRawMappingsForSpot()
public IntensityTransform getIntensityTransform()
public void setIntensityTransform(IntensityTransform transform)
transform
- The transform that was used to store the datapublic short getDataCubeNo()
getDataCubeLayerNo()
,
getDataCubeFilterNo()
public short getDataCubeLayerNo()
getDataCubeNo()
,
getDataCubeFilterNo()
public short getDataCubeFilterNo()
getDataCubeLayerNo()
,
getDataCubeNo()
VirtualDb getVirtualDb()
DataCube getDataCube() throws PermissionDeniedException, BaseException
DataCubeLayer getDataCubeLayer()
private void setDataCubeLayer(DataCubeLayer layer)
DataCubeFilter getDataCubeFilter()
private void setDataCubeFilter(DataCubeFilter filter)
public Transformation newTransformation(Job job) throws PermissionDeniedException, BaseException
job
- The job that executed the transformationPermissionDeniedException
- If the logged in user doesn't have
write permission for the experiment this bioassayset belongs toBaseException
- If there is another errorpublic ItemQuery<Transformation> getTransformations()
ItemQuery
objectTransformation.getQuery(BioAssaySet)
public BioAssay newRootBioAssay(Collection<RawBioAssay> rawParents) throws PermissionDeniedException, InvalidDataException, BaseException
BioAssay
with links to raw
bioassays. This type of bioassay can only be created if the
transformation that created it is a root transformation. New
bioassays can only be created if the bioassayset hasn't been
committed to the database.
The raw bioassay collection should contain only those raw bioassays whose spots have been used to calculate the intensities stored in this bioassay.
rawParents
- A collection containing the raw bioassays that
are the parents of this bioassayBioAssay
itemPermissionDeniedException
- If the logged in user doesn't have
write permission for the experiment of if the bioassayset has
been committed to the databaseInvalidDataException
- If this bioassayset is not a product
of a root transformation or if any of the raw bioassay parents
isn't a member of the transformationBaseException
- If something else goes wrong.newBioAssay(BioAssay)
,
newBioAssay(Collection)
public BioAssay newBioAssay(BioAssay parent) throws InvalidDataException, PermissionDeniedException
BioAssay
in this bioassayset using a
single parent. The data cube column coordinate of the new bioassay is set to
the same as that of the parent. The bioassayset of the parent bioassay
must match the bioassayset set of the source of the transformation and this
bioassayset must use the same data cube as the source bioassayset.
The new bioassay is automatically linked to the same raw bioassays
as the parent bioassay.
New bioassays can only be created if the bioassayset hasn't been committed to the database.
parent
- The parent bioassayInvalidDataException
- If the parent is null or it's bioassayset is not
the same as the source bioassayset of the transformation or if the data cube
of the source is not the same as the data cube for this bioassaysetPermissionDeniedException
- If the bioassayset has already been committed
to the databasenewBioAssay(Collection)
,
newRootBioAssay(Collection)
public BioAssay newBioAssay(Collection<BioAssay> parents)
BioAssay
with links to multiple parent
bioassays. This type of bioassay can only be created if the
transformation that created it isn't a root transformation, since a root
transformation can't have a parent bioassayset. This type of
bioassay must be created if this bioassayset uses a different
data cube than the bioassayset that is the source of the transformation.
The new bioassay is automatically linked to the same raw bioassays
as the parent bioassay.
New bioassays can only be created if the bioassayset hasn't been committed to the database.
parents
- A collection containing the bioassays that
are the parents of this bioassayBioAssay
itemPermissionDeniedException
- If the logged in user doesn't have
write permission for the experiment of if the bioassayset has
been committed to the databaseInvalidDataException
- If this bioassayset is the product
of a root transformation or if any of the bioassay parents
isn't a member source bioassayset of the transformationnewBioAssay(BioAssay)
,
newRootBioAssay(Collection)
private BioAssay newBioAssay(DataCubeColumn column, Collection<BioAssay> parents)
public ItemQuery<BioAssay> getBioAssays()
ItemQuery
objectpublic ItemQuery<ExtraValue> getExtraValues()
ItemQuery
objectgetSpotExtraValueBatcher(Class, ExtraValueType, Job)
,
getPositionExtraValueBatcher(Class, ExtraValueType, Job)
public ItemQuery<ExtraValueType> getExtraValueTypes()
ItemQuery
objectgetExtraValues()
,
getExtraValue(ExtraValueType)
public ExtraValue getExtraValue(ExtraValueType extraValueType) throws BaseException
extraValueType
- For which extra value should be returned.ExtraValue
item, or null if no extra value
of the specified type has been created for this bioassaysetBaseException
- If something fails when getting the extra value.getSpotExtraValueBatcher(Class, ExtraValueType, Job)
,
getPositionExtraValueBatcher(Class, ExtraValueType, Job)
public PositionBatcher getPositionBatcher() throws PermissionDeniedException
getPositionExtraValueBatcher(Class, ExtraValueType, Job)
method to get a batcher for
that.PositionBatcher
objectPermissionDeniedException
- If the logged in user doesn't
have write permission or if the data cube has already been committed
to the databasegetPositionExtraValueBatcher(Class, ExtraValueType, Job)
public MappingBatcher getMappingBatcher() throws PermissionDeniedException
MappingBatcher
objectPermissionDeniedException
- If the logged in user doesn't
have write permission or if the data cube has already been committed
to the databasepublic SpotBatcher getSpotBatcher() throws PermissionDeniedException
getSpotExtraValueBatcher(Class, ExtraValueType, Job)
method to get a batcher for that.SpotBatcher
objectPermissionDeniedException
- If the logged in user doesn't
have write permission or if the data cube layer has already been committed
to the databasegetSpotExtraValueBatcher(Class, ExtraValueType, Job)
public FilterBatcher getFilterBatcher() throws PermissionDeniedException
FilterBatcher
objectPermissionDeniedException
- If the bioassayset has already been committed
to the database or if the logged in user doesn't have write permissiongetSpotBatcher()
public <I> SpotExtraValueBatcher<I> getSpotExtraValueBatcher(Class<I> clazz, ExtraValueType extraValueType, Job job) throws PermissionDeniedException, InvalidDataException
clazz
- The class object for the values, ie. Integer.class
,
Float.class
or String.class
extraValueType
- The definition of the extra value typejob
- The job that is doing the extra value calculations or nullSpotExtraValueBatcher
objectPermissionDeniedException
- If the loggged in user doesn't have write
permission for the bioassay setInvalidDataException
- If the extra value type is null or has a
value type that doesn't match the specified classgetSpotBatcher()
public <I> PositionExtraValueBatcher<I> getPositionExtraValueBatcher(Class<I> clazz, ExtraValueType extraValueType, Job job) throws PermissionDeniedException, InvalidDataException
clazz
- The class object for the values, ie. Integer.class
,
Float.class
or String.class
extraValueType
- The definition of the extra value typejob
- The job that is doing the extra value calculations or nullPositionExtraValueBatcher
objectPermissionDeniedException
- If the loggged in user doesn't have write
permission for the bioassay setInvalidDataException
- If the extra value type is null or has a
value type that doesn't match the specified classpublic DynamicSpotQuery getSpotData()
// Default query -- filter is only joined if the bioassayset is filtered SELECT spt.column, spt.position, spt.ch1, spt.ch2, ... FROM Dynamic#PerSpot spt [ JOIN Dynamic#Filter flt ON flt.cube = spt.cube AND flt.column = spt.column AND flt.position = spt.position ] WHERE spt.cube = <cube_no> AND spt.layer = <layer_no> [ AND flt.filter = <filter_no> ]
Note! If the bioassay set contains transformed intensities, the default selection will un-transform the values.
DynamicSpotQuery
objectpublic DynamicPositionQuery getPositionData()
getSpotData()
method and then join reporters using the DynamicSpotQuery.joinReporters(JoinType)
method.
// Default query SELECT pos.position FROM Dynamic#PerPosition AS pos WHERE pos.cube = <cube_no>
DynamicPositionQuery
objectprivate void countSpotsAndReporters()
onBeforeCommit
method to calculate
the numbers (which cannot be changed later) before the bioassayset is
committed to the database.int getSpotCount(int column)
BioAssay.onBeforeCommit
method to
calculate the numbers (which cannot be changed later) before the bioassay is
saved to the database. The reason it is located here is that a single query
can calculate the spots for all bioassays in a one go.private void countBioAssaySpots()
getSpotCount(int)
private void checkAndCreateTables()
private void deleteAnalysedData() throws BaseException
BaseException
private void addChildBioAssaySets(BioAssaySetData parent, Set<BioAssaySetData> all)
all
set. The method is then called recursively
to add the grandchildren and so on.