Class ArrayDesign

All Implemented Interfaces:
AccessControlled, Annotatable, FileStoreEnabled, Identifiable, Nameable, Ownable, Registered, Removable, Shareable

public class ArrayDesign
extends AnnotatedItem
implements FileStoreEnabled, Registered
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 Wells if the array design is associated with a set of Plates.

Once features has been added to the array design, they cannot be removed or modified.

Version:
2.0
Author:
Nicklas, Enell
See Also:
ArrayBatch, ArraySlide, Plate, Feature, ArrayDesignBlock
  • Field Details

  • Constructor Details

  • Method Details

    • getNew

      public static ArrayDesign getNew​(DbControl dc, Platform platform)
      Create a new ArrayDesign item for a given platform.
      Parameters:
      dc - The DbControl which will be used for permission checking and database access
      platform - The platform of the array design
      Returns:
      The new ArrayDesign item
      Throws:
      BaseException - If there is an error
      Since:
      2.5
    • getNew

      public static ArrayDesign getNew​(DbControl dc, PlatformVariant variant)
      Create a new ArrayDesign item for a given platform variant.
      Parameters:
      dc - The DbControl which will be used for permission checking and database access
      variant - 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 an ArrayDesign 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 ArrayDesign 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<ArrayDesign> getQuery()
      Get a ItemQuery object configured to retrieve array designs.
      Returns:
      An ItemQuery object
    • getData

      ArrayDesignData getData()
      Description copied from class: BasicItem
      Get the BasicData object that holds all data for this item.
      Overrides:
      getData in class AnnotatedItem
    • 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 plates, if any.
      Specified by:
      getAnnotatableParents in interface Annotatable
      Returns:
      A set containing annotatable items, or null
      Throws:
      BaseException - If there is an error
    • 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
      Since:
      2.5
    • 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
      Since:
      2.5
    • 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.
      Since:
      2.5
    • 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.
      Since:
      2.5
    • getParentFileSets

      public Collection<FileSet> getParentFileSets()
      There are no parent file sets.
      Specified by:
      getParentFileSets in interface FileStoreEnabled
      Returns:
      Always null
      Since:
      2.5
    • 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
    • setEntryDate

      public void setEntryDate​(Date entryDate)
      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 interface Registered
      Parameters:
      entryDate - A date or null to use today's date
    • 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
      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:
      Overrides:
      getUsingItems in class BasicItem
      Returns:
      A set containing proxies for the items, or an empty set if no items are using this item
      Since:
      2.2
      See Also:
      BasicItem.addUsingItems(Set, Item, org.hibernate.query.Query)
    • setPlatform

      public void setPlatform​(Platform platform)
      Set the platform of the array design. This method will set the variant to null. Use setVariant(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 permission
      InvalidDataException - If platform is null
      Since:
      2.5
    • setVariant

      public void setVariant​(PlatformVariant variant)
      Set the platform and variant of the array design. This method will automatically set the platform to PlatformVariant.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

      public boolean isPlatform​(String externalId)
      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

      public Job getJob() throws PermissionDeniedException, BaseException
      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 job
      BaseException - 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

      public FeatureIdentificationMethod getFeatureIdentificationMethod()
      Get the method used to identify features on this array design.
      Returns:
      A FeatureIdentificationMethod
      Since:
      2.6
    • getPlates

      public ItemQuery<Plate> getPlates() throws BaseException
      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

      public ItemQuery<ArrayDesignPlate> getArrayDesignPlates()
      Get plate connections for this array design. This method has better performance than using the getPlates() and getPlatePosition(Plate) and/or getPlate(int) methods since it only requires a single query to the database.
      Returns:
      An ItemQuery object
    • getPlatePosition

      public int getPlatePosition​(Plate plate)
      Get the position of a Plate 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

      public Plate getPlate​(int position)
      Get a Plate 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

      public void setPlateList​(List<Plate> plates) throws PermissionDeniedException
      Set the list of plates to be used by this array design. If the logged in user lacks Permission.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 have Permission.WRITE permission to this ArrayDesign item or Permission.USE permission to any plate item in the list or tries to add a plate to an arraydesign that has features.
    • addPlate

      public void addPlate​(Plate plate) throws PermissionDeniedException
      Adds a single plate to the plate list.
      Parameters:
      plate - the Plate item to be added to the list. It may be null.
      Throws:
      PermissionDeniedException - If the logged in user doesn't have Permission.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

      public ArrayBatch newArrayBatch() throws PermissionDeniedException, BaseException
      Create a new ArrayBatch with this design.
      Returns:
      The new ArrayBatch item
      Throws:
      PermissionDeniedException - If the logged in user doesn't have use permission for this design
      BaseException - If there is another error
    • getArrayBatches

      public ItemQuery<ArrayBatch> 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 an ArrayDesignBlock 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 the FeatureBatcher 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 and DataFileType.

      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 design
      BaseException - 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 and DataFileType.

      Parameters:
      fiMethod - The method to use for identifying features
      job - 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 and job 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 permission
      BaseException - If there is another error
      Since:
      2.7
    • getFeatures

      public DataQuery<FeatureData> getFeatures()
      Get a query that returns the regular features of this array design.
      Returns:
      A DataQuery object
    • getReporters

      public DataQuery<ReporterData> 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
    • getFeatureById

      public FeatureData getFeatureById​(int id) throws ItemNotFoundException, BaseException
      Get a feature when you know the id. NOTE! This method may return an uninitialized proxy. If an initialized object is required use getFeatureById(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

      public FeatureData getFeatureById​(int id, boolean forceInitialization)
      Get a feature when you know the id.
      Parameters:
      id - The id of the feature
      forceInitialization - 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

      public ItemQuery<ArrayDesignBlock> getArrayDesignBlocks()
      Get a query that returns the block of this array design.
      Returns:
      An ItemQuery object
      See Also:
      ArrayDesignBlock.getQuery(ArrayDesign)
    • 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