Last update: 2011-06-23

org.proteios.io
Class RobotFileImpl

java.lang.Object
  extended by org.proteios.io.RobotFileImpl
All Implemented Interfaces:
FileValidationInterface, RobotFileInterface

public class RobotFileImpl
extends Object
implements RobotFileInterface, FileValidationInterface

This class implements the RobotFileInterface that defines methods to retrieve data from a Spot Handling Workstation robot file.

Author:
olle

Constructor Summary
RobotFileImpl()
          Default constructor.
RobotFileImpl(File inputFile)
          Constructor that takes a proteios File as parameter.
RobotFileImpl(InputStream xmlInputStream)
          Constructor that takes a robot XML input stream as parameter.
 
Method Summary
 List<String> getGelIdFromMicroPlate(List<String> plateIds, List<String> wellIds)
          Get list of gel ids for specified well and plate ids.
 String getGelIdFromMicroPlate(String plateId, String wellId)
          Get gel id for specified well and plate id.
 List<String> getGelIdFromTargetPlate(List<String> targetIds, List<String> positionIds)
          Get list of target gel ids for specified target ids and target position (well) ids.
 String getGelIdFromTargetPlate(String targetId, String positionId)
          Get target gel id for specified target id and target position (well) id.
 List<String> getGelIdList()
          Get gel ids.
 List<String> getPlateIdFromMicroPlate(List<String> spotIds, List<String> gelIds)
          Get list of plate ids for specified spot ids and gel ids.
 String getPlateIdFromMicroPlate(String spotId, String gelId)
          Get plate id for specified spot id and gel id.
 String getPlateIdFromTargetPlate(String microtitrePlateId, String microtitrePlatePos)
          Get target plate id for a microtitre plate id and position.
 List<String> getPlateIdListFromMicroPlate()
          Get plate ids.
 String getPlatePosFromTargetPlate(String microtitrePlateId, String microtitrePlatePos)
          Get target plate position for a microtitre plate id and position.
 List<String> getPositionIdFromTargetPlate(List<String> spotIds, List<String> gelIds)
          Get list of target position ids for specified target spot ids and gel ids.
 String getPositionIdFromTargetPlate(String spotId, String gelId)
          Get target position id for specified target spot id and gel id.
 List<String> getSpotIdFromMicroPlate(List<String> plateIds, List<String> wellIds)
          Get list of spot ids for specified well and plate ids.
 String getSpotIdFromMicroPlate(String plateId, String wellId)
          Get spot id for specified well and plate id.
 List<String> getSpotIdFromTargetPlate(List<String> targetIds, List<String> positionIds)
          Get list of target spot ids for specified target ids and target position (well) ids.
 String getSpotIdFromTargetPlate(String targetId, String positionId)
          Get target spot id for specified target id and target position (well) id.
 List<String> getSpotIdListFromMicroPlate(String gelId)
          Get spot ids for given gel id.
 List<String> getTargetIdFromTargetPlate(List<String> spotIds, List<String> gelIds)
          Get list of target ids for specified target spot ids and gel ids.
 String getTargetIdFromTargetPlate(String spotId, String gelId)
          Get target id for specified target spot id and gel id.
 List<String> getTargetIdListFromTargetPlate()
          Get target ids.
 List<String> getTargetPlateIdFromTargetPlate(List<String> targetIds, List<String> positionIds)
          Get list of target plate ids for specified target ids and target position (well) ids.
 String getTargetPlateIdFromTargetPlate(String targetId, String positionId)
          Get target plate id for specified target id and target position (well) id.
 String getTargetPositionExampleFromTargetPlate()
          Get target position example from input stream.
 String getWellIdExampleFromMicroPlate()
          Get well id example from input stream.
 List<String> getWellIdFromMicroPlate(List<String> spotIds, List<String> gelIds)
          Get list of well ids for specified spot ids and gel ids.
 String getWellIdFromMicroPlate(String spotId, String gelId)
          Get well id for specified spot id and gel id.
 InputStream getXMLInputStream()
          Get robot XML input stream.
 String getXsdFilePath()
          Get XSD schema file to validate against.
 boolean importable()
          Validates first element of input stream.
 void setXMLInputStream(InputStream xmlInputStream)
          Set robot XML input stream.
 void setXsdFilePath(String xsdFilePath)
          Set XSD schema file to validate against.
 boolean valid()
          Validates spot picker XML input stream against current XSD file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RobotFileImpl

public RobotFileImpl()
Default constructor.


RobotFileImpl

public RobotFileImpl(File inputFile)
Constructor that takes a proteios File as parameter. If this constructor is used, the file will always be read from the beginning when the public functions are called.

Parameters:
inputFile - InputFile robot XML File.

RobotFileImpl

public RobotFileImpl(InputStream xmlInputStream)
Constructor that takes a robot XML input stream as parameter. If this constructor is used the stream will not be reset automatically between calls to public functions

Parameters:
xmlInputStream - InputStream robot XML input stream.
Method Detail

getXMLInputStream

public InputStream getXMLInputStream()
Get robot XML input stream. If a input file was given a new stream positioned at the file start is generated.

Returns:
xmlFilePath InputStream robot XML input stream.

setXMLInputStream

public void setXMLInputStream(InputStream xmlInputStream)
Set robot XML input stream.

Parameters:
xmlInputStream - InputStream robot XML input stream.

getXsdFilePath

public String getXsdFilePath()
Get XSD schema file to validate against.

Returns:
xsdFilePath String with path for XSD schema file.

setXsdFilePath

public void setXsdFilePath(String xsdFilePath)
Set XSD schema file to validate against.

Parameters:
xsdFilePath - String with path for XSD schema file.

valid

public boolean valid()
              throws javax.xml.stream.XMLStreamException,
                     SAXException
Validates spot picker XML input stream against current XSD file.

Specified by:
valid in interface FileValidationInterface
Returns:
True if the mzData XML input stream is valid, else false
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error
SAXException

importable

public boolean importable()
Validates first element of input stream.

Specified by:
importable in interface FileValidationInterface
Returns:
True if the input stream is valid, else false

getWellIdExampleFromMicroPlate

public String getWellIdExampleFromMicroPlate()
Get well id example from input stream. Intended to be used for conversion of well id data to local well id notation.

Returns:
String well id example or null if not found

getTargetPositionExampleFromTargetPlate

public String getTargetPositionExampleFromTargetPlate()
Get target position example from input stream. Intended to be used for conversion of target position data to local target position notation.

Returns:
String target position example or null if not found

getSpotIdFromMicroPlate

public String getSpotIdFromMicroPlate(String plateId,
                                      String wellId)
Get spot id for specified well and plate id.

Specified by:
getSpotIdFromMicroPlate in interface RobotFileInterface
Parameters:
plateId - String plate id
wellId - String well id
Returns:
String spot id or null if plateId and wellId was not found

getSpotIdFromMicroPlate

public List<String> getSpotIdFromMicroPlate(List<String> plateIds,
                                            List<String> wellIds)
Get list of spot ids for specified well and plate ids.

Specified by:
getSpotIdFromMicroPlate in interface RobotFileInterface
Parameters:
plateIds - List list of plate ids.
wellIds - List list of well ids.
Returns:
List list of spot ids or null if plateIds and wellIds was not found

getGelIdFromMicroPlate

public String getGelIdFromMicroPlate(String plateId,
                                     String wellId)
Get gel id for specified well and plate id.

Specified by:
getGelIdFromMicroPlate in interface RobotFileInterface
Parameters:
plateId - String plate id
wellId - String well id
Returns:
String gel id or null if plateId and wellId was not found

getGelIdFromMicroPlate

public List<String> getGelIdFromMicroPlate(List<String> plateIds,
                                           List<String> wellIds)
Get list of gel ids for specified well and plate ids.

Specified by:
getGelIdFromMicroPlate in interface RobotFileInterface
Parameters:
plateIds - List list of plate ids.
wellIds - List list of well ids.
Returns:
List list of gel ids or null if plateIds and wellIds was not found

getWellIdFromMicroPlate

public String getWellIdFromMicroPlate(String spotId,
                                      String gelId)
Get well id for specified spot id and gel id.

Specified by:
getWellIdFromMicroPlate in interface RobotFileInterface
Parameters:
spotId - String spot id
gelId - String gel id
Returns:
String well id from spot id and gel id

getWellIdFromMicroPlate

public List<String> getWellIdFromMicroPlate(List<String> spotIds,
                                            List<String> gelIds)
Get list of well ids for specified spot ids and gel ids.

Specified by:
getWellIdFromMicroPlate in interface RobotFileInterface
Parameters:
spotIds - List list of spot ids.
gelIds - List list of gel ids.
Returns:
List list of well ids from list of spot ids and gel ids.

getPlateIdFromMicroPlate

public String getPlateIdFromMicroPlate(String spotId,
                                       String gelId)
Get plate id for specified spot id and gel id.

Specified by:
getPlateIdFromMicroPlate in interface RobotFileInterface
Parameters:
spotId - String spot id
gelId - String gel id
Returns:
String plate id from spot id and gel id.

getPlateIdFromMicroPlate

public List<String> getPlateIdFromMicroPlate(List<String> spotIds,
                                             List<String> gelIds)
Get list of plate ids for specified spot ids and gel ids.

Specified by:
getPlateIdFromMicroPlate in interface RobotFileInterface
Parameters:
spotIds - List list of spot ids.
gelIds - List list of gel ids.
Returns:
List list of plate ids from list of spot ids and gel ids.

getSpotIdFromTargetPlate

public String getSpotIdFromTargetPlate(String targetId,
                                       String positionId)
Get target spot id for specified target id and target position (well) id.

Specified by:
getSpotIdFromTargetPlate in interface RobotFileInterface
Parameters:
targetId - String target id
positionId - String target position id
Returns:
String target spot id or null if targetId and target positionId was not found

getSpotIdFromTargetPlate

public List<String> getSpotIdFromTargetPlate(List<String> targetIds,
                                             List<String> positionIds)
Get list of target spot ids for specified target ids and target position (well) ids.

Specified by:
getSpotIdFromTargetPlate in interface RobotFileInterface
Parameters:
targetIds - List list of target ids.
positionIds - List list of target position ids.
Returns:
List list of target spot ids or null if targetIds and target positionIds was not found

getGelIdFromTargetPlate

public String getGelIdFromTargetPlate(String targetId,
                                      String positionId)
Get target gel id for specified target id and target position (well) id.

Specified by:
getGelIdFromTargetPlate in interface RobotFileInterface
Parameters:
targetId - String target id
positionId - String target position id
Returns:
String target gel id or null if targetId and target positionId was not found

getGelIdFromTargetPlate

public List<String> getGelIdFromTargetPlate(List<String> targetIds,
                                            List<String> positionIds)
Get list of target gel ids for specified target ids and target position (well) ids.

Specified by:
getGelIdFromTargetPlate in interface RobotFileInterface
Parameters:
targetIds - List list of target ids.
positionIds - List list of target position ids.
Returns:
List list of target gel ids or null if targetIds and target positionIds was not found

getTargetPlateIdFromTargetPlate

public String getTargetPlateIdFromTargetPlate(String targetId,
                                              String positionId)
Get target plate id for specified target id and target position (well) id.

Specified by:
getTargetPlateIdFromTargetPlate in interface RobotFileInterface
Parameters:
targetId - String target id
positionId - String target position id
Returns:
String target plate id or null if targetId and target positionId was not found

getTargetPlateIdFromTargetPlate

public List<String> getTargetPlateIdFromTargetPlate(List<String> targetIds,
                                                    List<String> positionIds)
Get list of target plate ids for specified target ids and target position (well) ids.

Specified by:
getTargetPlateIdFromTargetPlate in interface RobotFileInterface
Parameters:
targetIds - List list of target ids.
positionIds - List list of target position ids.
Returns:
List list of target plate ids or null if targetIds and target positionIds was not found

getPositionIdFromTargetPlate

public String getPositionIdFromTargetPlate(String spotId,
                                           String gelId)
Get target position id for specified target spot id and gel id.

Specified by:
getPositionIdFromTargetPlate in interface RobotFileInterface
Parameters:
spotId - String target spot id
gelId - String target gel id
Returns:
String target position id from target spot id and gel id

getPositionIdFromTargetPlate

public List<String> getPositionIdFromTargetPlate(List<String> spotIds,
                                                 List<String> gelIds)
Get list of target position ids for specified target spot ids and gel ids.

Specified by:
getPositionIdFromTargetPlate in interface RobotFileInterface
Parameters:
spotIds - List list of target spot ids.
gelIds - List list of target gel ids.
Returns:
List list of target position ids from list of target spot ids and gel ids.

getTargetIdFromTargetPlate

public String getTargetIdFromTargetPlate(String spotId,
                                         String gelId)
Get target id for specified target spot id and gel id.

Specified by:
getTargetIdFromTargetPlate in interface RobotFileInterface
Parameters:
spotId - String target spot id
gelId - String target gel id
Returns:
String target id from target spot id and gel id

getTargetIdFromTargetPlate

public List<String> getTargetIdFromTargetPlate(List<String> spotIds,
                                               List<String> gelIds)
Get list of target ids for specified target spot ids and gel ids.

Specified by:
getTargetIdFromTargetPlate in interface RobotFileInterface
Parameters:
spotIds - List list of target spot ids.
gelIds - List list of target gel ids.
Returns:
List list of target ids from list of target spot ids and gel ids.

getPlateIdListFromMicroPlate

public List<String> getPlateIdListFromMicroPlate()
Get plate ids.

Specified by:
getPlateIdListFromMicroPlate in interface RobotFileInterface
Returns:
List list with plate ids.

getTargetIdListFromTargetPlate

public List<String> getTargetIdListFromTargetPlate()
Get target ids.

Specified by:
getTargetIdListFromTargetPlate in interface RobotFileInterface
Returns:
List list with target ids.

getGelIdList

public List<String> getGelIdList()
Get gel ids.

Specified by:
getGelIdList in interface RobotFileInterface
Returns:
List list with gel ids.

getSpotIdListFromMicroPlate

public List<String> getSpotIdListFromMicroPlate(String gelId)
Get spot ids for given gel id.

Specified by:
getSpotIdListFromMicroPlate in interface RobotFileInterface
Parameters:
gelId -
Returns:
List list with spot ids.

getPlateIdFromTargetPlate

public String getPlateIdFromTargetPlate(String microtitrePlateId,
                                        String microtitrePlatePos)
Get target plate id for a microtitre plate id and position. Representing spotting.

Parameters:
microtitrePlateId - The source microtitre plate
microtitrePlatePos - The position in the source microtitre plate
Returns:
String The Id of the target plate spotted to.

getPlatePosFromTargetPlate

public String getPlatePosFromTargetPlate(String microtitrePlateId,
                                         String microtitrePlatePos)
Get target plate position for a microtitre plate id and position. Representing spotting. Call this function after getPlateIdFromTargetPlate to avoid reading of the file again

Parameters:
microtitrePlateId - The source microtitre plate
microtitrePlatePos - The position in the source microtitre plate
Returns:
String The position on the target plate spotted to.

Last update: 2011-06-23