Class SequenceAlignmentDocument.ReferencedSequence
- java.lang.Object
-
- com.biomatters.geneious.publicapi.documents.sequence.SequenceAlignmentDocument.ReferencedSequence
-
- Enclosing class:
- SequenceAlignmentDocument
public static final class SequenceAlignmentDocument.ReferencedSequence extends java.lang.Object
Represents a reference to the original document that a sequence in this alignment was aligned from. Usually this is a reference to anAnnotatedPluginDocument
containing aSequenceDocument
. However, the referenced AnnotatedPluginDocument may instead contain aSequenceListDocument
if the alignment was built from a sequence list document or aSequenceAlignmentDocument
if the alignment was built using the consensus alignment builder.
-
-
Constructor Summary
Constructors Constructor Description ReferencedSequence(AnnotatedPluginDocument referencedDocument)
Construct a reference to a document that is aSequenceDocument
.ReferencedSequence(AnnotatedPluginDocument referencedDocument, int indexInSequenceListDocument)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static java.util.List<SequenceAlignmentDocument.ReferencedSequence>
forSequenceDocuments(AnnotatedPluginDocument... documents)
Creates a list of ReferencedSequence, with 1 entry in the list for each given document (each of which must be aSequenceDocument
) or null.int
getIndexInSequenceListDocument()
IfgetReferencedDocument()
is aSequenceListDocument
then this method returns the index of the referenced sequence in that SequenceListDocumentAnnotatedPluginDocument
getReferencedDocument()
Gets the document a sequence in the alignment was built from.static SequenceDocument
getSequenceDocument(SequenceAlignmentDocument.ReferencedSequence referencedSequence, SequenceDocument.Alphabet alphabet)
Get the sequence document referenced by a ReferencedSequence (if it references a SequenceDocument or SequenceListDocument)SequenceDocument
getSequenceDocument(SequenceDocument.Alphabet alphabet)
Get the sequence document referenced by this ReferencedSequence (if it references a SequenceDocument or SequenceListDocument)int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
ReferencedSequence
public ReferencedSequence(AnnotatedPluginDocument referencedDocument, int indexInSequenceListDocument)
- Parameters:
referencedDocument
- the document to reference. Must not be null.indexInSequenceListDocument
- if the referenced document is aSequenceListDocument
then this must be the index of the referenced sequence in that SequenceListDocument. Or -1 if the referenced document is not a SequenceListDocument.
-
ReferencedSequence
public ReferencedSequence(AnnotatedPluginDocument referencedDocument)
Construct a reference to a document that is aSequenceDocument
. (it must not be aSequenceListDocument
). This is equivalent to callingReferencedSequence(referencedDocument,-1)
- Parameters:
referencedDocument
- the document to referenc,de
-
-
Method Detail
-
getReferencedDocument
public AnnotatedPluginDocument getReferencedDocument()
Gets the document a sequence in the alignment was built from. Usually this AnnotatedPluginDocument contains aSequenceDocument
. However, the AnnotatedPluginDocument may instead contain aSequenceListDocument
if the alignment was built from a sequence list document or aSequenceAlignmentDocument
if the alignment was built using the consensus alignment builder.- Returns:
- The referenced document. Will never be null.
-
getIndexInSequenceListDocument
public int getIndexInSequenceListDocument()
IfgetReferencedDocument()
is aSequenceListDocument
then this method returns the index of the referenced sequence in that SequenceListDocument- Returns:
- the index of the referenced sequence in that SequenceListDocument or -1 if the referenced document is not a SequenceListDocument.
-
forSequenceDocuments
public static java.util.List<SequenceAlignmentDocument.ReferencedSequence> forSequenceDocuments(AnnotatedPluginDocument... documents)
Creates a list of ReferencedSequence, with 1 entry in the list for each given document (each of which must be aSequenceDocument
) or null.- Parameters:
documents
- the documents to create a list refering to.- Returns:
- a list of ReferencedSequence where each entry in the list is null iff the corresponding entry in documents was null
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getSequenceDocument
public SequenceDocument getSequenceDocument(SequenceDocument.Alphabet alphabet) throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
Get the sequence document referenced by this ReferencedSequence (if it references a SequenceDocument or SequenceListDocument)- Parameters:
alphabet
- alphabet of the sequence. Never null- Returns:
- the sequence document or null if this references something other than a sequenceDocument or sequenceListDocument
- Throws:
com.biomatters.geneious.publicapi.plugin.DocumentOperationException
- if the referenced sequence document could not be loaded
-
getSequenceDocument
public static SequenceDocument getSequenceDocument(SequenceAlignmentDocument.ReferencedSequence referencedSequence, SequenceDocument.Alphabet alphabet) throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
Get the sequence document referenced by a ReferencedSequence (if it references a SequenceDocument or SequenceListDocument)- Parameters:
alphabet
- alphabet of the sequence. Never nullreferencedSequence
- the referenced sequence to get the sequence document from. Can be null- Returns:
- the sequence document or null if the referencedSequence passed in was null or if it references something other than a sequenceDocument or sequenceListDocument
- Throws:
com.biomatters.geneious.publicapi.plugin.DocumentOperationException
- if the referenced document could not be loaded
-
-