2.17.2: 2011-06-17

net.sf.basedb.core
Class Hybridization

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<HybridizationData>
                      extended by net.sf.basedb.core.Hybridization
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Nameable, Ownable, Registered, Removable, Shareable

public class Hybridization
extends AnnotatedItem<HybridizationData>
implements Registered

A hybridization is a representation of the process of hybridizing one or more LabeledExtract:s on an ArraySlide.

Version:
2.0
Author:
Enell, Nicklas
Last modified
$Date$

Field Summary
private  BioPlateEventParticipant bioPlateEventParticipant
           
private  BioMaterialEvent creationEvent
           
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
Hybridization(HybridizationData hybridizationData)
           
 
Method Summary
 long countScans()
          Counts all scans that have been created from this hybridization.
 Set<Annotatable> getAnnotatableParents()
          Get the labeled extracts and array slide.
 Set<Annotatable> getAnnotatableParents(int arrayNum)
          Get the labeled extracts, possible on a specific array, and the array slide.
 ArraySlide getArraySlide()
          Get the ArraySlide this hyridization is using.
static Hybridization getById(DbControl dc, int id)
          Get a Hybridization item when you know the id.
 BioMaterialEvent getCreationEvent()
          Get the event that represents the creation of this hybridization.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 ItemQuery<LabeledExtract> getLabeledExtracts(int arrayNum)
          Get a query that returns labeled extracts connected to this hybridization.
static Hybridization getNew(DbControl dc)
          Create a new Hybridization item.
static Hybridization getNew(DbControl dc, BioPlateEventParticipant master)
          Create a new Hybridization item as part of a master bioplate event.
 int getNumArrays()
          Get the number of arrays that on the slide.
 Protocol getProtocol()
          Get the protocol from the creation event.
static ItemQuery<Hybridization> getQuery()
          Get a query that returns hybridizations.
 ItemQuery<Scan> getScans()
          Get a query that returns all scans created from this hybridization.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get all: Scan:s created from this hybridization
 boolean isUsed()
          Check that: No Scan:s use the hybridization
 Scan newScan()
          Create a new Scan from this hybridization.
(package private)  void onBeforeCommit(Transactional.Action action)
          Make sure the creation event is created at the same time this item is created and that source biomaterials get their used quantities back if this item is deleted.
 void setArraySlide(ArraySlide arraySlide)
          Set the ArraySlide this hybridization is using.
(package private)  void setBioPlateEventParticipant(BioPlateEventParticipant bioPlateEventParticipant)
           
 void setNumArrays(int numArrays)
          Set the number of arrays on a single slide.
 
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, 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, 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
 
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.HYBRIDIZATION, getType()

creationEvent

private BioMaterialEvent creationEvent

bioPlateEventParticipant

private BioPlateEventParticipant bioPlateEventParticipant
Constructor Detail

Hybridization

Hybridization(HybridizationData hybridizationData)
Method Detail

getNew

public static Hybridization getNew(DbControl dc)
                            throws BaseException
Create a new Hybridization item.

Parameters:
dc - The DbControl which will be used for permission checking and database access
Returns:
The new Hybridization item
Throws:
BaseException - If there is an error

getNew

public static Hybridization getNew(DbControl dc,
                                   BioPlateEventParticipant master)
                            throws BaseException
Create a new Hybridization item as part of a master bioplate event.

Parameters:
dc - The DbControl which will be used for permission checking and database access
master - The master bioplate event participant or null
Returns:
The new Hybridization item
Throws:
BaseException - If there is an error
Since:
2.17

getById

public static Hybridization getById(DbControl dc,
                                    int id)
                             throws ItemNotFoundException,
                                    PermissionDeniedException,
                                    BaseException
Get a Hybridization 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 Hybridization 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

getQuery

public static ItemQuery<Hybridization> getQuery()
Get a query that returns hybridizations.

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

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Get the labeled extracts and array slide. Note that this method will include all labeled extracts, even on multi-array hybridizations.

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

getProtocol

public Protocol getProtocol()
Get the protocol from the creation event.

Specified by:
getProtocol in interface Annotatable
Overrides:
getProtocol in class AnnotatedItem<HybridizationData>
Returns:
Always null
Since:
2.2

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

isUsed

public boolean isUsed()
               throws BaseException
Check that:

Overrides:
isUsed in class BasicItem<HybridizationData>
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()

getUsingItems

public Set<ItemProxy> getUsingItems()
Get all:

onBeforeCommit

void onBeforeCommit(Transactional.Action action)
              throws BaseException
Make sure the creation event is created at the same time this item is created and that source biomaterials get their used quantities back if this item is deleted. All events are deleted by cascade mapping in Hibernate.

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

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents(int arrayNum)
                                       throws BaseException
Get the labeled extracts, possible on a specific array, and the array slide.

Parameters:
arrayNum - If > 0 only include the labeled extracts which has been linked with BioMaterialEvent.setSourceGroup(MeasuredBioMaterial, int). If <= 0 include all labeled extracts.
Throws:
BaseException

getCreationEvent

public BioMaterialEvent getCreationEvent()
                                  throws PermissionDeniedException,
                                         BaseException
Get the event that represents the creation of this hybridization. Use this event to add source labeled extracts, a protocol, etc.

Returns:
A BioMaterialEvent data.
Throws:
PermissionDeniedException - If the logged in user don't have read permissions
BaseException - If there is another error.

setBioPlateEventParticipant

void setBioPlateEventParticipant(BioPlateEventParticipant bioPlateEventParticipant)

getArraySlide

public ArraySlide getArraySlide()
                         throws PermissionDeniedException,
                                BaseException
Get the ArraySlide this hyridization is using. A single slide can only be used on one hybridization.

Returns:
The ArraySlide item
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the array slide
BaseException - If there is another error.

setArraySlide

public void setArraySlide(ArraySlide arraySlide)
                   throws PermissionDeniedException
Set the ArraySlide this hybridization is using.

Parameters:
arraySlide - The array slide, or null
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for the hybridization or use permission for the array slide
BaseException - If there is another error.

getNumArrays

public int getNumArrays()
Get the number of arrays that on the slide. The default value is 1.

Since:
2.6

setNumArrays

public void setNumArrays(int numArrays)
Set the number of arrays on a single slide. The value should be between 1 and the number of arrays specified by the connected array design. The latter requiremed is not checked.

Parameters:
numArrays - A value > 0
Throws:
NumberOutOfRangeException - If the value is <=0
Since:
2.6

getLabeledExtracts

public ItemQuery<LabeledExtract> getLabeledExtracts(int arrayNum)
Get a query that returns labeled extracts connected to this hybridization.

Parameters:
arrayNum - If > 0 only labeled extracts on the specific sub-array are returned by the query, if <= 0, all labeled extracts are returned
Returns:
An ItemQuery object
Since:
2.6

newScan

public Scan newScan()
             throws PermissionDeniedException,
                    BaseException
Create a new Scan from this hybridization.

Returns:
The new Scan item
Throws:
PermissionDeniedException - If the logged in user doesn't have use permission for the hybridzation
BaseException - If there is another error

getScans

public ItemQuery<Scan> getScans()
Get a query that returns all scans created from this hybridization.

Returns:
An ItemQuery object

countScans

public long countScans()
                throws BaseException
Counts all scans that have been created from this hybridization. The count includes scans that the logged in user doesn't have access to.

Returns:
The number of scans
Throws:
BaseException - If the scans could not be counted.

2.17.2: 2011-06-17