calhoun.analysis.crf.io
Class MultipleAlignmentInputSequence

java.lang.Object
  extended by calhoun.analysis.crf.io.MultipleAlignmentInputSequence
All Implemented Interfaces:
InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn>

public class MultipleAlignmentInputSequence
extends java.lang.Object
implements InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn>

an input sequence where each element represents one column of a multiple alignment.


Nested Class Summary
 class MultipleAlignmentInputSequence.MultipleAlignmentColumn
          represents the column of the alignment at a given position on the reference sequence
 
Constructor Summary
MultipleAlignmentInputSequence(java.util.List<java.lang.String> speciesNames, java.util.List<java.lang.String> consensuses, java.lang.String refSpecies, RootedBinaryPhylogeneticTree tree)
          constructs a multiple alignment input sequence.
MultipleAlignmentInputSequence(java.lang.String refSpecies, RootedBinaryPhylogeneticTree tree)
           
 
Method Summary
 char characterInPaddedAlignment(int consensusPosition, int speciesNumber)
           
 int con2refLeft(int cpos)
           
 int con2refRight(int cpos)
           
 int getColumnUniqueHash(int conpos)
           
 InputSequence<?> getComponent(java.lang.String name)
          For input sequences that are a composite of several different input objects, returns a particular component of the input.
 int getConsensusLength()
           
 java.util.List<java.lang.String> getConsensusSeqs()
           
 PhylogeneticTreeFelsensteinOrder getFelsensteinOrder()
           
 int getNumSpecies()
           
 java.util.List<java.lang.String> getSpeciesNames()
           
 RootedBinaryPhylogeneticTree getTree()
           
 MultipleAlignmentInputSequence.MultipleAlignmentColumn getX(int ix)
          retrieves the input value at a position in the input sequence.
 int length()
          Returns the length of this sequence
 java.util.Collection<java.lang.String> listComponents()
          For input sequences that are a composite of several different input objects, returns a list of the names of the components in this input sequence.
 int numSpecies()
           
 int ref2con(int pos)
           
 InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn> subSequence(int start, int end)
          tTakes a subinterval of the input sequence with given start-end coordinates which are relative coordinates, 1-based, and inclusive.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleAlignmentInputSequence

public MultipleAlignmentInputSequence(java.lang.String refSpecies,
                                      RootedBinaryPhylogeneticTree tree)

MultipleAlignmentInputSequence

public MultipleAlignmentInputSequence(java.util.List<java.lang.String> speciesNames,
                                      java.util.List<java.lang.String> consensuses,
                                      java.lang.String refSpecies,
                                      RootedBinaryPhylogeneticTree tree)
constructs a multiple alignment input sequence.

Parameters:
speciesNames - a list of the names of the species in the alignments
consensuses - a list of the consensus sequences for each species. The consensus sequences shoudl form a multiple alignment, including gaps.
tree - a tree of all the species in the alignment with branch lengths.
Method Detail

getNumSpecies

public int getNumSpecies()

getX

public MultipleAlignmentInputSequence.MultipleAlignmentColumn getX(int ix)
Description copied from interface: InputSequence
retrieves the input value at a position in the input sequence.

Specified by:
getX in interface InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn>
Parameters:
ix - the index position at which to get the input. This is a zero-based index.
Returns:
the object at this position in the input.

length

public int length()
Description copied from interface: InputSequence
Returns the length of this sequence

Specified by:
length in interface InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn>
Returns:
length

getComponent

public InputSequence<?> getComponent(java.lang.String name)
Description copied from interface: InputSequence
For input sequences that are a composite of several different input objects, returns a particular component of the input. For simple input sequences that just return an object, this method should throw UnsupportedOperationException.

Specified by:
getComponent in interface InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn>
Parameters:
name - the name of the input component to return
Returns:
the input sequence representing this component

listComponents

public java.util.Collection<java.lang.String> listComponents()
Description copied from interface: InputSequence
For input sequences that are a composite of several different input objects, returns a list of the names of the components in this input sequence. For simple input sequences that just return an object, this method should throw UnsupportedOperationException.

Specified by:
listComponents in interface InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn>
Returns:
a collection containing the component names

con2refLeft

public int con2refLeft(int cpos)

con2refRight

public int con2refRight(int cpos)

ref2con

public int ref2con(int pos)

characterInPaddedAlignment

public char characterInPaddedAlignment(int consensusPosition,
                                       int speciesNumber)

numSpecies

public int numSpecies()

subSequence

public InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn> subSequence(int start,
                                                                                         int end)
Description copied from interface: InputSequence
tTakes a subinterval of the input sequence with given start-end coordinates which are relative coordinates, 1-based, and inclusive. Thus 1-10 will mean returning a new InputSequence which is the first 10 positions of the current one.

An implementation that does not support subsetting should throw an UnsupportedOperationException

Specified by:
subSequence in interface InputSequence<MultipleAlignmentInputSequence.MultipleAlignmentColumn>
Parameters:
start - the 1-based index of the first position of the input to retrieve.
end - the 1-based index of the last position of the input to retrieve.
Returns:
an input sequence which is a sbusequence of the original sequence.

getSpeciesNames

public java.util.List<java.lang.String> getSpeciesNames()

getConsensusSeqs

public java.util.List<java.lang.String> getConsensusSeqs()

getColumnUniqueHash

public int getColumnUniqueHash(int conpos)

getConsensusLength

public int getConsensusLength()

getTree

public RootedBinaryPhylogeneticTree getTree()

getFelsensteinOrder

public PhylogeneticTreeFelsensteinOrder getFelsensteinOrder()