Package net.sf.basedb.core
Class Experiment
- All Implemented Interfaces:
AccessControlled
,Annotatable
,Controlled
,DiskConsumable
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
,Transactional
An experiment is the starting point of the analysis in BASE. An experiment
is linked to zero or more
RawBioAssay
:s of the same RawDataType
as itself. It is not possible to mix raw data types. A root
Transformation
is used to calculate the first set of intensities from
the raw data. The intensities are stored in a root BioAssaySet
.
Then, it is possible to apply more transformations using the root bioassayset as a source. Each transformation may create new bioassaysets, from which it is possible to apply new transformations and so on.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sf.basedb.core.Transactional
Transactional.Action
-
Field Summary
Modifier and TypeFieldDescriptionprivate long
static final int
The maximum length of the abstract property that can be stored in the database.static final int
The maximum length of the affiliations property that can be stored in the database.static final int
The maximum length of the authors property that can be stored in the database.static final int
The maximum length of the experimentDesign property that can be stored in the database.static final int
The maximum length of the experimentType property that can be stored in the database.static final int
The maximum length of the publication property that can be stored in the database.static final int
The maximum length of the pubMedId property that can be stored in the database.static final int
The maximum length of the title property that can be stored in the database.private String
private String
private ReporterCloneBatcher
static final Item
The type of item represented by this class.private long
Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
ConstructorDescriptionExperiment
(ExperimentData data) Creates a new experiment item from the given data. -
Method Summary
Modifier and TypeMethodDescription(package private) void
addBytes
(long bytes) void
addExperimentalFactor
(AnnotationType annotationType) Add an annotation type as an experimental factor to this experiment.void
addRawBioAssay
(RawBioAssay rawBioAssay) Add a raw bioassay to this experiment.Get the abstract text for the publication for this experiment.Get the affiliations for this experiment.Always null.Get the authors of the publication for this experiment.Get a query that return all bioassaysets in this experiment.static Experiment
Get anExperiment
item when you know the id.long
getBytes()
Get the absolute number of bytes this item uses.(package private) ExperimentData
getData()
Get theBasicData
object that holds all data for this item.long
Get the number of bytes this items now is using compared to when it was loaded from the database.Get the associated directory where it is recommended that plugins store files that are related to this experiment.Get the date that the item was registered in the database.Get a query that returns all annotation types used as experimental factors for this experiment.Get the a text describing the experimental design.Get the a text describing the experiment type.AlwaysLocation.PRIMARY
.static Experiment
getNew
(DbControl dc, RawDataType rawDataType) Create a newExperiment
item.Get the publication text.Get the date this experiment was published.Get the PubMed ID of the publication.static ItemQuery<Experiment>
getQuery()
Get a query configured to retrieve experimentsAlwaysQuotaType.EXPERIMENT
.Get a query that returns the raw bioassays used in this experiment.Get the raw data type this experiment uses for the raw data.Get a batcher for managing cloned reporter information for this experiment.Get the root raw bioassay that represents the given raw bioassay in this experiment.Get a query that returns the root raw bioassays used in this experiment.Get a query that return all root transformations in this experiment.getTitle()
Get the title for the publication for this experiment.Get a query that return all transformations including root transformations in this experiment.getType()
Get the type of item represented by the object.Get the virtual database ite that is used to manage experiment-specific tables in the dynamic database for this experiment.boolean
isUsing
(RawBioAssay rawBioAssay) Check if a raw bioassay is used in this experiment.newTransformation
(Job job, Collection<RawBioAssay> rawSources) Create a new root transformation for this experiment.(package private) void
onAfterCommit
(Transactional.Action action) Remove old reporter clone table after a successful commit.(package private) void
onBeforeCommit
(Transactional.Action action) If a project is active, automatically share the new item according to the settings of that project, unless a project or item key has been explicitely set (including null).(package private) void
onRollback
(Transactional.Action action) Remove new reporter clone table after a rollback.void
removeExperimentalFactor
(AnnotationType annotationType) Remove an annotation type from the experimental factors for this experiment.void
removeRawBioAssay
(RawBioAssay rawBioAssay) Remove a raw bioassay from this experiment.void
setAbstract
(String theAbstract) Set the abstract text for the publication of this experiment.void
setAffiliations
(String affiliations) Set the affiliations for this experiment.void
setAuthors
(String authors) Set the authors of the publication for this experiment.void
setDirectory
(Directory directory) Set the directory where it is recommended that plugins store files that are related to this experiment.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.void
setExperimentDesign
(String experimentDesign) Set a text describing the experimental design.void
setExperimentType
(String experimentType) Set a text describing the experiment type.void
setPublication
(String publication) Set publication text.void
setPublicationDate
(Date publicationDate) Set the date this experiment was published.void
setPubMedId
(String pubMedId) Set the PubMed ID of the publication.private void
setRawDataType
(RawDataType rawDataType) Set the raw data type.void
Set the title for the publication of this experiment.private void
Unlink jobs from this experiment that are references from other items NOT PART of the experiment.boolean
TRUE if the experiment has been saved to the database, FALSE otherwise.Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations
Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, initPermissions, isShared, setItemKey, setProjectKey
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterInsert, 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
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
MAX_AUTHORS_LENGTH
public static final int MAX_AUTHORS_LENGTHThe maximum length of the authors property that can be stored in the database. Check the length against this value before calling thesetAuthors(String)
method to avoid exceptions.- See Also:
-
MAX_AFFILIATIONS_LENGTH
public static final int MAX_AFFILIATIONS_LENGTHThe maximum length of the affiliations property that can be stored in the database. Check the length against this value before calling thesetAffiliations(String)
method to avoid exceptions.- See Also:
-
MAX_TITLE_LENGTH
public static final int MAX_TITLE_LENGTHThe maximum length of the title property that can be stored in the database. Check the length against this value before calling thesetTitle(String)
method to avoid exceptions.- See Also:
-
MAX_ABSTRACT_LENGTH
public static final int MAX_ABSTRACT_LENGTHThe maximum length of the abstract property that can be stored in the database. Check the length against this value before calling thesetAbstract(String)
method to avoid exceptions.- See Also:
-
MAX_PUBLICATION_LENGTH
public static final int MAX_PUBLICATION_LENGTHThe maximum length of the publication property that can be stored in the database. Check the length against this value before calling thesetPublication(String)
method to avoid exceptions.- See Also:
-
MAX_EXPERIMENT_TYPE_LENGTH
public static final int MAX_EXPERIMENT_TYPE_LENGTHThe maximum length of the experimentType property that can be stored in the database. Check the length against this value before calling thesetExperimentType(String)
method to avoid exceptions.- See Also:
-
MAX_EXPERIMENT_DESIGN_LENGTH
public static final int MAX_EXPERIMENT_DESIGN_LENGTHThe maximum length of the experimentDesign property that can be stored in the database. Check the length against this value before calling thesetExperimentDesign(String)
method to avoid exceptions.- See Also:
-
MAX_PUBMEDID_LENGTH
public static final int MAX_PUBMEDID_LENGTHThe maximum length of the pubMedId property that can be stored in the database. Check the length against this value before calling thesetPubMedId(String)
method to avoid exceptions.- See Also:
-
addedBytes
private long addedBytes -
updatedBytes
private long updatedBytes -
oldReporterCloneTable
-
newReporterCloneTable
-
reporterCloneBatcher
-
-
Constructor Details
-
Experiment
Experiment(ExperimentData data) Creates a new experiment item from the given data.- Parameters:
data
- the data
-
-
Method Details
-
getNew
Create a newExperiment
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.rawDataType
- The data type of the raw data used in this experiment- Returns:
- The new
Experiment
item - Throws:
BaseException
- If there is an error
-
getById
public static Experiment getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get anExperiment
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
Experiment
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 experiments- Returns:
- An
ItemQuery
object
-
getData
ExperimentData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classAnnotatedItem
-
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
-
useDifference
public boolean useDifference()TRUE if the experiment has been saved to the database, FALSE otherwise.- Specified by:
useDifference
in interfaceDiskConsumable
- Returns:
- TRUE if the item reports the difference, FALSE if it reports the absolute
- See Also:
-
getBytes
public long getBytes()Description copied from interface:DiskConsumable
Get the absolute number of bytes this item uses. All items must report this number.- Specified by:
getBytes
in interfaceDiskConsumable
- Returns:
- The absolute number of bytes the item uses
- See Also:
-
getDifference
public long getDifference()Description copied from interface:DiskConsumable
Get the number of bytes this items now is using compared to when it was loaded from the database. This number may be negative if the item is now using less bytes than before. An item doesn't have to report this value ifDiskConsumable.useDifference()
returns FALSE.- Specified by:
getDifference
in interfaceDiskConsumable
- Returns:
- The difference in bytes between now and when the item was loaded, or 0 if this item doesn't report differences
-
addBytes
void addBytes(long bytes) -
getQuotaTypeSystemId
AlwaysQuotaType.EXPERIMENT
.- Specified by:
getQuotaTypeSystemId
in interfaceDiskConsumable
- Returns:
- The systemid of the QuotaType
-
getLocation
AlwaysLocation.PRIMARY
.- Specified by:
getLocation
in interfaceDiskConsumable
- Returns:
- The location
-
getEntryDate
Description copied from interface:Registered
Get the date that the item was registered in the database.- Specified by:
getEntryDate
in interfaceRegistered
- Returns:
- A date or null if this is not known
-
setEntryDate
Description copied from interface:Registered
Set the date the entry was registered in the database. Implementations should only allow this property to be set before the item is first stored in the database. The intention of this method is to facilitate export/import of data between server.- Specified by:
setEntryDate
in interfaceRegistered
- Parameters:
entryDate
- A date or null to use today's date
-
getAnnotatableParents
Always null.- Specified by:
getAnnotatableParents
in interfaceAnnotatable
- Returns:
- A set containing annotatable items, or null
- Throws:
BaseException
- If there is an error
-
onBeforeCommit
Description copied from class:SharedItem
If a project is active, automatically share the new item according to the settings of that project, unless a project or item key has been explicitely set (including null).- Overrides:
onBeforeCommit
in classSharedItem
- Throws:
BaseException
- If there is another error- See Also:
-
onAfterCommit
Remove old reporter clone table after a successful commit. -
onRollback
Remove new reporter clone table after a rollback. -
getRawDataType
Get the raw data type this experiment uses for the raw data. The raw data type cannot be changed once the experiment has been created.- Returns:
- A
RawDataType
object
-
setRawDataType
Set the raw data type. It cannot be changed.- Parameters:
rawDataType
- The raw data type, null is not allowed- Throws:
InvalidDataException
-
getVirtualDb
Get the virtual database ite that is used to manage experiment-specific tables in the dynamic database for this experiment.- Returns:
- A virtual db instance
- Since:
- 3.1
-
getTitle
Get the title for the publication for this experiment. -
setTitle
Set the title for the publication of this experiment. The value may be null, but mustn't be longer than the value specified by theMAX_TITLE_LENGTH
constant.- Parameters:
title
- The new title- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getDirectory
Get the associated directory where it is recommended that plugins store files that are related to this experiment.- Returns:
- The
Directory
item - Throws:
PermissionDeniedException
- This exception is thrown if the logged in user doesn't have read permission to the itemBaseException
- If there is another error
-
setDirectory
public void setDirectory(Directory directory) throws PermissionDeniedException, InvalidUseOfNullException Set the directory where it is recommended that plugins store files that are related to this experiment.- Parameters:
directory
- The newDirectory
, or null- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission to the experiment or use permission to the directoryInvalidUseOfNullException
-
getAbstract
Get the abstract text for the publication for this experiment. -
setAbstract
Set the abstract text for the publication of this experiment. The value may be null, but mustn't be longer than the value specified by theMAX_ABSTRACT_LENGTH
constant.- Parameters:
theAbstract
- The new abstract text- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getAuthors
Get the authors of the publication for this experiment. -
setAuthors
Set the authors of the publication for this experiment. The value may be null, but mustn't be longer than the value specified by theMAX_AUTHORS_LENGTH
constant.- Parameters:
authors
- The new authors text- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getAffiliations
Get the affiliations for this experiment. -
setAffiliations
public void setAffiliations(String affiliations) throws PermissionDeniedException, InvalidDataException Set the affiliations for this experiment. The value may be null, but mustn't be longer than the value specified by theMAX_AFFILIATIONS_LENGTH
constant.- Parameters:
affiliations
- The new affiliations text- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getExperimentDesign
Get the a text describing the experimental design. -
setExperimentDesign
public void setExperimentDesign(String experimentDesign) throws PermissionDeniedException, InvalidDataException Set a text describing the experimental design. The value may be null, but mustn't be longer than the value specified by theMAX_EXPERIMENT_DESIGN_LENGTH
constant.- Parameters:
experimentDesign
- The new experimental design- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getExperimentType
Get the a text describing the experiment type. -
setExperimentType
public void setExperimentType(String experimentType) throws PermissionDeniedException, InvalidDataException Set a text describing the experiment type. The value may be null, but mustn't be longer than the value specified by theMAX_EXPERIMENT_TYPE_LENGTH
constant.- Parameters:
experimentType
- The new experiment type- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getPublication
Get the publication text. -
setPublication
public void setPublication(String publication) throws PermissionDeniedException, InvalidDataException Set publication text. The value may be null, but mustn't be longer than the value specified by theMAX_PUBLICATION_LENGTH
constant.- Parameters:
publication
- The publication text- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getPubMedId
Get the PubMed ID of the publication. -
setPubMedId
Set the PubMed ID of the publication. The value may be null, but mustn't be longer than the value specified by theMAX_PUBMEDID_LENGTH
constant.- Parameters:
pubMedId
- The PubMed ID- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the text is too long
-
getPublicationDate
Get the date this experiment was published.- Returns:
- A
Date
object, or null if not known
-
setPublicationDate
Set the date this experiment was published.- Parameters:
publicationDate
- The date, or null if not known- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission
-
addRawBioAssay
public void addRawBioAssay(RawBioAssay rawBioAssay) throws PermissionDeniedException, InvalidDataException Add a raw bioassay to this experiment. Spots must have been added to the raw bioassay and it must have the sameRawDataType
as this experiment.- Parameters:
rawBioAssay
- The rawBioAssay to add to this experiment- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission for the experiment andPermission.USE
for the raw bioassayInvalidDataException
- If the rawBioAssay is null, or has a different raw data type
-
removeRawBioAssay
public void removeRawBioAssay(RawBioAssay rawBioAssay) throws PermissionDeniedException, InvalidDataException Remove a raw bioassay from this experiment.- Parameters:
rawBioAssay
- The rawBioAssay to remove from this experiment- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission for the experimentInvalidDataException
- If the rawBioAssay is null
-
isUsing
Check if a raw bioassay is used in this experiment.- Parameters:
rawBioAssay
- The raw bioassay to look for- Returns:
- TRUE if the raw bioassay is used in the experiment, FALSE otherwise
-
getRawBioAssays
Get a query that returns the raw bioassays used in this experiment.- Returns:
- An
ItemQuery
object
-
getRootRawBioAssays
Get a query that returns the root raw bioassays used in this experiment.- Returns:
- An
ItemQuery
object - Since:
- 3.6
-
getRootRawBioAssay
Get the root raw bioassay that represents the given raw bioassay in this experiment.- Returns:
- A root raw bioassay object or null if the given raw bioassay is not part of the experiment
- Since:
- 3.6
-
newTransformation
public Transformation newTransformation(Job job, Collection<RawBioAssay> rawSources) throws PermissionDeniedException, InvalidDataException, BaseException Create a new root transformation for this experiment.- Parameters:
job
- The job that executed the transformationrawSources
- The raw bioassays used as source bioassays- Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for the experimentInvalidDataException
- If any of the raw bioassays are not part of the experimentBaseException
- If there is another error
-
getTransformations
Get a query that return all transformations including root transformations in this experiment.- Returns:
- An
ItemQuery
object - See Also:
-
getRootTransformations
Get a query that return all root transformations in this experiment. A root transformation is a transformation that doesn't have a source bioassayset.- Returns:
- An
ItemQuery
object - See Also:
-
getBioAssaySets
Get a query that return all bioassaysets in this experiment.- Returns:
- An
ItemQuery
object - See Also:
-
addExperimentalFactor
public void addExperimentalFactor(AnnotationType annotationType) throws PermissionDeniedException, InvalidDataException Add an annotation type as an experimental factor to this experiment.- Parameters:
annotationType
- The annotation type to add to this experiment- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission for the experiment andPermission.USE
for the annotation typeInvalidDataException
- If the annotationType is null
-
removeExperimentalFactor
public void removeExperimentalFactor(AnnotationType annotationType) throws PermissionDeniedException, InvalidDataException Remove an annotation type from the experimental factors for this experiment.- Parameters:
annotationType
- The annotation type to remove from this experiment- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission for the experimentInvalidDataException
- If the annotationType is null
-
getExperimentalFactors
Get a query that returns all annotation types used as experimental factors for this experiment.- Returns:
- An
ItemQuery
object
-
getReporterCloneBatcher
Get a batcher for managing cloned reporter information for this experiment. Note that multiple calls to this method will return the same batcher instance.- Parameters:
dc
- The DbControl to use for database access- Returns:
- A reporter clone batcher
- Since:
- 3.1
-
unlinkJobs
private void unlinkJobs()Unlink jobs from this experiment that are references from other items NOT PART of the experiment. Without the unlinking it is not possible to delete the experiment because it will not be possible to delete the jobs that are part of.- Since:
- 2.7
- See Also:
-