2.17.2: 2011-06-17

net.sf.basedb.core
Class BioAssay

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.ChildItem<BioAssayData>
          extended by net.sf.basedb.core.BioAssay
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Nameable

public class BioAssay
extends ChildItem<BioAssayData>
implements Nameable, Annotatable

Represents the current intensities of raw data after some transformation has been applied to it. Usually a single bioassay represents the data from a single RawBioAssay but it is also possible that a transformation has merged several bioassays into a single one.

Bioassays are created by one of the BioAssaySet.newRootBioAssay(Collection), BioAssaySet.newBioAssay(BioAssay) or BioAssaySet.newBioAssay(Collection). Which one to use depends on the relationship to it's parents. Bioassays can only be created if the bioassayset hasn't been committed to the database.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2005-10-19 15:57:12 +0200 (on, 19 okt 2005) $

Field Summary
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
BioAssay(BioAssayData data)
          Creates a new bioassay item from the given data.
 
Method Summary
 Set<Annotatable> getAnnotatableParents()
          Get the parent bioassay set, all parent bioassays and all parent raw bioassays.
 AnnotationSet getAnnotationSet()
          Get the annotation set containing the annotations for this item.
 BioAssaySet getBioAssaySet()
          Get the bioassayset this bioassay belongs to.
static BioAssay getById(DbControl dc, int id)
          Get a BioAssay item when you know the id.
(package private)  DataCubeColumn getDataCubeColumn()
          Get the DataCubeColumn object where this bioassay store it's data.
 short getDataCubeColumnNo()
          Get the column coordinate in the data cube that this bioassay stores it's data in.
 short getDataCubeLayerNo()
          Get the layer coordinate in the data cube that this bioassay stores it's data in.
 short getDataCubeNo()
          Get the number of the data cube this bioassay stores it's data in.
 String getDescription()
          Get the description for the item.
 Experiment getExperiment()
          Get the experiment this bioassay belongs to.
 String getName()
          Get the name of the item.
(package private) static BioAssay getNew(DbControl dc, BioAssaySet bioAssaySet, DataCubeColumn column)
          Create a new BioAssay item.
 int getNumFileSpots()
          Get the number of spots that are stored in files.
 int getNumSpots()
          Get the number of spots in this bioassay.
 ItemQuery<BioAssay> getParents()
          Get a query for loading the parents bioassays to this bioassay.
(package private)  Permission getPermissionForWriteDeleteAndCreate()
          USE permission is enough to be able to manage bioassays.
 Protocol getProtocol()
          Default implementation returns null.
static ItemQuery<BioAssay> getQuery(BioAssaySet bioAssaySet)
          Get a query configured to retrieve bioassays in a given bioassayset.
 ItemQuery<RawBioAssay> getRawBioAssays()
           
 RawDataType getRawDataType()
          Get the raw data type the experiment uses for the raw data.
(package private)  SharedData getSharedParent()
          Get the experiment.
 DynamicSpotQuery getSpotData()
          Get a query that returns spot data for this bioassay.
 Item getType()
          Get the type of item represented by the object.
(package private)  void initPermissions(int granted, int denied)
          Deny DELETE permission.
 boolean isAnnotated()
          Check if this item has an annotation set.
(package private)  void onBeforeCommit(Transactional.Action action)
          This method is called on each Transactional item and on all items if the action is Transactional.Action.CREATE or Transactional.Action.DELETE before a commit is issued to the database.
 void removeAnnotations()
          Remove all annotations from this item, by deleting the annotation set.
private  void setBioAssaySet(BioAssaySet bioAssaySet)
          Set the experiment.
private  void setDataCubeColumn(DataCubeColumn column)
           
 void setDescription(String description)
          Set the description for the item.
 void setName(String name)
          Set the name of the item.
 void setNumFileSpots(int numSpots)
          Set the number of spots that are stored in files.
 
Methods inherited from class net.sf.basedb.core.ChildItem
getPluginPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, 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
 

Field Detail

TYPE

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

See Also:
Item.BIOASSAY, getType()
Constructor Detail

BioAssay

BioAssay(BioAssayData data)
Creates a new bioassay item from the given data.

Parameters:
data - the data
Method Detail

getNew

static BioAssay getNew(DbControl dc,
                       BioAssaySet bioAssaySet,
                       DataCubeColumn column)
                throws PermissionDeniedException,
                       InvalidDataException,
                       BaseException
Create a new BioAssay item.

Parameters:
dc - The DbControl which will be used for permission checking and database access.
bioAssaySet - The bioassayset the bioassay belongs to
column - The data cube column where the bioassay should store it's data; must be unique among bioassays in a bioassayset
Returns:
The new BioAssay item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for the experiment
InvalidDataException - If the bioassayset is null
BaseException - If there is an error

getById

public static BioAssay getById(DbControl dc,
                               int id)
                        throws ItemNotFoundException,
                               PermissionDeniedException,
                               BaseException
Get a BioAssay 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 BioAssay item
Throws:
ItemNotFoundException - If an item with the specified id is not found
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission to the item
BaseException - If there is another error

getQuery

public static ItemQuery<BioAssay> getQuery(BioAssaySet bioAssaySet)
                                    throws InvalidDataException
Get a query configured to retrieve bioassays in a given bioassayset.

Parameters:
bioAssaySet - The bioassayset to retreive bioassays for, null is not allowed
Returns:
An ItemQuery object
Throws:
InvalidDataException - If the parameter is null.

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

getName

public String getName()
Description copied from interface: Nameable
Get the name of the item.

Specified by:
getName in interface Nameable
Returns:
A String with the name of the item

setName

public void setName(String name)
             throws PermissionDeniedException,
                    InvalidDataException
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 the Nameable.MAX_NAME_LENGTH constant.

Specified by:
setName in interface Nameable
Parameters:
name - The new name for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the name is null or longer than specified by the Nameable.MAX_NAME_LENGTH constant

getDescription

public String getDescription()
Description copied from interface: Nameable
Get the description for the item.

Specified by:
getDescription in interface Nameable
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 the Nameable.MAX_DESCRIPTION_LENGTH constant.

Specified by:
setDescription in interface Nameable
Parameters:
description - The new description for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the description longer than specified by the Nameable.MAX_DESCRIPTION_LENGTH constant

getAnnotationSet

public AnnotationSet getAnnotationSet()
                               throws PermissionDeniedException,
                                      BaseException
Description copied from interface: Annotatable
Get the annotation set containing the annotations for this item. If the item doesn't have any annotations a new annotation set is created and automatically saved to the database when DbControl.commit() is called. To check if an item has annotations without creating a new annotation set use the Annotatable.isAnnotated() method.

Specified by:
getAnnotationSet in interface Annotatable
Returns:
An AnnotationSet
Throws:
PermissionDeniedException - If the logged in user doesn't have enough permissions
BaseException - If there is another error
Since:
2.2

isAnnotated

public boolean isAnnotated()
Description copied from interface: Annotatable
Check if this item has an annotation set. The annotation set may be empty.

Specified by:
isAnnotated in interface Annotatable
Returns:
TRUE if an annotation set exists, FALSE otherwise
Since:
2.2

removeAnnotations

public void removeAnnotations()
                       throws PermissionDeniedException,
                              BaseException
Description copied from interface: Annotatable
Remove all annotations from this item, by deleting the annotation set.

Specified by:
removeAnnotations in interface Annotatable
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
BaseException - If there is another error
Since:
2.2

getProtocol

public Protocol getProtocol()
Default implementation returns null. Should be overriden by subclasses that has protocols.

Specified by:
getProtocol in interface Annotatable
Returns:
Always null
Since:
2.2

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Get the parent bioassay set, all parent bioassays and all parent raw bioassays.

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

onBeforeCommit

void onBeforeCommit(Transactional.Action action)
              throws BaseException
Description copied from class: BasicItem
This method is called on each Transactional item and on all items if the action is Transactional.Action.CREATE or Transactional.Action.DELETE before a commit is issued to the database. If the subclass overrides this method it must also propagate the call to the superclass, ie. super.onBeforeCommit(action).

Overrides:
onBeforeCommit in class BasicItem<BioAssayData>
Throws:
BaseException - If there is an error
See Also:
Transactional, Core API overview - Transaction handling, Coding rules and guidelines for item classes

initPermissions

void initPermissions(int granted,
                     int denied)
               throws BaseException
Deny DELETE permission. BioAssays are automatically deleted when it's parent bioassayset is deleted.

Overrides:
initPermissions in class ChildItem<BioAssayData>
Parameters:
granted - Permissions that have been granted by the subclass
denied - Permissions that have been denied by the subclass
Throws:
BaseException - If the permissions couldn't be initialised

getSharedParent

SharedData getSharedParent()
Get the experiment.

Specified by:
getSharedParent in class ChildItem<BioAssayData>
Returns:
The parent item

getPermissionForWriteDeleteAndCreate

Permission getPermissionForWriteDeleteAndCreate()
USE permission is enough to be able to manage bioassays.

Overrides:
getPermissionForWriteDeleteAndCreate in class ChildItem<BioAssayData>

getExperiment

public Experiment getExperiment()
                         throws PermissionDeniedException,
                                BaseException
Get the experiment this bioassay belongs to.

Returns:
An Experiment object
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the experiment
BaseException - If there is another error

getBioAssaySet

public BioAssaySet getBioAssaySet()
                           throws PermissionDeniedException,
                                  BaseException
Get the bioassayset this bioassay belongs to.

Returns:
A BioAssaySet object
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the bioassayset
BaseException - If there is another error

setBioAssaySet

private void setBioAssaySet(BioAssaySet bioAssaySet)
                     throws PermissionDeniedException,
                            InvalidDataException
Set the experiment. This cannot be changed after the bioassayset has been created.

Throws:
PermissionDeniedException
InvalidDataException

getRawDataType

public RawDataType getRawDataType()
Get the raw data type the experiment uses for the raw data.

Returns:
A RawDataType object

getNumSpots

public int getNumSpots()
Get the number of spots in this bioassay.


getNumFileSpots

public int getNumFileSpots()
Get the number of spots that are stored in files.

Since:
2.8

setNumFileSpots

public void setNumFileSpots(int numSpots)
Set the number of spots that are stored in files.

Parameters:
numSpots - The number of spots
Since:
2.8

getDataCubeNo

public short getDataCubeNo()
Get the number of the data cube this bioassay stores it's data in.

See Also:
getDataCubeLayerNo(), getDataCubeColumnNo()

getDataCubeLayerNo

public short getDataCubeLayerNo()
Get the layer coordinate in the data cube that this bioassay stores it's data in.

See Also:
getDataCubeNo(), getDataCubeColumnNo()

getDataCubeColumnNo

public short getDataCubeColumnNo()
Get the column coordinate in the data cube that this bioassay stores it's data in.

See Also:
getDataCubeNo(), getDataCubeLayerNo()

getDataCubeColumn

DataCubeColumn getDataCubeColumn()
                           throws PermissionDeniedException,
                                  BaseException
Get the DataCubeColumn object where this bioassay store it's data.

Throws:
PermissionDeniedException
BaseException

setDataCubeColumn

private void setDataCubeColumn(DataCubeColumn column)

getSpotData

public DynamicSpotQuery getSpotData()
Get a query that returns spot data for this bioassay. The query will select column, position and spot intensities by default. This method uses the BioAssaySet.getSpotData() method and adds a restriction to the returned query.

Returns:
A DynamicSpotQuery object
See Also:
BioAssaySet.getSpotData()

getParents

public ItemQuery<BioAssay> getParents()
Get a query for loading the parents bioassays to this bioassay. If this bioassay belong to a root bioassayset, null is returned.

Returns:
A query returning the parent bioassays of this bioassay, or null

getRawBioAssays

public ItemQuery<RawBioAssay> getRawBioAssays()
Returns:
A query returning the raw bioassays this bioassay is created from

2.17.2: 2011-06-17