Class ThreeWayData

  • All Implemented Interfaces:
    adams.core.CloneHandler, adams.core.Mergeable<adams.data.container.DataContainer>, adams.core.UniqueIDHandler, adams.data.container.DataContainer<L1Point>, adams.data.DatabaseNotesHandler, adams.data.id.DatabaseIDHandler, adams.data.id.IDHandler, adams.data.id.MutableIDHandler, adams.data.NotesHandler, adams.data.report.MutableReportHandler<ThreeWayReport>, adams.data.report.ReportHandler<ThreeWayReport>, adams.data.spreadsheet.SpreadSheetSupporter, adams.data.statistics.InformativeStatisticSupporter<ThreeWayDataStatistic>, Serializable, Comparable, Iterable<L1Point>, Collection<L1Point>

    public class ThreeWayData
    extends adams.data.container.AbstractDataContainer<L1Point>
    implements adams.data.DatabaseNotesHandler, adams.data.report.MutableReportHandler<ThreeWayReport>, adams.data.statistics.InformativeStatisticSupporter<ThreeWayDataStatistic>, adams.data.spreadsheet.SpreadSheetSupporter
    Stores 3-way data and associated meta-data.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static adams.data.container.DataPointComparator<L1Point> m_Comparator
      the default comparator.
      protected int m_DatabaseID
      database id.
      protected L1Point m_MaxX
      point of greatest X.
      protected L1Point m_MaxY
      point of greatest Y.
      protected L1Point m_MinX
      point of smallest X.
      protected L1Point m_MinY
      point of smallest Y.
      protected adams.data.Notes m_Notes
      the notes for the data structure.
      protected ThreeWayReport m_Reference
      'reference' values.
      • Fields inherited from class adams.data.container.AbstractDataContainer

        m_ID, m_Points, m_UUID
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assign​(adams.data.container.DataContainer<L1Point> other)
      Obtains the stored variables from the other data point, but not the actual data points.
      int compareToHeader​(Object o)
      Compares this object with the specified object for order.
      boolean equalsHeader​(Object obj)
      Indicates whether some other chromatogram's header is "equal to" this ones.
      L1Point find​(double x, double y)
      Returns the level 1 point with the exact X, null if not found.
      L1Point findClosest​(double x, double y)
      Returns the level 1 point with a X closest to the one provided.
      L2Point get​(double x, double y, double z)
      Returns the L2 point associated with the given x, y and z.
      gnu.trove.list.TDoubleList getAllData()
      Returns all unique data values.
      gnu.trove.list.TDoubleList getAllX()
      Returns all unique Xs.
      gnu.trove.list.TDoubleList getAllY()
      Returns all unique Ys.
      gnu.trove.list.TDoubleList getAllZ()
      Returns all unique Zs.
      adams.data.container.DataPointComparator<L1Point> getComparator()
      Returns the comparator in use.
      int getDatabaseID()
      Get database id.
      L1Point getMaxX()
      Get point with greatest timestamp.
      L1Point getMaxY()
      Get point with greatest abundance.
      L1Point getMinX()
      Get point with smallest Timestamp.
      L1Point getMinY()
      Get point with smallest abundance.
      adams.data.Notes getNotes()
      Returns the currently stored notes.
      ThreeWayReport getReport()
      Get the report (reference values).
      ThreeWayData getXSubset​(double x)
      Returns a data structure which contains only the given x values.
      int hashCode()
      Returns the hashcode.
      boolean hasReport()
      True if Quantitation Report exists for this chromatogram.
      protected void invalidateMinMax()
      Invalidates the min/max abundance/timestamp points.
      protected boolean modifiedListener​(boolean modified)
      Method that gets notified about changes in the collection of data points.
      adams.data.container.DataPointComparator<L1Point> newComparator()
      Returns a new instance of the default comparator.
      L1Point newPoint()
      Returns a new instance of a DataContainer point.
      void setDatabaseID​(int value)
      Set the database ID.
      void setID​(String value)
      Sets the ID of the chromatogram.
      void setReport​(ThreeWayReport value)
      Set the report (reference values).
      adams.data.spreadsheet.SpreadSheet toSpreadSheet()
      Returns the content as spreadsheet.
      ThreeWayDataStatistic toStatistic()
      Returns a statistic object of this data structure.
      String toString()
      Returns a short string representation of the chromatogram.
      protected void validateMinMax()
      Initializes the min/max abundance/timestmap points.
      • Methods inherited from class adams.data.container.AbstractDataContainer

        add, addAll, clear, compareTo, compareToData, contains, containsAll, ensureCapacity, equals, equalsData, getClone, getHeader, getID, getUniqueID, isEmpty, iterator, mergeWith, newInstance, remove, removeAll, retainAll, size, toArray, toArray, toList, toList, toTreeSet, toTreeSet, trimToSize
    • Field Detail

      • m_DatabaseID

        protected int m_DatabaseID
        database id.
      • m_Reference

        protected ThreeWayReport m_Reference
        'reference' values.
      • m_MaxY

        protected L1Point m_MaxY
        point of greatest Y.
      • m_MinY

        protected L1Point m_MinY
        point of smallest Y.
      • m_MaxX

        protected L1Point m_MaxX
        point of greatest X.
      • m_MinX

        protected L1Point m_MinX
        point of smallest X.
      • m_Notes

        protected adams.data.Notes m_Notes
        the notes for the data structure.
      • m_Comparator

        protected static adams.data.container.DataPointComparator<L1Point> m_Comparator
        the default comparator.
    • Constructor Detail

      • ThreeWayData

        public ThreeWayData()
        Initialise data.
      • ThreeWayData

        public ThreeWayData​(String id)
        Initialise data.
        Parameters:
        id - ID for data
    • Method Detail

      • newComparator

        public adams.data.container.DataPointComparator<L1Point> newComparator()
        Returns a new instance of the default comparator.
        Specified by:
        newComparator in interface adams.data.container.DataContainer<L1Point>
        Returns:
        the comparator instance
      • getComparator

        public adams.data.container.DataPointComparator<L1Point> getComparator()
        Returns the comparator in use.
        Specified by:
        getComparator in interface adams.data.container.DataContainer<L1Point>
        Returns:
        the comparator in use
      • newPoint

        public L1Point newPoint()
        Returns a new instance of a DataContainer point.
        Specified by:
        newPoint in interface adams.data.container.DataContainer<L1Point>
        Returns:
        the new DataContainer point
      • invalidateMinMax

        protected void invalidateMinMax()
        Invalidates the min/max abundance/timestamp points.
      • validateMinMax

        protected void validateMinMax()
        Initializes the min/max abundance/timestmap points.
      • setID

        public void setID​(String value)
        Sets the ID of the chromatogram.
        Specified by:
        setID in interface adams.data.id.MutableIDHandler
        Overrides:
        setID in class adams.data.container.AbstractDataContainer<L1Point>
        Parameters:
        value - the new ID
      • setDatabaseID

        public void setDatabaseID​(int value)
        Set the database ID.
        Parameters:
        value - Database ID
      • getDatabaseID

        public int getDatabaseID()
        Get database id.
        Specified by:
        getDatabaseID in interface adams.data.id.DatabaseIDHandler
        Returns:
        database ID
      • setReport

        public void setReport​(ThreeWayReport value)
        Set the report (reference values).
        Specified by:
        setReport in interface adams.data.report.MutableReportHandler<ThreeWayReport>
        Parameters:
        value - report
      • getReport

        public ThreeWayReport getReport()
        Get the report (reference values).
        Specified by:
        getReport in interface adams.data.report.ReportHandler<ThreeWayReport>
        Returns:
        report
      • hasReport

        public boolean hasReport()
        True if Quantitation Report exists for this chromatogram.
        Specified by:
        hasReport in interface adams.data.report.ReportHandler<ThreeWayReport>
        Returns:
        does this chromatogram have a Quantitation Report
      • getMaxY

        public L1Point getMaxY()
        Get point with greatest abundance.
        Returns:
        gc point
      • getMinY

        public L1Point getMinY()
        Get point with smallest abundance.
        Returns:
        gc point
      • getMaxX

        public L1Point getMaxX()
        Get point with greatest timestamp.
        Returns:
        gc point
      • getMinX

        public L1Point getMinX()
        Get point with smallest Timestamp.
        Returns:
        gc point
      • modifiedListener

        protected boolean modifiedListener​(boolean modified)
        Method that gets notified about changes in the collection of data points.
        Overrides:
        modifiedListener in class adams.data.container.AbstractDataContainer<L1Point>
        Parameters:
        modified - whether the action modified the collection
        Returns:
        the same as the input
      • find

        public L1Point find​(double x,
                            double y)
        Returns the level 1 point with the exact X, null if not found.
        Parameters:
        x - the X to look for
        y - the Y to look for
        Returns:
        the level 1 point or null if not found
        See Also:
        findClosest(double,double)
      • findClosest

        public L1Point findClosest​(double x,
                                   double y)
        Returns the level 1 point with a X closest to the one provided.
        Parameters:
        x - the X to look for
        Returns:
        the level 1 point
        See Also:
        find(double,double)
      • getXSubset

        public ThreeWayData getXSubset​(double x)
        Returns a data structure which contains only the given x values. Adds level 1 points with y=0 if a level 1 point does not contain the chosen x.
        Parameters:
        x - the x to look for
        Returns:
        the new data structure
      • assign

        public void assign​(adams.data.container.DataContainer<L1Point> other)
        Obtains the stored variables from the other data point, but not the actual data points.
        Specified by:
        assign in interface adams.data.container.DataContainer<L1Point>
        Overrides:
        assign in class adams.data.container.AbstractDataContainer<L1Point>
        Parameters:
        other - the data point to get the values from
      • compareToHeader

        public int compareToHeader​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Specified by:
        compareToHeader in interface adams.data.container.DataContainer<L1Point>
        Overrides:
        compareToHeader in class adams.data.container.AbstractDataContainer<L1Point>
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equalsHeader

        public boolean equalsHeader​(Object obj)
        Indicates whether some other chromatogram's header is "equal to" this ones.
        Specified by:
        equalsHeader in interface adams.data.container.DataContainer<L1Point>
        Overrides:
        equalsHeader in class adams.data.container.AbstractDataContainer<L1Point>
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Returns the hashcode. Just the hashcode of the toString()-generated string.
        Specified by:
        hashCode in interface Collection<L1Point>
        Overrides:
        hashCode in class adams.data.container.AbstractDataContainer<L1Point>
        Returns:
        the hashcode
      • toString

        public String toString()
        Returns a short string representation of the chromatogram.
        Overrides:
        toString in class adams.data.container.AbstractDataContainer<L1Point>
        Returns:
        a string representation
      • toStatistic

        public ThreeWayDataStatistic toStatistic()
        Returns a statistic object of this data structure.
        Specified by:
        toStatistic in interface adams.data.statistics.InformativeStatisticSupporter<ThreeWayDataStatistic>
        Returns:
        statistics about this data structure
      • getNotes

        public adams.data.Notes getNotes()
        Returns the currently stored notes.
        Specified by:
        getNotes in interface adams.data.NotesHandler
        Returns:
        the current notes
      • toSpreadSheet

        public adams.data.spreadsheet.SpreadSheet toSpreadSheet()
        Returns the content as spreadsheet.
        Specified by:
        toSpreadSheet in interface adams.data.spreadsheet.SpreadSheetSupporter
        Returns:
        the content
      • get

        public L2Point get​(double x,
                           double y,
                           double z)
        Returns the L2 point associated with the given x, y and z.
        Parameters:
        x - the X of the point to retrieve
        y - the Y of the point to retrieve
        z - the Z of the point to retrieve
        Returns:
        the point, null if not found for these coordinates
      • getAllX

        public gnu.trove.list.TDoubleList getAllX()
        Returns all unique Xs.
        Returns:
        the list of Xs
      • getAllY

        public gnu.trove.list.TDoubleList getAllY()
        Returns all unique Ys.
        Returns:
        the list of Ys
      • getAllZ

        public gnu.trove.list.TDoubleList getAllZ()
        Returns all unique Zs.
        Returns:
        the list of Zs
      • getAllData

        public gnu.trove.list.TDoubleList getAllData()
        Returns all unique data values.
        Returns:
        the list of data values