Class RemoteQBlastService

  • All Implemented Interfaces:
    RemotePairwiseAlignmentService

    public class RemoteQBlastService
    extends java.lang.Object
    implements RemotePairwiseAlignmentService
    RemoteQBlastService - A simple way of submitting BLAST request to the QBlast service at NCBI.

    NCBI provides a Blast server through a CGI-BIN interface. RemoteQBlastService simply encapsulates an access to it by giving users access to get/set methods to fix sequence, program and database as well as advanced options.

    The philosophy behind RemoteQBlastService is to disconnect submission of Blast requests from collection of Blast results. This is done so to allow a user to submit multiple Blast requests while allowing recovery of the reports at a later time.

    Presently, only blastall programs are accessible. blastpgp and megablast are high-priorities.

    Since:
    1.8
    Author:
    Sylvain Foisy, Diploide BioIT
    • Constructor Summary

      Constructors 
      Constructor Description
      RemoteQBlastService()
      The constructor for a QBlast service request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getAlignmentResults​(java.lang.String id, RemotePairwiseAlignmentOutputProperties rb)
      This method extracts the actual Blast report for this request ID.
      java.lang.String getEmail()
      Get the email for QBlast.
      java.lang.String getTool()
      Get the tool identifier for QBlast.
      boolean isReady​(java.lang.String id, long present)
      This method is used only for the executeBlastSearch method to check for completion of request using the NCBI specified RTOE variable
      void printRemoteBlastInfo()
      A simple method to check the availability of the QBlast service
      java.lang.String sendAlignmentRequest​(int gid, RemotePairwiseAlignmentProperties rpa)
      This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a GenBank GID.
      java.lang.String sendAlignmentRequest​(java.lang.String str, RemotePairwiseAlignmentProperties rpa)
      This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a string representing the sequence.
      java.lang.String sendAlignmentRequest​(RichSequence rs, RemotePairwiseAlignmentProperties rpa)
      This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a RichSequence.
      void setEmail​(java.lang.String email)
      Set the email for QBlast.
      void setTool​(java.lang.String tool)
      Set the tool identifier for QBlast.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • sendAlignmentRequest

        public java.lang.String sendAlignmentRequest​(java.lang.String str,
                                                     RemotePairwiseAlignmentProperties rpa)
                                              throws BioException
        This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a string representing the sequence. It gets the estimated time of completion by capturing the value of the RTOE variable and sets a loop that will check for completion of analysis at intervals specified by RTOE.

        It also capture the value for the RID variable, necessary for fetching the actual results after completion.

        Specified by:
        sendAlignmentRequest in interface RemotePairwiseAlignmentService
        Parameters:
        str - : a String with a sequence
        rpa - : a RemotePairwiseAlignmentProperties object
        Returns:
        rid : a String with the request ID for this sequence
        Throws:
        BioException - if it is not possible to sent the BLAST command
      • sendAlignmentRequest

        public java.lang.String sendAlignmentRequest​(RichSequence rs,
                                                     RemotePairwiseAlignmentProperties rpa)
                                              throws BioException
        This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a RichSequence. It gets the estimated time of completion by capturing the value of the RTOE variable and sets a loop that will check for completion of analysis at intervals specified by RTOE.

        It also capture the value for the RID variable, necessary for fetching the actual results after completion.

        Specified by:
        sendAlignmentRequest in interface RemotePairwiseAlignmentService
        Parameters:
        rs - :a RichSequence object
        rpa - :a RemotePairwiseAlignmentProperties object
        Returns:
        rid : a String with the request ID for this sequence
        Throws:
        BioException - if it is not possible to sent the BLAST command
      • sendAlignmentRequest

        public java.lang.String sendAlignmentRequest​(int gid,
                                                     RemotePairwiseAlignmentProperties rpa)
                                              throws BioException
        This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a GenBank GID. It gets the estimated time of completion by capturing the value of the RTOE variable and sets a loop that will check for completion of analysis at intervals specified by RTOE.

        It also capture the value for the RID variable, necessary for fetching the actual results after completion.

        Parameters:
        gid - :an integer with a Genbank GID
        rpa - :a RemotePairwiseAlignmentProperties object
        Returns:
        rid : a String with the request ID for this sequence
        Throws:
        BioException - if it is not possible to sent the BLAST command
      • isReady

        public boolean isReady​(java.lang.String id,
                               long present)
                        throws BioException

        This method is used only for the executeBlastSearch method to check for completion of request using the NCBI specified RTOE variable

        Specified by:
        isReady in interface RemotePairwiseAlignmentService
        Parameters:
        id - : a valid request ID
        present - : a representation of "now" using System.currentTimeMillis().
        Returns:
        a boolean value telling if the request has been completed or not.
        Throws:
        BioException - if the ID does not exist.
      • getAlignmentResults

        public java.io.InputStream getAlignmentResults​(java.lang.String id,
                                                       RemotePairwiseAlignmentOutputProperties rb)
                                                throws BioException

        This method extracts the actual Blast report for this request ID. It uses an object implementing the RemotePairwiseAlignmentOutputProperties interface which will specify output formatting options.

        Specified by:
        getAlignmentResults in interface RemotePairwiseAlignmentService
        Parameters:
        id - :a valid request ID
        rb - : a RemotePairwiseAlignmentOutputProperties that will specify specific output formatting commands
        Returns:
        an InputStream that can be use any way one might desire
        Throws:
        BioException - if it is not possible to recover the results.
      • setTool

        public void setTool​(java.lang.String tool)
        Set the tool identifier for QBlast. Defaults to 'biojavax'.
        Parameters:
        tool - the new identifier.
      • getTool

        public java.lang.String getTool()
        Get the tool identifier for QBlast. Defaults to 'biojavax'.
        Returns:
        the identifier.
      • setEmail

        public void setEmail​(java.lang.String email)
        Set the email for QBlast. Defaults to 'anonymous@biojava.org'.
        Parameters:
        email - the new email.
      • getEmail

        public java.lang.String getEmail()
        Get the email for QBlast. Defaults to 'anonymous@biojava.org'.
        Returns:
        the email.