edu.mayo.bsi.ngsportal.shared
Class SampleInfo

java.lang.Object
  extended by edu.mayo.bsi.ngsportal.shared.SampleInfo
All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable

public class SampleInfo
extends Object
implements com.google.gwt.user.client.rpc.IsSerializable

@author Gregory Dougherty


Constructor Summary
SampleInfo(int id, int sampleID, String name, String runName, String appType, String readType, int lane, int cycles, boolean isControl, boolean isIndexVendor, String indexSeq, String flowCell, String rlimsID, String sampleRLIMSID, String parentID, String captureKit, String rlimsProject, String species, String diseaseType, String[] fileLocation, long fileSize, String keepRequestor, Date keepDate, String dataFileName, boolean isCim, Boolean isBic)
          Normal Constructor
SampleInfo(int id, String sampleRLIMSID, String parentID, String species, String diseaseType)
          No Sequenced Sample Info Constructor
 
Method Summary
 void addNonPI(String nonPIName)
          Add a non-PI to the list of non-PIs for this sample
 void addPI(String piName)
          Add a PI to the list of PIs for this sample
 boolean equals(Object obj)
           
 String getAppType()
           
 String getCaptureKit()
           
 int getCycles()
           
 String getDataFileName()
           
 String getDiseaseType()
           
 String[] getFileLocation()
           
 String getFileLocationAsString()
          Take the array of 0 or more file locations, and turn it into a string
 long getFileSize()
           
 String getFlowCell()
           
static SampleInfo getFromListByID(List<SampleInfo> theList, int theID)
          Determines if theList contains a Sample that has the sampleID theID
static SampleInfo getFromListBySampleID(List<SampleInfo> theList, int theID)
          Determines if theList contains a Sample that has the sampleID theID
 int getID()
           
 String getIndexSeq()
           
 Date getKeepDate()
           
 String getKeepRequestor()
           
 int getLane()
           
 String getName()
           
 List<String> getNonPIs()
           
 String getParentID()
           
 List<String> getPIs()
           
 List<QCResult> getQCResult()
           
 String getReadType()
           
 String getRlimsID()
           
 String getRLIMSProject()
           
 String getRunName()
           
 int getSampleID()
           
 String getSampleRlimsID()
           
 String getSampleString()
          Get a String that uniquely identifies a Sample (w/o any Sequenced Sample information)
 String getSpecies()
           
 int hashCode()
           
 Boolean isBic()
           
 boolean isCim()
           
 boolean isControl()
           
 boolean isIndexVendor()
           
 boolean isInList(List<SampleInfo> theList)
          Determines if theList contains a Sample that has the same sampleID as this Sample
 boolean isQCPopulated()
           
static String makePI(String firstName, String lastName)
          Make a string representing a PI or non-PI
 boolean needsUpdate(String theSpecies, String theDiseaseType)
          Checks to see if any of the passed in values are meaningful and different from the existing values
 boolean needsUpdate(String theName, String theAppType, String theReadType, int theLane, int theCycles, String theRlimsID, String theCaptureKit, String theRLIMSProject, boolean newControl, boolean isVendor, String indexSequence, String theFlowCell, String theRunName, boolean isCIM, Boolean isBIC)
          Checks to see if any of the passed in values are meaningful and different from the existing values
static StringPair parsePI(String piName)
          Parse a string representing a PI or non-PI, and turn it into a first name and last name
 boolean removeNonPI(String piName)
          Remove a non-PI from the list of non-PIs for this sample
 boolean removePI(String piName)
          Remove a PI from the list of PIs for this sample
 boolean seqNeedsUpdate(String theCaptureKit, String theRLIMSProjectID)
          Checks to see if any of the passed in values are meaningful and different from the existing values
 void setID(int id)
           
 void setName(String name)
           
 void setParentID(String parentID)
           
 void setQCPopulated(boolean isQCPopulated)
           
 void setQCResult(List<QCResult> qcResult)
          Update the QC Result List.
 void setSampleID(int sampleID)
           
 void setSampleRlimsID(String sampleRLIMSID)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SampleInfo

public SampleInfo(int id,
                  int sampleID,
                  String name,
                  String runName,
                  String appType,
                  String readType,
                  int lane,
                  int cycles,
                  boolean isControl,
                  boolean isIndexVendor,
                  String indexSeq,
                  String flowCell,
                  String rlimsID,
                  String sampleRLIMSID,
                  String parentID,
                  String captureKit,
                  String rlimsProject,
                  String species,
                  String diseaseType,
                  String[] fileLocation,
                  long fileSize,
                  String keepRequestor,
                  Date keepDate,
                  String dataFileName,
                  boolean isCim,
                  Boolean isBic)
Normal Constructor

Parameters:
id - DB Row ID of the Sequenced Sample
sampleID - DB Row ID of the Sample
name - Name of the Sample
runName - Name of the Run
appType - Sequenced Sample application type
readType - Sequenced Sample read type
lane - Sequenced Sample lane
cycles - Sequenced Sample cycles
isControl - Was the Sequenced Sample a control
isIndexVendor - Was the Sequenced Sample's index from the Vendor
indexSeq - Sequenced Sample index, could be empty
flowCell - Sequenced Sample flow cell
rlimsID - Sequenced Sample RLIMS ID
sampleRLIMSID - Sample RLIMS Family ID, must never be empty or null
parentID - Sample RLIMS Parent ID, must never be empty or null
captureKit - The capture kit used to get the data
rlimsProject - The RLIMS Project the sample was sequenced as part of
species - Sample Species
diseaseType - Disease type of the sample, if any
fileLocation - Locations where associated data files are stored, if any
fileSize - Size of the Primary analysis data file, or 0 if none
keepRequestor - Person who requested the data files be kept, or null if no such request
keepDate - Date to keep Primary analysis files until, or null of not keeping files
dataFileName - Name of the data file that overrides the default data file name
isCim - True if sample was sequenced for CIM, false otherwise
isBic - True if was sequenced for BIC, false if not, NULL if not known

SampleInfo

public SampleInfo(int id,
                  String sampleRLIMSID,
                  String parentID,
                  String species,
                  String diseaseType)
No Sequenced Sample Info Constructor

Parameters:
id - DB Row ID of the Sample
sampleRLIMSID - Sample RLIMS Family ID, must never be empty or null
parentID - Sample RLIMS Parent ID, must never be empty or null
species - Sample Species
diseaseType - Disease type of the sample, if any
Method Detail

getFromListBySampleID

public static final SampleInfo getFromListBySampleID(List<SampleInfo> theList,
                                                     int theID)
Determines if theList contains a Sample that has the sampleID theID

Parameters:
theList - List to check. Will return null if list is null or empty
theID - Sample ID we're looking for
Returns:
The first matching sample if theList is not null, and has a matching sample in it, else null

getFromListByID

public static final SampleInfo getFromListByID(List<SampleInfo> theList,
                                               int theID)
Determines if theList contains a Sample that has the sampleID theID

Parameters:
theList - List to check. Will return null if list is null or empty
theID - ID we're looking for
Returns:
The first matching sample if theList is not null, and has a matching sample in it, else null

makePI

public static final String makePI(String firstName,
                                  String lastName)
Make a string representing a PI or non-PI

Parameters:
firstName - The person's first name. Will use "null" if null, "" if empty
lastName - The person's last name. Will use "null" if null, "" if empty
Returns:
String representing the person

parsePI

public static final StringPair parsePI(String piName)
Parse a string representing a PI or non-PI, and turn it into a first name and last name

Parameters:
piName - The person's last name. Will use "null" if null, "" if empty
Returns:
StringPair representing the person, never null, and neither name will be null

isInList

public boolean isInList(List<SampleInfo> theList)
Determines if theList contains a Sample that has the same sampleID as this Sample

Parameters:
theList - List to check. Will return false if list is null or empty
Returns:
True if theList is not null, and has a matching sample in it

needsUpdate

public boolean needsUpdate(String theSpecies,
                           String theDiseaseType)
Checks to see if any of the passed in values are meaningful and different from the existing values

Parameters:
theSpecies - The species of the sample
theDiseaseType - The diseaseType of the sample, or null if have nothing
Returns:
True if a passed in value was different, and the sample needs to be re-saved to the DB, else false

seqNeedsUpdate

public boolean seqNeedsUpdate(String theCaptureKit,
                              String theRLIMSProjectID)
Checks to see if any of the passed in values are meaningful and different from the existing values

Parameters:
theCaptureKit - The capture kit of the sample
theRLIMSProjectID - The RLIMS Project ID of the sample
Returns:
True if a passed in value was different, and the sample needs to be re-saved to the DB, else false

needsUpdate

public boolean needsUpdate(String theName,
                           String theAppType,
                           String theReadType,
                           int theLane,
                           int theCycles,
                           String theRlimsID,
                           String theCaptureKit,
                           String theRLIMSProject,
                           boolean newControl,
                           boolean isVendor,
                           String indexSequence,
                           String theFlowCell,
                           String theRunName,
                           boolean isCIM,
                           Boolean isBIC)
Checks to see if any of the passed in values are meaningful and different from the existing values

Parameters:
theName - The name of the sample
theAppType - The name of the type of sample
theReadType - The name of the read type
theLane - The lane number
theCycles - The number of cycles
theRlimsID - The value of the RLIMS ID
theCaptureKit - The Capture Kit used
theRLIMSProject - The RLIMS Project the sample was sequenced for
newControl - Whether the sample is a control
isVendor - Whether the sampleID is vendor supplied (only relevant if indexSequence is NOT null)
indexSequence - The sequence fragment tested (null if not an indexed sample)
theFlowCell - The flowCell the sequencing was done in
theRunName - The name of the run the sample belongs to
isCIM - True if was sequenced for CIM, false if not
isBIC - True if was sequenced for BIC, false if not, NULL if don't know
Returns:
True if a passed in value was different, and the sample needs to be re-saved to the DB, else false

getID

public final int getID()
Returns:
the id

setID

public final void setID(int id)
Parameters:
id - the id to set

getSampleID

public final int getSampleID()
Returns:
the sampleID

setSampleID

public final void setSampleID(int sampleID)
Parameters:
sampleID - the sampleID to set

getPIs

public final List<String> getPIs()
Returns:
the PIs. May be empty list, won't be null

addPI

public final void addPI(String piName)
Add a PI to the list of PIs for this sample

Parameters:
piName - The name of the PI, usually [Last], [First]

removePI

public final boolean removePI(String piName)
Remove a PI from the list of PIs for this sample

Parameters:
piName - The name of the PI, usually [Last], [First]
Returns:
True if had that PI, false if didn't

getNonPIs

public final List<String> getNonPIs()
Returns:
the non-PIs. May be empty list, won't be null

addNonPI

public final void addNonPI(String nonPIName)
Add a non-PI to the list of non-PIs for this sample

Parameters:
nonPIName - The name of the non-PI, usually [Last], [First]

removeNonPI

public final boolean removeNonPI(String piName)
Remove a non-PI from the list of non-PIs for this sample

Parameters:
piName - The name of the non-PI, usually [Last], [First]
Returns:
True if had that non-PI, false if didn't

getName

public final String getName()
Returns:
the name

setName

public final void setName(String name)
Parameters:
name - the name to set

getRunName

public final String getRunName()
Returns:
the runName

getAppType

public final String getAppType()
Returns:
the appType

getReadType

public final String getReadType()
Returns:
the readType

getLane

public final int getLane()
Returns:
the lane

getCycles

public final int getCycles()
Returns:
the cycles

isControl

public final boolean isControl()
Returns:
the isControl

isCim

public boolean isCim()
Returns:
True if sequenced for CIM, false otherwise

isBic

public Boolean isBic()
Returns:
True if sequenced for BIC, false if not, NULL if unknown

isIndexVendor

public final boolean isIndexVendor()
Returns:
the isIndexVendor

getIndexSeq

public final String getIndexSeq()
Returns:
the indexSeq

getFlowCell

public final String getFlowCell()
Returns:
the flowCell

getDataFileName

public final String getDataFileName()
Returns:
the dataFileName

getRlimsID

public final String getRlimsID()
Returns:
the rlimsID

getSampleRlimsID

public final String getSampleRlimsID()
Returns:
the sampleRLIMSID, Should never be empty or null

setSampleRlimsID

public final void setSampleRlimsID(String sampleRLIMSID)
Parameters:
sampleRLIMSID - the sampleRLIMSID to set

getParentID

public String getParentID()
Returns:
the parentID, Should never be empty or null

setParentID

public final void setParentID(String parentID)
Parameters:
parentID - the parentID to set

getCaptureKit

public final String getCaptureKit()
Returns:
the captureKit

getRLIMSProject

public final String getRLIMSProject()
Returns:
the rlimsProject

getSpecies

public final String getSpecies()
Returns:
the species

getDiseaseType

public final String getDiseaseType()
Returns:
the diseaseType

getFileLocation

public final String[] getFileLocation()
Returns:
the fileLocation

getFileLocationAsString

public final String getFileLocationAsString()
Take the array of 0 or more file locations, and turn it into a string

Returns:
A string. if no file locations, will be empty. If one file location, will be that file location. If more than one file location, will be returned as quoted strings separated by commas

getFileSize

public final long getFileSize()
Returns:
the fileSize

getKeepRequestor

public final String getKeepRequestor()
Returns:
the keepRequestor

getKeepDate

public final Date getKeepDate()
Returns:
the keepDate

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getSampleString

public String getSampleString()
Get a String that uniquely identifies a Sample (w/o any Sequenced Sample information)

Returns:
A String that uniquely identifies this sample: "[name] : [species] : [Sample RLIMS ID] : [Disease Type] : [PIs]"

getQCResult

public List<QCResult> getQCResult()
Returns:
List of QC Results

setQCResult

public void setQCResult(List<QCResult> qcResult)
Update the QC Result List. No error checking is done on the passed in data

Parameters:
qcResult - New List to use

isQCPopulated

public boolean isQCPopulated()
Returns:
True if isQCPopulated

setQCPopulated

public void setQCPopulated(boolean isQCPopulated)
Parameters:
isQCPopulated - New value for isQCPopulated