3.0.2: 2012-01-25

net.sf.basedb.core
Class DerivedBioAssay

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.OwnedItem<D>
          extended by net.sf.basedb.core.SharedItem<D>
              extended by net.sf.basedb.core.CommonItem<D>
                  extended by net.sf.basedb.core.AnnotatedItem<DerivedBioAssayData>
                      extended by net.sf.basedb.core.DerivedBioAssay
All Implemented Interfaces:
AccessControlled, Annotatable, FileStoreEnabled, Identifiable, Nameable, Ownable, Registered, Removable, Shareable, Subtypable

public class DerivedBioAssay
extends AnnotatedItem<DerivedBioAssayData>
implements Registered, FileStoreEnabled, Subtypable

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2011-09-19 14:31:39 +0200 (Mon, 19 Sep 2011) $

Field Summary
static String ARRANGEMENT
          The id for the DerivedBioAssayType item representing sequenced data that has been aligned to a reference database.
private  boolean hardwareHasBeenSet
           
private  boolean protocolHasBeenSet
           
static String SCAN
          The id for the DerivedBioAssayType item representing a scanned hybridization.
static String SEQUENCES
          The id for the DerivedBioAssayType item representing original sequenced data.
private  boolean softwareHasBeenSet
           
static Item TYPE
          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
DerivedBioAssay(DerivedBioAssayData data)
           
 
Method Summary
 long countRawBioAssays()
          Counts all raw bioassays that have been created from this bioassay.
 Set<Annotatable> getAnnotatableParents()
          Get the extract and parent bioassay set or physical bioassay.
 ArrayDesign 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.
static DerivedBioAssay getById(DbControl dc, int id)
          Get a DerivedBioAssay item when you know the id.
 ItemQuery<DerivedBioAssay> getChildren()
          Get all child derived bioassays.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 Extract getExtract()
          Get the extract that is the parent of the data in this derived bioassay.
 FileSet getFileSet()
          Get the file set that collects all files that holds data for this item.
 Hardware getHardware()
          Get the Hardware that was used when creating this bioassay set.
 ItemSubtype getItemSubtype()
          Get the subtype of the item.
 Job getJob()
          Get the job that created this 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.
 DerivedBioAssay getParent()
          Get the parent derived bioassay set.
 Collection<FileSet> getParentFileSets()
          Get the file sets of parent item(s) that are related to the current item.
 PhysicalBioAssay getPhysicalBioAssay()
          Get the physical bioassay that is the root bioassay for this derived bioassay set.
 Platform getPlatform()
          Get the platform the item is related to.
 Protocol getProtocol()
          Default implementation returns null.
static ItemQuery<DerivedBioAssay> getQuery()
          Get a query that returns derived bioassay.
 ItemQuery<RawBioAssay> getRawBioAssays()
           
 Software getSoftware()
          Get the Software that was used when creating this bioassay set.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get all: Child derived bioassays Child raw bioassays
 PlatformVariant getVariant()
          Get the platform variant the item is related to.
 boolean hasFileSet()
          Check if this item has a file set.
 boolean isRoot()
          Check if this bioassay set is derived from a physical bioassay or from another bioassay set.
 boolean isUsed()
          Check if this item is used by some other item.
 void setExtract(Extract extract)
          Set the extract that is the parent of data in this bioassay.
 void setHardware(Hardware hardware)
          Set the Hardware that was used when creating this bioassay set.
 void setItemSubtype(ItemSubtype subtype)
          Set the subtype on the item.
(package private)  void setProjectDefaults(Project activeProject)
          Set protocol, hardware and software from project default settings.
 void setProtocol(Protocol protocol)
          Set the Protocol that describes the procedure used when creating this bioassay set.
 void setSoftware(Software software)
          Set the Software that was used when creating this bioassay set.
 
Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, isAnnotated, removeAnnotations, toTransferable
 
Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, isRemoved, setDescription, setName, setRemoved, toTransferable
 
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey, toTransferable
 
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership, toTransferable
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, toString, toTransferable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
 
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
 
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.DERIVEDBIOASSAY, getType()

SCAN

public static final String SCAN
The id for the DerivedBioAssayType item representing a scanned hybridization.

See Also:
Constant Field Values

SEQUENCES

public static final String SEQUENCES
The id for the DerivedBioAssayType item representing original sequenced data.

See Also:
Constant Field Values

ARRANGEMENT

public static final String ARRANGEMENT
The id for the DerivedBioAssayType item representing sequenced data that has been aligned to a reference database.

See Also:
Constant Field Values

protocolHasBeenSet

private boolean protocolHasBeenSet

hardwareHasBeenSet

private boolean hardwareHasBeenSet

softwareHasBeenSet

private boolean softwareHasBeenSet
Constructor Detail

DerivedBioAssay

DerivedBioAssay(DerivedBioAssayData data)
Method Detail

getById

public static DerivedBioAssay getById(DbControl dc,
                                      int id)
                               throws ItemNotFoundException,
                                      PermissionDeniedException,
                                      BaseException
Get a DerivedBioAssay item when you know the id.

Parameters:
dc - The DbControl 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 found
PermissionDeniedException - If the logged in user doesn't have read permission to the item
BaseException - If there is another error

getNew

public static DerivedBioAssay getNew(DbControl dc,
                                     PhysicalBioAssay bioAssay,
                                     Job job)
Create a new (root) derived bioassay from a physical bioassay.

Parameters:
dc - The DbControl which will be used for permission checking and database access
bioAssay - The parent physical bioassay
job - The job that created the new bioassay
Returns:
A new DerivedBioAssay item

getNew

public static DerivedBioAssay getNew(DbControl dc,
                                     DerivedBioAssay parent,
                                     Job job)
Create a new child derived bioassay from a parent derived bioassay.

Parameters:
dc - The DbControl which will be used for permission checking and database access
parent - The parent bioassay
job - The job that created the new bioassay
Returns:
A new DerivedBioAssay item

getQuery

public static ItemQuery<DerivedBioAssay> getQuery()
Get a query that returns derived bioassay.

Returns:
An ItemQuery object

getType

public 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 the Item enumeration.

Specified by:
getType in interface Identifiable
Returns:
A value indicating the type of item

getUsingItems

public Set<ItemProxy> getUsingItems()
Get all:

Overrides:
getUsingItems in class BasicItem<DerivedBioAssayData>
Returns:
A set containing proxies for the items, or an empty set if no items are using this item
See Also:
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)

isUsed

public boolean isUsed()
               throws BaseException
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 class BasicItem<DerivedBioAssayData>
Returns:
TRUE if this item is used, FALSE otherwise
Throws:
BaseException - If not able to tell if item is used or not.
See Also:
BasicItem.getUsingItems()

setProjectDefaults

void setProjectDefaults(Project activeProject)
                  throws BaseException
Set protocol, hardware and software from project default settings.

Overrides:
setProjectDefaults in class BasicItem<DerivedBioAssayData>
Parameters:
activeProject - The currently active project
Throws:
BaseException

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Get the extract and parent bioassay set or physical bioassay.

Specified by:
getAnnotatableParents in interface Annotatable
Returns:
A set containing annotatable items, or null
Throws:
BaseException - If there is an error

getProtocol

public Protocol getProtocol()
Description copied from class: AnnotatedItem
Default implementation returns null. Should be overriden by subclasses that has protocols.

Specified by:
getProtocol in interface Annotatable
Overrides:
getProtocol in class AnnotatedItem<DerivedBioAssayData>
Returns:
Always null

getItemSubtype

@SubtypableRelatedItems(value={PHYSICALBIOASSAY,DERIVEDBIOASSAY,EXTRACT,SOFTWARE,HARDWARE,PROTOCOL})
public ItemSubtype getItemSubtype()
Description copied from interface: Subtypable
Get the subtype of the item.

Specified by:
getItemSubtype in interface Subtypable
Returns:
A subtype of null if not set
See Also:
SubtypableRelatedItems

setItemSubtype

public void setItemSubtype(ItemSubtype subtype)
Description copied from interface: Subtypable
Set the subtype on the item.

Specified by:
setItemSubtype in interface Subtypable
Parameters:
subtype - A subtype or null
See Also:
ItemSubtype.setOnItem(Subtypable)

getEntryDate

public Date getEntryDate()
Description copied from interface: Registered
Get the date that the item was registered in the database.

Specified by:
getEntryDate in interface Registered
Returns:
A date or null if this is not known

getFileSet

public FileSet 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 when DbControl.commit() is called. To check if an item has files without creating a new file set use the FileStoreEnabled.hasFileSet() method.

Specified by:
getFileSet in interface FileStoreEnabled
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 before FileStoreEnabled.getFileSet() to avoid creating a new file set when there is no need for it.

Specified by:
hasFileSet in interface FileStoreEnabled
Returns:
TRUE if a file set exists, FALSE if not

getPlatform

public Platform getPlatform()
Description copied from interface: FileStoreEnabled
Get the platform the item is related to. The platform is used to limit the DataFileType:s that can be added to the file set.

Specified by:
getPlatform in interface FileStoreEnabled
Returns:
A platform or null if the items is not related to any platform.

getVariant

public PlatformVariant getVariant()
Description copied from interface: FileStoreEnabled
Get the platform variant the item is related to. The platform is used to limit the DataFileType:s that can be added to the file set.

Specified by:
getVariant in interface FileStoreEnabled
Returns:
A platform or null if the items is not related to any variant.

getParentFileSets

public Collection<FileSet> 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 interface FileStoreEnabled
Returns:
A collection of FileSet or null

getPhysicalBioAssay

public PhysicalBioAssay getPhysicalBioAssay()
Get the physical bioassay that is the root bioassay for this derived bioassay set. This property is always inherited down to child events so this method never return null.


getParent

public DerivedBioAssay getParent()
Get the parent derived bioassay set.

Returns:
The parent bioassay set or null if this item is a root bioassay set

isRoot

public boolean isRoot()
Check if this bioassay set is derived from a physical bioassay or from another bioassay set.

Returns:
TRUE if this is a root bioassay set derived form a physical bioassay

getExtract

public Extract 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

public void setExtract(Extract extract)
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

public ItemQuery<DerivedBioAssay> getChildren()
Get all child derived bioassays.

Returns:
A query returning all child bioassays

getJob

public Job getJob()
Get the job that created this bioassay.

Returns:
A job or null if not created by a job

setProtocol

public void setProtocol(Protocol protocol)
                 throws PermissionDeniedException
Set the Protocol that describes the procedure used when creating this bioassay set.

Parameters:
protocol - A Protocol 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

getHardware

public Hardware getHardware()
Get the Hardware that was used when creating this bioassay set.

Returns:
A Hardware item, or null if not known

setHardware

public void setHardware(Hardware hardware)
                 throws PermissionDeniedException
Set the Hardware that was used when creating this bioassay set.

Parameters:
hardware - A Hardware 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

public Software getSoftware()
Get the Software that was used when creating this bioassay set.

Returns:
A Software item, or null if not known

setSoftware

public void setSoftware(Software software)
                 throws PermissionDeniedException
Set the Software that was used when creating this bioassay set.

Parameters:
software - A Software 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

public ItemQuery<RawBioAssay> getRawBioAssays()

getArrayDesign

public ArrayDesign getArrayDesign()
                           throws PermissionDeniedException,
                                  BaseException
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.

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 design
BaseException - If there is another error.

countRawBioAssays

public long countRawBioAssays()
                       throws BaseException
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.

3.0.2: 2012-01-25