Class DerivedBioAssay

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

public class DerivedBioAssay extends AnnotatedItem implements Registered, FileStoreEnabled, Subtypable, Listable
Since:
3.0
Author:
Nicklas
Last modified
$Date: 2021-03-26 08:26:24 +0100 (Fri, 26 Mar 2021) $
  • Field Details

    • TYPE

      public static final Item TYPE
      The type of item represented by this class.
      See Also:
    • SCAN

      public static final String SCAN
      The id for the DerivedBioAssayType item representing a scanned hybridization.
      See Also:
    • SEQUENCES

      public static final String SEQUENCES
      The id for the DerivedBioAssayType item representing original sequenced data.
      See Also:
    • 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:
    • extractHasBeenSet

      private boolean extractHasBeenSet
    • protocolHasBeenSet

      private boolean protocolHasBeenSet
    • hardwareHasBeenSet

      private boolean hardwareHasBeenSet
    • softwareHasBeenSet

      private boolean softwareHasBeenSet
  • Constructor Details

  • Method Details

    • getById

      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, boolean isRoot, Job job)
      Create a new parent-less derived bioassay. Parent items can be added by calling addPhysicalBioAssay(PhysicalBioAssay) or addParent(DerivedBioAssay).
      Parameters:
      dc - The DbControl which will be used for permission checking and database access
      isRoot - TRUE if the new item is a root derived bioassay (eg. it have physical bioassays as parent items)
      job - The job that created the new bioassay
      Returns:
      A new DerivedBioAssay item
      Since:
      3.2
    • 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
    • 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
    • getUsingItems

      public Set<ItemProxy> getUsingItems()
      Get all:
      • Child derived bioassays
      • Child raw bioassays
      Overrides:
      getUsingItems in class BasicItem
      Returns:
      A set containing proxies for the items, or an empty set if no items are using this item
      See Also:
    • 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:
    • breakCircularReferences

      int breakCircularReferences(Set<ItemProxy> items)
      Any parent bioassays found among the given items are removed from this item. NOTE! Due to DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction it should not be possible to create circular references between derived bioassays, but in case something changes in the future we have implemented this method anyway.
      Overrides:
      breakCircularReferences in class BasicItem
      Since:
      3.8
    • onBeforeCommit

      void onBeforeCommit(Transactional.Action action)
      Automatically try to assign an extract from parent items at creation time.
      Overrides:
      onBeforeCommit in class SharedItem
      See Also:
    • setProjectDefaults

      void setProjectDefaults(Project activeProject) throws BaseException
      Set protocol, hardware and software from project default settings.
      Overrides:
      setProjectDefaults in class BasicItem
      Parameters:
      activeProject - The currently active project
      Throws:
      BaseException
    • getAnnotatableParents

      public Set<Annotatable> getAnnotatableParents() throws BaseException
      Get the extract and parent bioassays or physical bioassays.
      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
      Returns:
      Always null
    • 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:
    • 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:
    • 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
    • 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
    • testFixChildren

      public void testFixChildren()
    • addPhysicalBioAssay

      public void addPhysicalBioAssay(PhysicalBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException
      Add a physical bioassay as a parent to this derived bioassay. Note! Physical bioassays can only be added if this derived bioassay is a root bioassay. The physical bioassay for non-root derived bioassays are automatically assigned.
      Parameters:
      bioAssay - The parent bioassay to add
      Throws:
      PermissionDeniedException
      InvalidDataException
      Since:
      3.2
    • removePhysicalBioAssay

      public void removePhysicalBioAssay(PhysicalBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException
      Remove a physical bioassay as a parent item for this derived bioassay. Note! Physical bioassays can only be removed if this derived bioassay is a root bioassay. The physical bioassay for non-root derived bioassays are automatically assigned.
      Parameters:
      bioAssay - The parent bioassay to remove from this bioassay
      Throws:
      PermissionDeniedException
      InvalidDataException
      Since:
      3.2
    • getPhysicalBioAssays

      public ItemQuery<PhysicalBioAssay> getPhysicalBioAssays()
      Get a query that returns the physical bioassays used to create this derived bioassay.
      Returns:
      An ItemQuery object
      Since:
      3.2
    • addParent

      public void addParent(DerivedBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException
      Add a derived bioassay as a parent to this derived bioassay. Note! Derived bioassays can only be added if this derived bioassay is not a root bioassay. The physical bioassays are automatically assigned.
      Parameters:
      bioAssay - The parent bioassay to add
      Throws:
      PermissionDeniedException
      InvalidDataException
      Since:
      3.2
    • removeParent

      public void removeParent(DerivedBioAssay bioAssay) throws PermissionDeniedException, InvalidDataException
      Remove a derived bioassay as a parent item for this derived bioassay. Note! Derived bioassays can only be used as parents if this derived bioassay is not a root bioassay. The physical bioassays are automatically assigned.
      Parameters:
      bioAssay - The parent bioassay to remove from this bioassay
      Throws:
      PermissionDeniedException
      InvalidDataException
      Since:
      3.2
    • getParents

      public ItemQuery<DerivedBioAssay> getParents()
      Get all parent derived bioassays.
      Returns:
      A query returning all parent bioassays
      Since:
      3.2
    • isRoot

      public boolean isRoot()
      Check if this bioassay set is derived from one or more physical bioassays or from derived bioassays. A root derived bioassay can only have physical bioassays as parent items. A non-root derived bioassay can only have other derived bioassays as parents, but the core keep automatically keep track of the physical bioassays.
      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
    • setJob

      public void setJob(Job job) throws PermissionDeniedException
      Set the job on this derived bioassay that was used to create or import data for it.
      Parameters:
      job - The job or null to clear the existing job
      Throws:
      PermissionDeniedException - If the logged in user doesn't have write permission
      Since:
      3.18.1
    • 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
    • getKit

      public Kit getKit() throws PermissionDeniedException, BaseException
      Get the Kit that was used when creating this bioassay.
      Returns:
      A Kit item, or null if not known
      Throws:
      PermissionDeniedException - If the logged in user doesn't have read permission to the kit
      BaseException - If there is another error
      Since:
      3.7
    • setKit

      public void setKit(Kit kit) throws PermissionDeniedException
      Set the Kit that was used when creating this bioassay.
      Parameters:
      kit - A Kit 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 kit
      Since:
      3.7
    • 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. If this derived bioasay has multiple parents that are linked to different array designs, null is returned.
      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.