public class Transformation extends ChildItem implements Nameable, Removable
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.
Experiment.newTransformation(Job, Collection)
,
BioAssaySet.newTransformation(Job)
Modifier and Type | Field and Description |
---|---|
private Job |
job |
private Map<String,DataCube> |
namedCubes
Internal cache of named cubes used by the newProduct method.
|
private Map<String,DataCubeLayer> |
namedLayers
Internal cache of named layers used by the newProduct method.
|
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
Transformation(TransformationData data)
Creates a new experiment item from the given data.
|
Modifier and Type | Method and Description |
---|---|
private void |
deleteProducts()
Delete all product bioassaysets.
|
static Transformation |
getById(DbControl dc,
int id)
Get a
Transformation item when you know the id. |
(package private) TransformationData |
getData()
Get the
BasicData object that holds all data for this item. |
String |
getDescription()
Get the description for the item.
|
Experiment |
getExperiment()
Get the experiment this transformation belongs to.
|
Job |
getJob()
Get the job that executed this transformation.
|
String |
getName()
Get the name of the item.
|
(package private) static Transformation |
getNew(DbControl dc,
Experiment experiment,
Job job)
Create a new
Transformation item. |
(package private) Permission |
getPermissionForWriteDeleteAndCreate()
USE permission is enough to be able to manage transformations.
|
ItemQuery<BioAssaySet> |
getProducts()
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.
|
ItemQuery<RawBioAssay> |
getRawSources()
Get a query that returns the raw bioassay sources used by this
transformation.
|
User |
getRemovedBy()
Get the user that flagged this item for removal.
|
(package private) SharedData |
getSharedParent()
Get the experiment.
|
BioAssaySet |
getSource()
Get the source bioassayset used by this transformation.
|
Item |
getType()
Get the type of item represented by the object.
|
boolean |
isRemoved()
Check if the removed flag is set for this item.
|
BioAssaySet |
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 |
setJob(Job job)
Set the job that executed this transformation.
|
void |
setName(String name)
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.
|
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.TRANSFORMATION
,
getType()
private Job job
private Map<String,DataCube> namedCubes
private Map<String,DataCubeLayer> namedLayers
Transformation(TransformationData data)
data
- the datastatic Transformation getNew(DbControl dc, Experiment experiment, Job job) throws BaseException
Transformation
item. No source
has been specified. A caller should use either:
setSource(BioAssaySet)
or setRawSources(Collection)
.dc
- The DbControl
which will be used for
permission checking and database access.experiment
- The experimentjob
- The job that executed the transformationTransformation
itemBaseException
- If there is another errorExperiment.newTransformation(Job, Collection)
,
BioAssaySet.newTransformation(Job)
public static Transformation getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Transformation
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 loadTransformation
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<Transformation> getQuery(Experiment experiment) throws InvalidDataException
experiment
- The experiment to retreive transformations for, null
is not allowedItemQuery
objectInvalidDataException
- If required parameter is null.public static ItemQuery<Transformation> getQuery(BioAssaySet bioAssaySet) throws InvalidDataException
bioAssaySet
- The source bioassayset to retreive transformations for, null
is not allowedItemQuery
objectInvalidDataException
- If required parameter is null.TransformationData 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 foundvoid 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)
public BioAssaySet getSource() throws PermissionDeniedException, BaseException
BioAssaySet
item, or null if this is a root
transformationPermissionDeniedException
- If the logged in user doesn't have
read permission to the experimentBaseException
- If there is another errorgetRawSources()
void setSource(BioAssaySet bioAssaySet)
BioAssaySet.newTransformation(Job)
public ItemQuery<RawBioAssay> getRawSources()
BioAssaySet
.ItemQuery
objectgetSource()
void setRawSources(Collection<RawBioAssay> rawBioAssays) throws InvalidDataException
InvalidDataException
- If any of the raw bioassays are not part
of the experimentExperiment.newTransformation(Job, Collection)
,
Experiment.isUsing(RawBioAssay)
public Job getJob() throws PermissionDeniedException, BaseException
Job
object, ot null if this transformation
wasn't executed by a jobPermissionDeniedException
- If the logged in user doesn't have
read permission to the experimentBaseException
- If there is another errorprivate void setJob(Job job)
public BioAssaySet newProduct(String namedCube, String namedLayer, boolean createChildBioAssays) throws PermissionDeniedException, InvalidDataException, BaseException
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);
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 nullPermissionDeniedException
- 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 errorpublic ItemQuery<BioAssaySet> getProducts()
ItemQuery
objectBioAssaySet.getQuery(Transformation)
private void deleteProducts()