Class AbstractSequence<C extends Compound>
java.lang.Object
org.biojava3.core.sequence.template.AbstractSequence<C>
- Type Parameters:
C
-
- All Implemented Interfaces:
Iterable<C>
,Accessioned
,Sequence<C>
- Direct Known Subclasses:
BasicSequence
,DNASequence
,ProteinSequence
,RNASequence
The base class for DNA, RNA and Protein sequences.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionAbstractSequence
(String seqString, CompoundSet<C> compoundSet) Create a Sequence from a simple string where the values should be found in compoundSetAbstractSequence
(SequenceReader<C> proxyLoader, CompoundSet<C> compoundSet) A ProxySequenceReader allows abstraction of both the storage of the sequence data and the location of the sequence data. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFeature
(int bioStart, int bioEnd, FeatureInterface<AbstractSequence<C>, C> feature) Method to help set the proper details for a feature as it relates to a sequence where the feature needs to have a location on the sequencevoid
addFeature
(FeatureInterface<AbstractSequence<C>, C> feature) Add a feature to this sequence.void
Add notes about this sequence that will get exported for GFF3int
countCompounds
(C... compounds) Returns the number of times we found a compound in the SequenceReturns the AccessionID this location is currently bound withReturns the Sequence as a List of compoundsgetCompoundAt
(int position) Returns the Compound at the given biological indexGets the compound set used to back this SequencegetFeatures
(int bioSequencePosition) Return features at a sequence positiongetFeatures
(String featureType, int bioSequencePosition) Return features at a sequence position by typegetFeaturesByType
(String type) int
getIndexOf
(C compound) Scans through the Sequence looking for the first occurrence of the given compoundDoes the right thing to get the inverse of the current Sequence.int
getLastIndexOf
(C compound) Scans through the Sequence looking for the last occurrence of the given compoundint
Returns the length of the SequenceDefault case is to assume strand is positive because only CDSSequence can be either positive or negative Strand.getSequenceAsString
(Integer bioStart, Integer bioEnd, Strand strand) Provide place holder for a metric that indicate a score associated with the sequenceAdded support for the source of this sequence for GFF3 export If a sub sequence doesn't have source then check for parent sourcegetSubSequence
(Integer bioStart, Integer bioEnd) Returns a portion of the sequence from the different positions.Provided for convience if the developer needs to associate data with a sequenceiterator()
void
removeFeature
(FeatureInterface<AbstractSequence<C>, C> feature) Remove a feature from the sequencevoid
removeNote
(String note) void
setAccession
(AccessionID accession) void
setAnnotationType
(AbstractSequence.AnnotationType annotationType) void
setBioBegin
(Integer begin) void
void
setCompoundSet
(CompoundSet<C> compoundSet) void
setDatabaseReferences
(DatabaseReferenceInterface databaseReferences) void
setDescription
(String description) void
setFeaturesKeyWord
(FeaturesKeyWordInterface featuresKeyWord) void
setNotesList
(ArrayList<String> notesList) void
setOriginalHeader
(String originalHeader) void
setParentSequence
(AbstractSequence<C> abstractSequence) void
setProxySequenceReader
(SequenceReader<C> proxyLoader) Very important method that allows external mappings of sequence data and features.void
setSequenceScore
(Double sequenceScore) void
Added support for the source of this sequence for GFF3 exportvoid
setTaxonomy
(TaxonomyID taxonomy) void
setUserCollection
(Collection<Object> userCollection) toString()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AbstractSequence
public AbstractSequence() -
AbstractSequence
Create a Sequence from a simple string where the values should be found in compoundSet- Parameters:
seqString
-compoundSet
-
-
AbstractSequence
A ProxySequenceReader allows abstraction of both the storage of the sequence data and the location of the sequence data. A variety of use cases are possible. A ProxySequenceReader that knows the offset and of teh sequence in a large fasta file. A ProxySequenceReader that can pull Sequence data from Uniprot, NCBI or a custom database. If the ProxySequecneReader implements various interfaces then the sequence will set those interfaces so that calls to various methods will be valid.- Parameters:
proxyLoader
-compoundSet
-
-
-
Method Details
-
setProxySequenceReader
Very important method that allows external mappings of sequence data and features. This method will gain additional interface inspection that allows external data sources with knowledge of features for a sequence to be supported.- Parameters:
proxyLoader
-
-
getProxySequenceReader
-
getBioBegin
- Returns:
- the bioBegin
-
setBioBegin
- Parameters:
bioBegin
- the bioBegin to set
-
getBioEnd
- Returns:
- the bioEnd
-
setBioEnd
- Parameters:
bioEnd
- the bioEnd to set
-
getUserCollection
Provided for convience if the developer needs to associate data with a sequence- Returns:
-
setUserCollection
- Parameters:
userCollection
-
-
getAnnotationType
- Returns:
- the annotation
-
setAnnotationType
- Parameters:
annotation
- the annotation to set
-
getDescription
- Returns:
- the description
-
setDescription
- Parameters:
description
- the description to set
-
getOriginalHeader
- Returns:
- the originalHeader
-
setOriginalHeader
- Parameters:
originalHeader
- the originalHeader to set
-
getParentSequence
- Returns:
- the parentSequence
-
setParentSequence
- Parameters:
abstractSequence
- the parentSequence to set
-
getSource
Added support for the source of this sequence for GFF3 export If a sub sequence doesn't have source then check for parent source- Returns:
- the source
-
setSource
Added support for the source of this sequence for GFF3 export- Parameters:
source
- the source to set
-
addNote
Add notes about this sequence that will get exported for GFF3- Parameters:
note
-
-
removeNote
-
getNotesList
- Returns:
- the notesList
-
setNotesList
- Parameters:
notesList
- the notesList to set
-
getSequenceScore
Provide place holder for a metric that indicate a score associated with the sequence- Returns:
- the sequenceScore
-
setSequenceScore
- Parameters:
sequenceScore
- the sequenceScore to set
-
getFeatures
public List<FeatureInterface<AbstractSequence<C>,C>> getFeatures(String featureType, int bioSequencePosition) Return features at a sequence position by type- Parameters:
featureType
-bioSequencePosition
-- Returns:
-
getFeatures
Return features at a sequence position- Parameters:
featureType
-bioSequencePosition
-- Returns:
-
getFeatures
- Returns:
-
addFeature
Method to help set the proper details for a feature as it relates to a sequence where the feature needs to have a location on the sequence- Parameters:
bioStart
-bioEnd
-feature
-
-
addFeature
Add a feature to this sequence. The feature will be added to the collection where the order is start position and if more than one feature at the same start position then longest is added first. This helps on doing feature layout for displaying features in SequenceFeaturePanel- Parameters:
feature
-
-
removeFeature
Remove a feature from the sequence- Parameters:
feature
-
-
getFeaturesByType
- Parameters:
type
-- Returns:
-
getFeaturesKeyWord
- Returns:
- the featuresKeyWord
-
setFeaturesKeyWord
- Parameters:
featuresKeyWord
- the featuresKeyWord to set
-
getDatabaseReferences
- Returns:
- the databaseReferences
-
setDatabaseReferences
- Parameters:
databaseReferences
- the databaseReferences to set
-
getAccession
Description copied from interface:Accessioned
Returns the AccessionID this location is currently bound with- Specified by:
getAccession
in interfaceAccessioned
- Returns:
- the accession
-
setAccession
- Parameters:
accession
- the accession to set
-
getTaxonomy
- Returns:
- the species
-
setTaxonomy
- Parameters:
species
- the species to set
-
getCompoundSet
Description copied from interface:Sequence
Gets the compound set used to back this Sequence- Specified by:
getCompoundSet
in interfaceSequence<C extends Compound>
-
setCompoundSet
-
toString
-
getSequenceAsString
- Parameters:
begin
-end
-strand
-- Returns:
-
getSequenceAsString
Default case is to assume strand is positive because only CDSSequence can be either positive or negative Strand.- Specified by:
getSequenceAsString
in interfaceSequence<C extends Compound>
- Returns:
-
getAsList
Description copied from interface:Sequence
Returns the Sequence as a List of compounds -
getCompoundAt
Description copied from interface:Sequence
Returns the Compound at the given biological index- Specified by:
getCompoundAt
in interfaceSequence<C extends Compound>
- Parameters:
position
- The 1-indexed position of the amino acid- Returns:
-
getIndexOf
Description copied from interface:Sequence
Scans through the Sequence looking for the first occurrence of the given compound- Specified by:
getIndexOf
in interfaceSequence<C extends Compound>
- Parameters:
compound
-- Returns:
- The first index of compound in this sequence (1-based)
-
getLastIndexOf
Description copied from interface:Sequence
Scans through the Sequence looking for the last occurrence of the given compound- Specified by:
getLastIndexOf
in interfaceSequence<C extends Compound>
- Parameters:
compound
-- Returns:
- The last index of compound in this sequence (1-based)
-
getLength
public int getLength()Description copied from interface:Sequence
Returns the length of the Sequence -
getSubSequence
Description copied from interface:Sequence
Returns a portion of the sequence from the different positions. This is indexed from 1- Specified by:
getSubSequence
in interfaceSequence<C extends Compound>
- Parameters:
bioStart
-bioEnd
-- Returns:
-
iterator
-
countCompounds
Description copied from interface:Sequence
Returns the number of times we found a compound in the Sequence- Specified by:
countCompounds
in interfaceSequence<C extends Compound>
- Parameters:
compounds
-- Returns:
-
getInverse
Description copied from interface:Sequence
Does the right thing to get the inverse of the current Sequence. This means either reversing the Sequence and optionally complementing the Sequence.- Specified by:
getInverse
in interfaceSequence<C extends Compound>
- Returns:
-