Package net.sf.basedb.core
Class Transformation
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.ChildItem
net.sf.basedb.core.Transformation
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
,Removable
A transformation represents an analysis step for an
Experiment
. There
are two types of transformations. A root transformation is used to calculate
the initial set of intensities from a set of RawBioAssay
:s. The result
of a transformation is usually one or more BioAssaySet
:s. The other
type of transformation takes a bioassayset as the source and recalculates the
intensities, applies a filter or does something else.
A transformation is created by either the Experiment.newTransformation(Job, Collection)
method or the BioAssaySet.newTransformation(Job)
method.
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2015-11-18 09:08:17 +0100 (on, 18 nov 2015) $
-
Field Summary
Modifier and TypeFieldDescriptionprivate Job
Internal cache of named cubes used by the newProduct method.private Map<String,
DataCubeLayer> Internal cache of named layers used by the newProduct method.static final Item
The type of item represented by this class.Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
ConstructorDescriptionCreates a new experiment item from the given data. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Delete all product bioassaysets.static Transformation
Get aTransformation
item when you know the id.(package private) TransformationData
getData()
Get theBasicData
object that holds all data for this item.Get the description for the item.Get the experiment this transformation belongs to.getJob()
Get the job that executed this transformation.getName()
Get the name of the item.(package private) static Transformation
getNew
(DbControl dc, Experiment experiment, Job job) Create a newTransformation
item.(package private) Permission
USE permission is enough to be able to manage transformations.Get a query that return all bioassaysets created by this transformation.static ItemQuery<Transformation>
getQuery
(BioAssaySet bioAssaySet) Get a query configured to retrieve transformations using the given bioassayset as source.static ItemQuery<Transformation>
getQuery
(Experiment experiment) Get a query configured to retrieve transformations for a given experiment.Get a query that returns the raw bioassay sources used by this transformation.Get the user that flagged this item for removal.(package private) SharedData
Get the experiment.Get the source bioassayset used by this transformation.getType()
Get the type of item represented by the object.boolean
Check if the removed flag is set for this item.newProduct
(String namedCube, String namedLayer, boolean createChildBioAssays) Create a new product bioassayset from this transformation.(package private) void
onBeforeCommit
(Transactional.Action action) Delete the product bioassaysets when deleting this transction.void
setDescription
(String description) Set the description for the item.private void
setExperiment
(Experiment experiment) Set the experiment.private void
Set the job that executed this transformation.void
Set the name of the item.(package private) void
setRawSources
(Collection<RawBioAssay> rawBioAssays) Set the raw bioassay sources used in this transformation.void
setRemoved
(boolean removed) Set the removed flag for this item.(package private) void
setSource
(BioAssaySet bioAssaySet) Set the source bioassayset.Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForUse, getPluginPermissions, initPermissions
Methods inherited from class net.sf.basedb.core.BasicItem
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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
job
-
namedCubes
Internal cache of named cubes used by the newProduct method. -
namedLayers
Internal cache of named layers used by the newProduct method.
-
-
Constructor Details
-
Transformation
Transformation(TransformationData data) Creates a new experiment item from the given data.- Parameters:
data
- the data
-
-
Method Details
-
getNew
Create a newTransformation
item. No source has been specified. A caller should use either:setSource(BioAssaySet)
orsetRawSources(Collection)
.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.experiment
- The experimentjob
- The job that executed the transformation- Returns:
- The new
Transformation
item - Throws:
BaseException
- If there is another error- See Also:
-
getById
public static Transformation getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aTransformation
item when you know the id.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.id
- The id of the item to load- Returns:
- The
Transformation
item - Throws:
ItemNotFoundException
- If an item with the specified id is not foundPermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission to the itemBaseException
- If there is another error
-
getQuery
Get a query configured to retrieve transformations for a given experiment.- Parameters:
experiment
- The experiment to retreive transformations for, null is not allowed- Returns:
- An
ItemQuery
object - Throws:
InvalidDataException
- If required parameter is null.
-
getQuery
public static ItemQuery<Transformation> getQuery(BioAssaySet bioAssaySet) throws InvalidDataException Get a query configured to retrieve transformations using the given bioassayset as source.- Parameters:
bioAssaySet
- The source bioassayset to retreive transformations for, null is not allowed- Returns:
- An
ItemQuery
object - Throws:
InvalidDataException
- If required parameter is null.
-
getData
TransformationData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item. -
getType
Description copied from interface:Identifiable
Get the type of item represented by the object. The returned value is one of the values defined in theItem
enumeration.- Specified by:
getType
in interfaceIdentifiable
- Returns:
- A value indicating the type of item
-
getName
Description copied from interface:Nameable
Get the name of the item. -
setName
Description copied from interface:Nameable
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by theNameable.MAX_NAME_LENGTH
constant.- Specified by:
setName
in interfaceNameable
- Parameters:
name
- The new name for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the name is null or longer than specified by theNameable.MAX_NAME_LENGTH
constant
-
getDescription
Description copied from interface:Nameable
Get the description for the item.- Specified by:
getDescription
in interfaceNameable
- Returns:
- A
String
with a description of the item
-
setDescription
public void setDescription(String description) throws PermissionDeniedException, InvalidDataException Description copied from interface:Nameable
Set the description for the item. The description can be null but mustn't be longer than the value specified by theNameable.MAX_DESCRIPTION_LENGTH
constant.- Specified by:
setDescription
in interfaceNameable
- Parameters:
description
- The new description for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the description longer than specified by theNameable.MAX_DESCRIPTION_LENGTH
constant
-
isRemoved
public boolean isRemoved()Description copied from interface:Removable
Check if the removed flag is set for this item. -
setRemoved
Description copied from interface:Removable
Set the removed flag for this item.- Specified by:
setRemoved
in interfaceRemovable
- Parameters:
removed
- TRUE if the item should be flagged as removed, FALSE otherwise- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.DELETE
permission for setting the flag to TRUE orPermission.WRITE
permission for setting the flag to FALSE
-
getRemovedBy
Description copied from interface:Removable
Get the user that flagged this item for removal.- Specified by:
getRemovedBy
in interfaceRemovable
- Returns:
- A User object, or null if this item has not been flagged
- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the userItemNotFoundException
- If the user that removed this item can't be found
-
onBeforeCommit
Delete the product bioassaysets when deleting this transction. Set the experiment for the job when creating this transction.- Overrides:
onBeforeCommit
in classBasicItem
- Throws:
BaseException
- If there is an error- See Also:
-
getPermissionForWriteDeleteAndCreate
Permission getPermissionForWriteDeleteAndCreate()USE permission is enough to be able to manage transformations.- Overrides:
getPermissionForWriteDeleteAndCreate
in classChildItem
-
getExperiment
Get the experiment this transformation belongs to.- Returns:
- An
Experiment
object - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the experimentBaseException
- If there is another error
-
setExperiment
Set the experiment. This cannot be changed after the transformation has been created. -
getSource
Get the source bioassayset used by this transformation.- Returns:
- A
BioAssaySet
item, or null if this is a root transformation - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the experimentBaseException
- If there is another error- See Also:
-
setSource
Set the source bioassayset. This cannot be changed after the transformation has been created.- See Also:
-
getRawSources
Get a query that returns the raw bioassay sources used by this transformation. It is only a root transformation that has raw bioassays as sources, other transformations has a sourceBioAssaySet
.- Returns:
- An
ItemQuery
object - See Also:
-
setRawSources
Set the raw bioassay sources used in this transformation. Can only be specified for a root transformation. All raw bioassays must be members of the experiment.- Throws:
InvalidDataException
- If any of the raw bioassays are not part of the experiment- See Also:
-
getJob
Get the job that executed this transformation.- Returns:
- A
Job
object, ot null if this transformation wasn't executed by a job - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the experimentBaseException
- If there is another error
-
setJob
Set the job that executed this transformation. Once set it can't be changed. -
newProduct
public BioAssaySet newProduct(String namedCube, String namedLayer, boolean createChildBioAssays) throws PermissionDeniedException, InvalidDataException, BaseException Create a new product bioassayset from this transformation. The transformation mustn't have been committed to the database. The bioassayset can use either the same data cube/layer as the source bioassayset is using, a new data cube/layer or a data cube/layer that has previously been created by this method. The names specified here are only valid for the current session and are only needed if the transformation must create more than one bioassayset in a different data cube than it's source bioassayset.Transformation t = ... // Use same data cube, but a new layer. Automatically create child bioassays BioAssaySet bas = t.newProduct(null, "new", true); // Use same data cube and layer. Automatically create child bioassays BioAssaySet filtered = t.newProduct(null, null, true); // Use new data cube and layer. Automatic creation of // child bioassays is not supported BioAsssySet merged = t.newProduct("new", "new", false); // Create four new bioassaysets using two datacubes, one // with two layers and one with one layer BioAssaySet bas1 = t.newProduct("cube1", "layer1", false); BioAssaySet bas2 = t.newProduct("cube1", "layer2", false); BioAssaySet bas3 = t.newProduct("cube2", "layer3", false); BioAssaySet bas4 = t.newProduct("cube2", "layer3", false);
Note that the name of the layer is checked first, so we can't have the layers with the same name in two different cubes. For example the following call won't work:// Don't! We bas3 is now using the same cube and layer as bas1 BioAssaySet bas3 = t.newProduct("cube2", "layer1", false);
- Parameters:
namedCube
- The name of the data cube where the new bioassayset should store/find it's data. If no data cube with the specified name exists a new data cube is created. Specify 'null' to use the same data cube as the source bioassayset.namedLayer
- The name of the data cube layer where the new bioassayset should store/find it's data. If no layer with the specified name exists a new layer is created. Specify 'null' to use the same layer as the source bioassayset.createChildBioAssays
- TRUE to create one child bioassay for each bioassay in the source bioassay set. This requires that the product is created in the same data cube as the source bioassay set, ie. namedCube should be null- Returns:
- The new bioassayset
- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission for the experiment this transformation belongs to or if this transformation has already been committed to the databaseInvalidDataException
- If the layer is null or not part of the same experiment as this transformationBaseException
- If there is another error
-
getProducts
Get a query that return all bioassaysets created by this transformation.- Returns:
- An
ItemQuery
object - See Also:
-
deleteProducts
private void deleteProducts()Delete all product bioassaysets. Called by onBeforeCommit when the transformation is deleted.
-