Package net.sf.basedb.core
Class ArrayDesign
- All Implemented Interfaces:
AccessControlled
,Annotatable
,FileStoreEnabled
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
An array design is a description of the design of a microarray
slide. An array design item is first created without any
Feature
information. A feature maps a coordinate on the array to a
Reporter
. Features can be added with links directly to
reporters, or to Well
s if the array design is associated
with a set of Plate
s.
Once features has been added to the array design, they cannot be removed or modified.
- Version:
- 2.0
- Author:
- Nicklas, Enell
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate FeatureBatcher
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 TypeMethodDescriptionAdds anArrayDesignBlock
to the array design.void
Adds a single plate to the plate list.Get the plates, if any.Get a query that returns the batches for this design.Get a query that returns the block of this array design.Get plate connections for this array design.static ArrayDesign
Get anArrayDesign
item when you know the ID.(package private) ArrayDesignData
getData()
Get theBasicData
object that holds all data for this item.Get the date that the item was registered in the database.getFeatureBatcher
(FeatureIdentificationMethod fiMethod, Job job) Get a feature batcher which can be used to add regular features to the array design.getFeatureById
(int id) Get a feature when you know the id.getFeatureById
(int id, boolean forceInitialization) Get a feature when you know the id.Get the method used to identify features on this array design.Get a query that returns the regular features of this array design.Get the file set that collects all files that holds data for this item.getJob()
Get the job that imported features to this array design.static ArrayDesign
Create a newArrayDesign
item for a given platform.static ArrayDesign
getNew
(DbControl dc, PlatformVariant variant) Create a newArrayDesign
item for a given platform variant.int
Get the number of arrays on a single slide.int
Get the number of features on this array design that are stored in the database.int
Get the number of features on this array design that are stored inside files.int
The number of plates connected to this array design.There are no parent file sets.getPlate
(int position) Get aPlate
from a given position.int
getPlatePosition
(Plate plate) Get the position of aPlate
in this array design.Get a query that returns the plates that are used by this arraydesign.Get the platform the item is related to.static ItemQuery<ArrayDesign>
getQuery()
Get aItemQuery
object configured to retrieve array designs.Get a query that returns the reporters on this array design.getType()
Get the type of item represented by the object.Get all:ArrayBatch
:s of this designRawBioAssay
:s of this designGet the platform variant the item is related to.boolean
Check if this array design has information about features, either in the database or in files.boolean
Check if this item has a file set.boolean
Check if this array design uses a file-only platform or variant.boolean
isPlatform
(String externalId) Check if the platform/variant of this array design has the given external ID.boolean
isUsed()
Check if this item is used by some other item.Create a newArrayBatch
with this design.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.void
setNumArrays
(int numArrays) Set the number of arrays on a single slide.void
setNumFileFeatures
(int numFeatures) Set the number of features that are stored in files.void
setPlateList
(List<Plate> plates) Set the list of plates to be used by this array design.void
setPlatform
(Platform platform) Set the platform of the array design.void
setVariant
(PlatformVariant variant) Set the platform and variant of the array design.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, onBeforeCommit, 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, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, 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:
-
featureBatcher
-
blocks
-
-
Constructor Details
-
ArrayDesign
ArrayDesign(ArrayDesignData arrayDesignData)
-
-
Method Details
-
getNew
Create a newArrayDesign
item for a given platform.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessplatform
- The platform of the array design- Returns:
- The new
ArrayDesign
item - Throws:
BaseException
- If there is an error- Since:
- 2.5
-
getNew
Create a newArrayDesign
item for a given platform variant.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessvariant
- The platform variant of the array design- Returns:
- The new
ArrayDesign
item - Throws:
BaseException
- If there is an error- Since:
- 2.5
-
getById
public static ArrayDesign getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get anArrayDesign
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
ArrayDesign
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 aItemQuery
object configured to retrieve array designs.- Returns:
- An
ItemQuery
object
-
getData
ArrayDesignData 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
-
getAnnotatableParents
Get the plates, if any.- Specified by:
getAnnotatableParents
in interfaceAnnotatable
- Returns:
- A set containing annotatable items, or null
- Throws:
BaseException
- If there is an error
-
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
- Since:
- 2.5
-
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
- Since:
- 2.5
-
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.
- Since:
- 2.5
-
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.
- Since:
- 2.5
-
getParentFileSets
There are no parent file sets.- Specified by:
getParentFileSets
in interfaceFileStoreEnabled
- Returns:
- Always null
- Since:
- 2.5
-
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
-
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:
-
getUsingItems
Get all:ArrayBatch
:s of this designRawBioAssay
:s of this design
- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- Since:
- 2.2
- See Also:
-
setPlatform
Set the platform of the array design. This method will set the variant to null. UsesetVariant(PlatformVariant)
if you want to set a specific variant.- Parameters:
platform
- The new platform- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If platform is null- Since:
- 2.5
-
setVariant
Set the platform and variant of the array design. This method will automatically set the platform toPlatformVariant.getPlatform()
.- Parameters:
variant
- The new platform variant, or null to remove the variant and keep the platform as it is- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission- Since:
- 2.5
-
isPlatform
Check if the platform/variant of this array design has the given external ID.- Parameters:
externalId
- The external ID to match- Returns:
- TRUE if either the variant of platform matches the external ID
- Since:
- 2.5
-
isFileOnlyPlatform
public boolean isFileOnlyPlatform()Check if this array design uses a file-only platform or variant. If the array design has a platform variant, the setting from the variant is returned, otherwise the setting from the platform.- Returns:
- TRUE if this array design use a file-only variant / platform
- Since:
- 2.5
-
getJob
Get the job that imported features to this array design.- Returns:
- A
Job
object, ot null if this information is not available - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the jobBaseException
- If there is another error- Since:
- 2.7
-
getNumArrays
public int getNumArrays()Get the number of arrays on a single slide. The default value is 1.- Since:
- 2.6
-
setNumArrays
public void setNumArrays(int numArrays) Set the number of arrays on a single slide.- Parameters:
numArrays
- A value > 0- Throws:
NumberOutOfRangeException
- If the value is <=0- Since:
- 2.6
-
hasFeatures
public boolean hasFeatures()Check if this array design has information about features, either in the database or in files.- Returns:
- TRUE if this object has features, FALSE otherwise
-
getFeatureIdentificationMethod
Get the method used to identify features on this array design.- Returns:
- A
FeatureIdentificationMethod
- Since:
- 2.6
-
getPlates
Get a query that returns the plates that are used by this arraydesign.- Returns:
- An
ItemQuery
object - Throws:
BaseException
- If something fails when getting the query.
-
getArrayDesignPlates
Get plate connections for this array design. This method has better performance than using thegetPlates()
andgetPlatePosition(Plate)
and/orgetPlate(int)
methods since it only requires a single query to the database.- Returns:
- An
ItemQuery
object
-
getPlatePosition
Get the position of aPlate
in this array design.- Parameters:
plate
- The plate.- Returns:
- The position of the plate. -1 if the array design doesn't contain this plate.
-
getPlate
Get aPlate
from a given position.- Parameters:
position
- The position of the plate, starting at 0- Returns:
- The plate or null if the position couldn't be found
-
getNumPlates
public int getNumPlates()The number of plates connected to this array design.- Returns:
- The number of plates.
-
setPlateList
Set the list of plates to be used by this array design. If the logged in user lacksPermission.USE
to any plate in the list no plates will be added.- Parameters:
plates
- A list of plates to replace the old list with. It may not contain nulls, but if the list is null or empty all plates will be removed.- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission to this ArrayDesign item orPermission.USE
permission to any plate item in the list or tries to add a plate to an arraydesign that has features.
-
addPlate
Adds a single plate to the plate list.- Parameters:
plate
- thePlate
item to be added to the list. It may be null.- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.WRITE
permission to this ArrayDesign item ,Permission.USE
permission to the plate item or tries to add a plate to an arraydesign that has features.
-
newArrayBatch
Create a newArrayBatch
with this design.- Returns:
- The new
ArrayBatch
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for this designBaseException
- If there is another error
-
getArrayBatches
Get a query that returns the batches for this design.- Returns:
- An
ItemQuery
object
-
addArrayDesignBlock
public ArrayDesignBlock addArrayDesignBlock(BlockInfo bi) throws PermissionDeniedException, BaseException Adds anArrayDesignBlock
to the array design. If the block already exists it is returned instead. Unlike other items, the block is automatically saved to the database. The reason is that otherwise we wouldn't be able to add features to the block since theFeatureBatcher
object requires that the block has an id.Use the
getFeatureBatcher(FeatureIdentificationMethod, Job)
method to get an batcher object that can add features to the new block.It is not possible to add blocks to an array design which uses a file-only platform. The must store feature information in files instead. See
Platform
andDataFileType
.- Parameters:
bi
- The information for the new block- Returns:
- The new
ArrayDesignBlock
- Throws:
PermissionDeniedException
- if the logged in user doesn't have write permission on the array designBaseException
- If there is another error
-
getFeatureBatcher
public FeatureBatcher getFeatureBatcher(FeatureIdentificationMethod fiMethod, Job job) throws PermissionDeniedException, BaseException Get a feature batcher which can be used to add regular features to the array design.It is not possible to add blocks to an array design which uses a file-only platform. The must store feature information in files instead. See
Platform
andDataFileType
.- Parameters:
fiMethod
- The method to use for identifying featuresjob
- The job that is currently running, or null if the feature import is not running as a job- Returns:
- The feature batcher of the array design. If this method is called multiple
times the
fiMethod
andjob
parameter is ignored and the same batcher as before is returned. - Throws:
PermissionDeniedException
- If raw data has already been added or the logged in user doesn't have write permissionBaseException
- If there is another error- Since:
- 2.7
-
getFeatures
Get a query that returns the regular features of this array design.- Returns:
- A
DataQuery
object
-
getReporters
Get a query that returns the reporters on this array design. The query is rooted at the features, which means that:- All filters, sorting, etc. that works for
getFeatures()
can be used without modifications on this query. - The same reporter may be returned multiple times if it is present on several features.
- 'Null' values may be returned if there are features without a reporter
- Returns:
- A
DataQuery
object - Since:
- 2.8
- All filters, sorting, etc. that works for
-
getFeatureById
Get a feature when you know the id. NOTE! This method may return an uninitialized proxy. If an initialized object is required usegetFeatureById(int, boolean)
instead.- Parameters:
id
- The id of the feature- Throws:
ItemNotFoundException
- If the feature could not be found.BaseException
- If something else fails when getting the feature.
-
getFeatureById
Get a feature when you know the id.- Parameters:
id
- The id of the featureforceInitialization
- If TRUE the feature and associated reporter are sure to be initialized- Throws:
ItemNotFoundException
- If the feature could not be found.BaseException
- If something else fails when getting the feature- Since:
- 2.15
-
getArrayDesignBlocks
Get a query that returns the block of this array design.- Returns:
- An
ItemQuery
object - See Also:
-
getNumDbFeatures
public int getNumDbFeatures()Get the number of features on this array design that are stored in the database.- Returns:
- The number of features or probesets
- Since:
- 2.5
-
getNumFileFeatures
public int getNumFileFeatures()Get the number of features on this array design that are stored inside files.- Returns:
- The number of features or probesets
- Since:
- 2.5
-
setNumFileFeatures
public void setNumFileFeatures(int numFeatures) Set the number of features that are stored in files.- Parameters:
numFeatures
- The number of features- Since:
- 2.5
-