Package org.biojava.nbio.core.alignment
Class SimpleProfile<S extends Sequence<C>,C extends Compound>
java.lang.Object
org.biojava.nbio.core.alignment.SimpleProfile<S,C>
- Type Parameters:
S- each element of the alignmentProfileis of type SC- each element of anAlignedSequenceis aCompoundof type C
- All Implemented Interfaces:
Serializable,Iterable<AlignedSequence<S,,C>> Profile<S,C>
- Direct Known Subclasses:
SimpleProfilePair,SimpleSequencePair
public class SimpleProfile<S extends Sequence<C>,C extends Compound>
extends Object
implements Serializable, Profile<S,C>
Implements a data structure for the results of sequence alignment. Every
List returned is unmodifiable.- Author:
- Mark Chapman, Paolo Pavan
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.nbio.core.alignment.template.Profile
Profile.StringFormat -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionSimpleProfile(Collection<AlignedSequence<S, C>> alignedSequences) Creates a profile for the already aligned sequences.protectedSimpleProfile(AlignedSequence<S, C> query, AlignedSequence<S, C> target) Creates a pair profile for the given already aligned sequences.protectedSimpleProfile(Profile<S, C> query, Profile<S, C> target, List<AlignedSequence.Step> sx, List<AlignedSequence.Step> sy) Creates a pair profile for the given profiles.SimpleProfile(S sequence) Creates a profile from a single sequence.protectedSimpleProfile(S query, S target, List<AlignedSequence.Step> sx, int xb, int xa, List<AlignedSequence.Step> sy, int yb, int ya) Creates a pair profile for the given sequences. -
Method Summary
Modifier and TypeMethodDescriptiongetAlignedSequence(int listIndex) ReturnsAlignedSequenceat given index.getAlignedSequence(S sequence) Searches for the givenSequencewithin this alignment profile.Returns aListcontaining the individualAlignedSequences of this alignment.getAlignedSequences(int... listIndices) Returns aListcontaining some of the individualAlignedSequences of this alignment.getAlignedSequences(S... sequences) Returns aListcontaining some of the individualAlignedSequences of this alignment.getCompoundAt(int listIndex, int alignmentIndex) Returns theCompoundat row of given sequence and column of alignment index.getCompoundAt(S sequence, int alignmentIndex) Returns theCompoundat row of given sequence and column of alignment index.int[]getCompoundCountsAt(int alignmentIndex) Returns the number of eachCompoundin the given column for all compounds inCompoundSet.int[]getCompoundCountsAt(int alignmentIndex, List<C> compounds) Returns the number of eachCompoundin the given column only for compounds in the given list.getCompoundsAt(int alignmentIndex) ReturnsCompoundSetof allAlignedSequencesfloat[]getCompoundWeightsAt(int alignmentIndex) Returns the fraction of eachCompoundin the given column for all compounds inCompoundSet.float[]getCompoundWeightsAt(int alignmentIndex, List<C> compounds) Returns the fraction of eachCompoundin the given column only for compounds in the given list.intgetIndexOf(C compound) Searches for the givenCompoundwithin this alignment profile.int[]getIndicesAt(int alignmentIndex) Returns the indices in the originalSequences corresponding to the given column.intgetLastIndexOf(C compound) Searches for the givenCompoundwithin this alignment profile.intReturns the number of columns in the alignment profile.intgetSize()Returns the number of rows in this profile.getSubProfile(Location location) Returns aProfileViewwindowed to contain only the givenLocation.booleanhasGap(int alignmentIndex) Returns true if anyAlignedSequencehas a gap at the given index.booleanReturns true if anyAlignedSequenceis circular.iterator()toString()Returns a simple view of the alignment profile.toString(int width) Returns a formatted view of the alignment profile.toString(Profile.StringFormat format) Returns a formatted view of the alignment profile.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
matrix
-
-
Constructor Details
-
SimpleProfile
Creates a pair profile for the given already aligned sequences.- Parameters:
query- the first sequence of the pairtarget- the second sequence of the pair- Throws:
IllegalArgumentException- if sequences differ in size
-
SimpleProfile
Creates a profile from a single sequence.- Parameters:
sequence- sequence to seed profile
-
SimpleProfile
protected SimpleProfile(S query, S target, List<AlignedSequence.Step> sx, int xb, int xa, List<AlignedSequence.Step> sy, int yb, int ya) Creates a pair profile for the given sequences.- Parameters:
query- the first sequence of the pairtarget- the second sequence of the pairsx- lists whether the query sequence aligns aCompoundor gap at each index of the alignmentxb- number ofCompounds skipped in the query sequence before the aligned regionxa- number ofCompounds skipped in the query sequence after the aligned regionsy- lists whether the target sequence aligns aCompoundor gap at each index of the alignmentyb- number ofCompounds skipped in the target sequence before the aligned regionya- number ofCompounds skipped in the target sequence after the aligned region- Throws:
IllegalArgumentException- if alignments differ in size or given sequences do not fit in alignments
-
SimpleProfile
protected SimpleProfile(Profile<S, C> query, Profile<S, C> target, List<AlignedSequence.Step> sx, List<AlignedSequence.Step> sy) Creates a pair profile for the given profiles.- Parameters:
query- the first profile of the pairtarget- the second profile of the pairsx- lists whether the query profile aligns aCompoundor gap at each index of the alignmentsy- lists whether the target profile aligns aCompoundor gap at each index of the alignment- Throws:
IllegalArgumentException- if alignments differ in size or given profiles do not fit in alignments
-
SimpleProfile
Creates a profile for the already aligned sequences.- Parameters:
alignedSequences- the already aligned sequences- Throws:
IllegalArgumentException- if aligned sequences differ in length or collection is empty.
-
-
Method Details
-
getAlignedSequence
Description copied from interface:ProfileReturnsAlignedSequenceat given index. -
getAlignedSequence
Description copied from interface:ProfileSearches for the givenSequencewithin this alignment profile. Returns the correspondingAlignedSequence.- Specified by:
getAlignedSequencein interfaceProfile<S extends Sequence<C>,C extends Compound> - Parameters:
sequence- an originalSequence- Returns:
- the corresponding
AlignedSequence
-
getAlignedSequences
Description copied from interface:ProfileReturns aListcontaining the individualAlignedSequences of this alignment. -
getAlignedSequences
Description copied from interface:ProfileReturns aListcontaining some of the individualAlignedSequences of this alignment. -
getAlignedSequences
Description copied from interface:ProfileReturns aListcontaining some of the individualAlignedSequences of this alignment. -
getCompoundAt
Description copied from interface:Profile -
getCompoundAt
Description copied from interface:ProfileReturns theCompoundat row of given sequence and column of alignment index. If the given sequence has overlap, this will return theCompoundfrom the top row of the sequence.- Specified by:
getCompoundAtin interfaceProfile<S extends Sequence<C>,C extends Compound> - Parameters:
sequence- either anAlignedSequenceor an originalSequencealignmentIndex- column index within an alignment- Returns:
- the sequence element
-
getCompoundCountsAt
Description copied from interface:ProfileReturns the number of eachCompoundin the given column for all compounds inCompoundSet. -
getCompoundCountsAt
Description copied from interface:ProfileReturns the number of eachCompoundin the given column only for compounds in the given list. -
getCompoundsAt
Description copied from interface:Profile -
getCompoundSet
Description copied from interface:ProfileReturnsCompoundSetof allAlignedSequences -
getCompoundWeightsAt
Description copied from interface:ProfileReturns the fraction of eachCompoundin the given column for all compounds inCompoundSet. -
getCompoundWeightsAt
Description copied from interface:ProfileReturns the fraction of eachCompoundin the given column only for compounds in the given list. -
getIndexOf
Description copied from interface:ProfileSearches for the givenCompoundwithin this alignment profile. Returns column index nearest to the start of the alignment profile, or -1 if not found. -
getIndicesAt
Description copied from interface:ProfileReturns the indices in the originalSequences corresponding to the given column. All indices are 1-indexed and inclusive. -
getLastIndexOf
Description copied from interface:ProfileSearches for the givenCompoundwithin this alignment profile. Returns column index nearest to the end of the alignment profile, or -1 if not found. -
getLength
Description copied from interface:ProfileReturns the number of columns in the alignment profile. -
getOriginalSequences
Description copied from interface:Profile -
getSize
Description copied from interface:ProfileReturns the number of rows in this profile. If anyAlignedSequences are circular and overlap within the alignment, the returned size will be greater than the number of sequences, otherwise the numbers will be equal. -
getSubProfile
Description copied from interface:ProfileReturns aProfileViewwindowed to contain only the givenLocation. This only includes theAlignedSequences which overlap the location. -
hasGap
Description copied from interface:ProfileReturns true if anyAlignedSequencehas a gap at the given index. -
isCircular
Description copied from interface:ProfileReturns true if anyAlignedSequenceis circular. If so, sequences may simply wrap around from the end to the start of the alignment or they may contribute multiple overlapping lines to the profile.- Specified by:
isCircularin interfaceProfile<S extends Sequence<C>,C extends Compound> - Returns:
- true if any
AlignedSequenceis circular
-
toString
Description copied from interface:ProfileReturns a formatted view of the alignment profile. This shows the start and end indices of the profile and each sequence for each group of lines of the given width. Each line may also be labeled. -
toString
Description copied from interface:ProfileReturns a formatted view of the alignment profile. Details depend on the format given. -
toString
Description copied from interface:ProfileReturns a simple view of the alignment profile. This shows each sequence on a separate line (or multiple lines, if circular) and nothing more. This should result inProfile.getSize()lines withProfile.getLength()Compounds per line. -
iterator
-