Class SimilarityPairBuilder

  • All Implemented Interfaces:
    SearchContentHandler

    public class SimilarityPairBuilder
    extends ViewSequenceFactory
    implements SearchContentHandler

    SimilarityPairBuilder annotates query and subject Sequence with SimilarityPairFeatures created from SAX events supplied via a SeqSimilarityAdapter. The objective is to describe a simple pairwise relationship between the two sequences. This differs slightly from using HomologyFeatures which are slightly heavier, have to contain a full alignment and don't have an explicit distinction between query and subject sequences in the alignment. The SAX events should describe elements conforming to the BioJava BlastLikeDataSetCollection DTD. Suitable sources are BlastLikeSAXParser or FastaSAXParser.

    Annotated ViewSequences wrapping both query and subject sequences are created.

    The current implementation should be used with care on streams containing more than one search output. This is because the builder will not stop after each report has been processed and as a result all the subject sequences get instantiated and a large object network could be created during processing.

    Since:
    1.2
    Author:
    Keith James, Greg Cox
    • Field Detail

      • SIMILARITY_PAIR_FEATURE_TYPE

        public static final java.lang.String SIMILARITY_PAIR_FEATURE_TYPE
        Constant SIMILARITY_PAIR_FEATURE_TYPE the type String used by SimilarityPairBuilder when creating SimilarityPairFeatures. This is the String which is returned when a SimilarityPairFeature's getType() method is called.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SimilarityPairBuilder

        public SimilarityPairBuilder()
    • Method Detail

      • setQueryID

        public void setQueryID​(java.lang.String queryID)
        Description copied from interface: SearchContentHandler
        setQueryID identifies the query sequence by a name, ID or URN.
        Specified by:
        setQueryID in interface SearchContentHandler
        Parameters:
        queryID - a String which should be an unique identifer for the sequence.
      • getMoreSearches

        public boolean getMoreSearches()
        Description copied from interface: SearchContentHandler
        getMoreSearches returns the state of the SearchContentHandler with respect to further searches from its data source. Used for handling streams of search results.
        Specified by:
        getMoreSearches in interface SearchContentHandler
        Returns:
        a boolean value.
      • setMoreSearches

        public void setMoreSearches​(boolean value)
        Description copied from interface: SearchContentHandler
        setMoreSearches sets the state of the SearchContentHandler's expectation of receiving more results. Used for handling streams of search results.
        Specified by:
        setMoreSearches in interface SearchContentHandler
        Parameters:
        value - a boolean value.
      • startHeader

        public void startHeader()
        Description copied from interface: SearchContentHandler
        The startHeader method indicates the start of a formatted header. This usually contains information relevant to the search as a whole.
        Specified by:
        startHeader in interface SearchContentHandler
      • startHit

        public void startHit()
        Description copied from interface: SearchContentHandler
        The startHit method indicates the start of a formatted hit. This could be a single line, or a block of lines.
        Specified by:
        startHit in interface SearchContentHandler
      • startSubHit

        public void startSubHit()
        Description copied from interface: SearchContentHandler
        The startSubHit method indicates the start of a formatted subhit. There may be zero or more of these per hit.
        Specified by:
        startSubHit in interface SearchContentHandler
      • addSearchProperty

        public void addSearchProperty​(java.lang.Object key,
                                      java.lang.Object value)
        Description copied from interface: SearchContentHandler
        The addSearchProperty method adds a key/value pair containing some property of the overall search result.
        Specified by:
        addSearchProperty in interface SearchContentHandler
        Parameters:
        key - an Object.
        value - an Object.
      • addHitProperty

        public void addHitProperty​(java.lang.Object key,
                                   java.lang.Object value)
        Description copied from interface: SearchContentHandler
        The addHitProperty method adds a key/value pair containing some property of a particular hit.
        Specified by:
        addHitProperty in interface SearchContentHandler
        Parameters:
        key - an Object.
        value - an Object.
      • addSubHitProperty

        public void addSubHitProperty​(java.lang.Object key,
                                      java.lang.Object value)
        Description copied from interface: SearchContentHandler
        The addSubHitProperty method adds a key/value pair containing some property of a particular subhit.
        Specified by:
        addSubHitProperty in interface SearchContentHandler
        Parameters:
        key - an Object.
        value - an Object.