Class GenpeptRichSequenceDB

    • Field Detail

      • urlBatchSequences

        protected static final java.lang.String urlBatchSequences
        See Also:
        Constant Field Values
    • Constructor Detail

      • GenpeptRichSequenceDB

        public GenpeptRichSequenceDB()
        The default constructor delegates to the parent class. The constructor refers to RichObjectFactory.getDefaultNamespace() so make sure your factory is initialised before calling this constructor. Sets the default factory to THRESHOLD.
    • Method Detail

      • getAddress

        protected java.net.URL getAddress​(java.lang.String id)
                                   throws java.net.MalformedURLException
        Get the URL object for locating sequence object using eutils. The default value of the return format of the sequence object is text.
        Throws:
        java.net.MalformedURLException
      • makeBatchRequest

        protected java.lang.String makeBatchRequest​(java.net.URL url,
                                                    java.util.Set list)
        Create the Http Post Request to fetch (in batch mode) a list of sequence with Genbank.
        Parameters:
        url - URL of the request
        list - List of sequence identifier
        Returns:
        The Post request.
      • getRichSequence

        public RichSequence getRichSequence​(java.lang.String id)
                                     throws BioException,
                                            IllegalIDException
        Given the appropriate Genbank ID, return the matching RichSequence object.
        Specified by:
        getRichSequence in interface RichSequenceDBLite
        Parameters:
        id - the Genbank ID to retrieve.
        Returns:
        the matching RichSequence object, or null if not found.
        Throws:
        java.lang.Exception - if the sequence could not be retrieved for reasons other than the identifier not being found.
        IllegalIDException - if the database doesn't know about the id
        BioException
      • getRichSequence

        public RichSequence getRichSequence​(java.lang.String id,
                                            Namespace nsp)
                                     throws BioException,
                                            IllegalIDException
        Given the appropriate Genbank ID, return the matching RichSequence object. Additionally define a new Namespace for the received RichSequence object.
        Parameters:
        id - the Genbank ID to retrieve.
        nsp - the Namespace to define.
        Returns:
        the matching RichSequence object, or null if not found.
        Throws:
        java.lang.Exception - if the sequence could not be retrieved for reasons other than the identifier not being found.
        BioException
        IllegalIDException
      • getRichSequences

        public RichSequenceDB getRichSequences​(java.util.Set list)
                                        throws BioException,
                                               IllegalIDException
        Retrieve rich sequences from a Genbank
        Specified by:
        getRichSequences in interface RichSequenceDBLite
        Parameters:
        list - List of NCBI sequence number (GI), accession, accession.version, fasta or seqid.
        Returns:
        The rich database object (HashSequenceDB) with downloaded rich sequences. You will need to cast the sequences you get from this database object into RichSequence objects if you want to access their full features.
        Throws:
        IllegalIDException - if the database doesn't know about the id
        BioException
      • getRichSequences

        public RichSequenceDB getRichSequences​(java.util.Set list,
                                               RichSequenceDB database)
                                        throws BioException,
                                               IllegalIDException
        Retrieve rich sequences from a Genbank
        Specified by:
        getRichSequences in interface RichSequenceDBLite
        Parameters:
        list - List of NCBI sequence number (GI), accession, accession.version, fasta or seqid.
        database - Where to store rich sequences. If database is null, use an HashSequenceDB Object.
        Returns:
        The database object with downloaded rich sequences. You will need to cast the sequences you get from this database object into RichSequence objects if you want to access their full features.
        Throws:
        IllegalIDException - if the database doesn't know about the id
        BioException
      • getName

        public java.lang.String getName()
        Description copied from interface: BioEntryDBLite
        Get the name of this sequence database.
        Specified by:
        getName in interface BioEntryDBLite
        Specified by:
        getName in interface SequenceDBLite
        Returns:
        the name of the sequence database, which may be null.
      • ids

        public java.util.Set ids()
        Description copied from interface: SequenceDB
        Get an immutable set of all of the IDs in the database. The ids are legal arguments to getSequence.
        Specified by:
        ids in interface BioEntryDB
        Specified by:
        ids in interface SequenceDB
        Returns:
        a Set of ids - at the moment, strings
      • setFactory

        public void setFactory​(RichSequenceBuilderFactory factory)
        Setter for property factory.
        Parameters:
        factory - New value of property factory.
      • getNamespace

        public Namespace getNamespace()
        Getter for property namespace.
        Returns:
        Value of property namespace.
      • setNamespace

        public void setNamespace​(Namespace namespace)
        Setter for property namespace.
        Parameters:
        namespace - New value of property namespace.