Package net.sf.basedb.core
Class DerivedBioAssay
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.OwnedItem
net.sf.basedb.core.SharedItem
net.sf.basedb.core.CommonItem
net.sf.basedb.core.AnnotatedItem
net.sf.basedb.core.DerivedBioAssay
- All Implemented Interfaces:
AccessControlled
,Annotatable
,FileStoreEnabled
,Identifiable
,Listable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
,Subtypable
public class DerivedBioAssay
extends AnnotatedItem
implements Registered, FileStoreEnabled, Subtypable, Listable
- Since:
- 3.0
- Author:
- Nicklas
- Last modified
- $Date: 2021-03-26 08:26:24 +0100 (Fri, 26 Mar 2021) $
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Whenever we modify the parent items to a derived bioassay, we must make sure that the physical bioassays for all child items are synchronized with the same changes. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The id for theDerivedBioAssayType
item representing sequenced data that has been aligned to a reference database.private boolean
private boolean
private boolean
static final String
The id for theDerivedBioAssayType
item representing a scanned hybridization.static final String
The id for theDerivedBioAssayType
item representing original sequenced data.private boolean
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addParent
(DerivedBioAssay bioAssay) Add a derived bioassay as a parent to this derived bioassay.void
addPhysicalBioAssay
(PhysicalBioAssay bioAssay) Add a physical bioassay as a parent to this derived bioassay.(package private) int
breakCircularReferences
(Set<ItemProxy> items) Any parent bioassays found among the given items are removed from this item.long
Counts all raw bioassays that have been created from this bioassay.Get the extract and parent bioassays or physical bioassays.Get the array design connected to this derived bioassay by following the path from the physical bioassay to the array slide to the array batch to the array design.static DerivedBioAssay
Get aDerivedBioAssay
item when you know the id.Get all child derived bioassays.(package private) DerivedBioAssayData
getData()
Get theBasicData
object that holds all data for this item.Get the date that the item was registered in the database.Get the extract that is the parent of the data in this derived bioassay.Get the file set that collects all files that holds data for this item.Get theHardware
that was used when creating this bioassay set.Get the subtype of the item.getJob()
Get the job that created this bioassay.getKit()
Get theKit
that was used when creating this bioassay.static DerivedBioAssay
Create a new parent-less derived bioassay.static DerivedBioAssay
getNew
(DbControl dc, DerivedBioAssay parent, Job job) Create a new child derived bioassay from a parent derived bioassay.static DerivedBioAssay
getNew
(DbControl dc, PhysicalBioAssay bioAssay, Job job) Create a new (root) derived bioassay from a physical bioassay.Get the file sets of parent item(s) that are related to the current item.Get all parent derived bioassays.Get a query that returns the physical bioassays used to create this derived bioassay.Get the platform the item is related to.Default implementation returns null.static ItemQuery<DerivedBioAssay>
getQuery()
Get a query that returns derived bioassay.Get theSoftware
that was used when creating this bioassay set.getType()
Get the type of item represented by the object.Get all: Child derived bioassays Child raw bioassaysGet the platform variant the item is related to.boolean
Check if this item has a file set.boolean
isRoot()
Check if this bioassay set is derived from one or more physical bioassays or from derived bioassays.boolean
isUsed()
Check if this item is used by some other item.(package private) void
onBeforeCommit
(Transactional.Action action) Automatically try to assign an extract from parent items at creation time.void
removeParent
(DerivedBioAssay bioAssay) Remove a derived bioassay as a parent item for this derived bioassay.void
removePhysicalBioAssay
(PhysicalBioAssay bioAssay) Remove a physical bioassay as a parent item for this derived bioassay.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.void
setExtract
(Extract extract) Set the extract that is the parent of data in this bioassay.void
setHardware
(Hardware hardware) Set theHardware
that was used when creating this bioassay set.void
setItemSubtype
(ItemSubtype subtype) Set the subtype on the item.void
Set the job on this derived bioassay that was used to create or import data for it.void
Set theKit
that was used when creating this bioassay.(package private) void
setProjectDefaults
(Project activeProject) Set protocol, hardware and software from project default settings.void
setProtocol
(Protocol protocol) Set theProtocol
that describes the procedure used when creating this bioassay set.void
setSoftware
(Software software) Set theSoftware
that was used when creating this bioassay set.void
Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, 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, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, 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.Nameable
getDescription, getName, setDescription, setName
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:
-
SCAN
The id for theDerivedBioAssayType
item representing a scanned hybridization.- See Also:
-
SEQUENCES
The id for theDerivedBioAssayType
item representing original sequenced data.- See Also:
-
ARRANGEMENT
The id for theDerivedBioAssayType
item representing sequenced data that has been aligned to a reference database.- See Also:
-
extractHasBeenSet
private boolean extractHasBeenSet -
protocolHasBeenSet
private boolean protocolHasBeenSet -
hardwareHasBeenSet
private boolean hardwareHasBeenSet -
softwareHasBeenSet
private boolean softwareHasBeenSet
-
-
Constructor Details
-
DerivedBioAssay
DerivedBioAssay(DerivedBioAssayData data)
-
-
Method Details
-
getById
public static DerivedBioAssay getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aDerivedBioAssay
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
DerivedBioAssay
item - Throws:
ItemNotFoundException
- If an item with the specified id is not foundPermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- If there is another error
-
getNew
Create a new parent-less derived bioassay. Parent items can be added by callingaddPhysicalBioAssay(PhysicalBioAssay)
oraddParent(DerivedBioAssay)
.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessisRoot
- TRUE if the new item is a root derived bioassay (eg. it have physical bioassays as parent items)job
- The job that created the new bioassay- Returns:
- A new DerivedBioAssay item
- Since:
- 3.2
-
getNew
Create a new (root) derived bioassay from a physical bioassay.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessbioAssay
- The parent physical bioassayjob
- The job that created the new bioassay- Returns:
- A new DerivedBioAssay item
-
getNew
Create a new child derived bioassay from a parent derived bioassay.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessparent
- The parent bioassayjob
- The job that created the new bioassay- Returns:
- A new DerivedBioAssay item
-
getQuery
Get a query that returns derived bioassay.- Returns:
- An
ItemQuery
object
-
getData
DerivedBioAssayData 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
-
getUsingItems
Get all:- Child derived bioassays
- Child raw bioassays
- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- See Also:
-
isUsed
Description copied from class:BasicItem
Check if this item is used by some other item. With used we mean that another item is linking to this item in way that prevents this item from beeing deleted. Ie. if we tried to delete an item that is used, we would get a foreign key violation error from the database. If the subclass overrides this method it should propagate the call to the superclass, ie.super.isUsed()
, unless it has decided that the item is used by some other means.- Overrides:
isUsed
in classBasicItem
- Returns:
- TRUE if this item is used, FALSE otherwise
- Throws:
BaseException
- If not able to tell if item is used or not.- See Also:
-
breakCircularReferences
Any parent bioassays found among the given items are removed from this item. NOTE! Due toDerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction
it should not be possible to create circular references between derived bioassays, but in case something changes in the future we have implemented this method anyway.- Overrides:
breakCircularReferences
in classBasicItem
- Since:
- 3.8
-
onBeforeCommit
Automatically try to assign an extract from parent items at creation time. -
setProjectDefaults
Set protocol, hardware and software from project default settings.- Overrides:
setProjectDefaults
in classBasicItem
- Parameters:
activeProject
- The currently active project- Throws:
BaseException
-
getAnnotatableParents
Get the extract and parent bioassays or physical bioassays.- Specified by:
getAnnotatableParents
in interfaceAnnotatable
- Returns:
- A set containing annotatable items, or null
- Throws:
BaseException
- If there is an error
-
getProtocol
Description copied from class:AnnotatedItem
Default implementation returns null. Should be overriden by subclasses that has protocols.- Specified by:
getProtocol
in interfaceAnnotatable
- Overrides:
getProtocol
in classAnnotatedItem
- Returns:
- Always null
-
getItemSubtype
@SubtypableRelatedItems({PHYSICALBIOASSAY,DERIVEDBIOASSAY,EXTRACT,SOFTWARE,HARDWARE,PROTOCOL,KIT}) public ItemSubtype getItemSubtype()Description copied from interface:Subtypable
Get the subtype of the item.- Specified by:
getItemSubtype
in interfaceSubtypable
- Returns:
- A subtype of null if not set
- See Also:
-
setItemSubtype
Description copied from interface:Subtypable
Set the subtype on the item.- Specified by:
setItemSubtype
in interfaceSubtypable
- Parameters:
subtype
- A subtype or null- See Also:
-
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
-
getFileSet
Description copied from interface:FileStoreEnabled
Get the file set that collects all files that holds data for this item. If no file set exists a new one is created and automatically saved to the database whenDbControl.commit()
is called. To check if an item has files without creating a new file set use theFileStoreEnabled.hasFileSet()
method.- Specified by:
getFileSet
in interfaceFileStoreEnabled
- Returns:
- A file set
-
hasFileSet
public boolean hasFileSet()Description copied from interface:FileStoreEnabled
Check if this item has a file set. Always call this method beforeFileStoreEnabled.getFileSet()
to avoid creating a new file set when there is no need for it.- Specified by:
hasFileSet
in interfaceFileStoreEnabled
- Returns:
- TRUE if a file set exists, FALSE if not
-
getPlatform
Description copied from interface:FileStoreEnabled
Get the platform the item is related to. The platform is used to limit theDataFileType
:s that can be added to the file set.- Specified by:
getPlatform
in interfaceFileStoreEnabled
- Returns:
- A platform or null if the items is not related to any platform.
-
getVariant
Description copied from interface:FileStoreEnabled
Get the platform variant the item is related to. The platform is used to limit theDataFileType
:s that can be added to the file set.- Specified by:
getVariant
in interfaceFileStoreEnabled
- Returns:
- A platform or null if the items is not related to any variant.
-
getParentFileSets
Description copied from interface:FileStoreEnabled
Get the file sets of parent item(s) that are related to the current item. If the item has no parent(s) or if the parent has no file set, null or an empty collection is returned.- Specified by:
getParentFileSets
in interfaceFileStoreEnabled
- Returns:
- A collection of
FileSet
or null
-
testFixChildren
public void testFixChildren() -
addPhysicalBioAssay
public void addPhysicalBioAssay(PhysicalBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException Add a physical bioassay as a parent to this derived bioassay. Note! Physical bioassays can only be added if this derived bioassay is a root bioassay. The physical bioassay for non-root derived bioassays are automatically assigned.- Parameters:
bioAssay
- The parent bioassay to add- Throws:
PermissionDeniedException
InvalidDataException
- Since:
- 3.2
-
removePhysicalBioAssay
public void removePhysicalBioAssay(PhysicalBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException Remove a physical bioassay as a parent item for this derived bioassay. Note! Physical bioassays can only be removed if this derived bioassay is a root bioassay. The physical bioassay for non-root derived bioassays are automatically assigned.- Parameters:
bioAssay
- The parent bioassay to remove from this bioassay- Throws:
PermissionDeniedException
InvalidDataException
- Since:
- 3.2
-
getPhysicalBioAssays
Get a query that returns the physical bioassays used to create this derived bioassay.- Returns:
- An
ItemQuery
object - Since:
- 3.2
-
addParent
public void addParent(DerivedBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException Add a derived bioassay as a parent to this derived bioassay. Note! Derived bioassays can only be added if this derived bioassay is not a root bioassay. The physical bioassays are automatically assigned.- Parameters:
bioAssay
- The parent bioassay to add- Throws:
PermissionDeniedException
InvalidDataException
- Since:
- 3.2
-
removeParent
public void removeParent(DerivedBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException Remove a derived bioassay as a parent item for this derived bioassay. Note! Derived bioassays can only be used as parents if this derived bioassay is not a root bioassay. The physical bioassays are automatically assigned.- Parameters:
bioAssay
- The parent bioassay to remove from this bioassay- Throws:
PermissionDeniedException
InvalidDataException
- Since:
- 3.2
-
getParents
Get all parent derived bioassays.- Returns:
- A query returning all parent bioassays
- Since:
- 3.2
-
isRoot
public boolean isRoot()Check if this bioassay set is derived from one or more physical bioassays or from derived bioassays. A root derived bioassay can only have physical bioassays as parent items. A non-root derived bioassay can only have other derived bioassays as parents, but the core keep automatically keep track of the physical bioassays.- Returns:
- TRUE if this is a root bioassay set derived form a physical bioassay
-
getExtract
Get the extract that is the parent of the data in this derived bioassay. The extract should be an extract that is present on the physical bioassay that this bioassay is derived from. But this is not enforced by the core. If no extract is specified this bioassay applies to all extracts that are part of the physical bioassay.- Returns:
- An extract or null
-
setExtract
Set the extract that is the parent of data in this bioassay. The extract should be an extract that is present on the physical bioassay that this bioassay is derived from. But this is not enforced by the core.- Parameters:
extract
- The extract or null
-
getChildren
Get all child derived bioassays.- Returns:
- A query returning all child bioassays
-
getJob
Get the job that created this bioassay.- Returns:
- A job or null if not created by a job
-
setJob
Set the job on this derived bioassay that was used to create or import data for it.- Parameters:
job
- The job or null to clear the existing job- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission- Since:
- 3.18.1
-
setProtocol
Set theProtocol
that describes the procedure used when creating this bioassay set.- Parameters:
protocol
- AProtocol
item, or null if not known- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission on this event or use permission for the protocol
-
getKit
Get theKit
that was used when creating this bioassay.- Returns:
- A
Kit
item, or null if not known - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the kitBaseException
- If there is another error- Since:
- 3.7
-
setKit
Set theKit
that was used when creating this bioassay.- Parameters:
kit
- AKit
item, or null if not known- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission on this event or use permission for the kit- Since:
- 3.7
-
getHardware
Get theHardware
that was used when creating this bioassay set.- Returns:
- A
Hardware
item, or null if not known
-
setHardware
Set theHardware
that was used when creating this bioassay set.- Parameters:
hardware
- AHardware
item, or null if not known- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission on this event or use permission for the hardware
-
getSoftware
Get theSoftware
that was used when creating this bioassay set.- Returns:
- A
Software
item, or null if not known
-
setSoftware
Set theSoftware
that was used when creating this bioassay set.- Parameters:
software
- ASoftware
item, or null if not known- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission on this event or use permission for the software
-
getRawBioAssays
-
getArrayDesign
Get the array design connected to this derived bioassay by following the path from the physical bioassay to the array slide to the array batch to the array design. If this derived bioasay has multiple parents that are linked to different array designs, null is returned.- Returns:
- The array design, or null if no array design is connected
- Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission for the array designBaseException
- If there is another error.
-
countRawBioAssays
Counts all raw bioassays that have been created from this bioassay. The count includes raw bioassays that the logged in user doesn't have access to.- Returns:
- The number of raw bioassays
- Throws:
BaseException
- If the raw bioassays couldn't be counted.
-