public class Alignment extends java.lang.Object implements java.lang.Iterable<Site>
DuplicationAlignment
,
FastaAlignment
.Constructor and Description |
---|
Alignment(java.util.List<Site> data)
Creates an alignment
|
Modifier and Type | Method and Description |
---|---|
double |
averageLength(java.util.Set<java.lang.String> gaps)
Returns the average length of the sequences
|
boolean |
check(java.util.Map<java.lang.String,?> map)
Checks whether the map contains an entry for every class in the alignment
|
boolean |
equals(java.lang.Object o) |
int |
getClassSize(java.lang.String cl)
Gets the size of a class, that is how many sites belong to the given class
|
int |
getLength()
Gets the length of the aligmnet
|
int |
getNumber()
Gets the number of taxa in the alignment
|
double |
getRawFreq(java.lang.String character)
Gets the frequency of a raw character
|
Site |
getSite(int s)
Returns the site at a given position in the alignment
|
java.util.List<java.lang.String> |
getSiteClasses()
Returns a list of site classes in the same order as the sites in the
alignment.
|
java.util.Set<java.lang.String> |
getTaxa()
Gets the names of the taxa in the aligment
|
java.util.List<UniqueSite> |
getUniqueSites()
Returns a list of unique sites in the aligment.
|
boolean |
hasClasses()
Checks whether the sites in this alignment have classes
|
int |
hashCode() |
java.util.Iterator<Site> |
iterator() |
Alignment |
limitToTaxa(java.util.Collection<java.lang.String> limit)
Returns a new Alignment which is the same as this one except it is limited
to certain taxa
|
Alignment |
recode(java.util.Map<java.lang.String,java.lang.String> recode)
Recodes the alignment and returns it
|
Alignment |
recode(java.util.Map<java.lang.String,java.lang.String> recode,
Ambiguous ambig)
Recodes the alignment and returns it and also allows the definition of
new ambiguous states
|
public Alignment(java.util.List<Site> data) throws AlignmentException
data
- A list of sites in the alignmentAlignmentException
- Thrown if the sites passed have different taxapublic int getLength()
public double averageLength(java.util.Set<java.lang.String> gaps)
gaps
- The set of gap characters (i.e. characters to be ignored when
coutning length)public int getNumber()
public java.util.List<UniqueSite> getUniqueSites()
public Site getSite(int s)
s
- The site to be returnedpublic java.util.Set<java.lang.String> getTaxa()
public java.util.Iterator<Site> iterator()
iterator
in interface java.lang.Iterable<Site>
public boolean check(java.util.Map<java.lang.String,?> map)
map
- The mappublic Alignment recode(java.util.Map<java.lang.String,java.lang.String> recode)
recode
- A map from original state to new state, e.g. to recode
DNA to RY it would contains A -> R, G -> R, C -> Y, T -> Ypublic Alignment recode(java.util.Map<java.lang.String,java.lang.String> recode, Ambiguous ambig)
recode
- A map from original state to new state, e.g. to recode
DNA to RY it would contains A -> R, G -> R, C -> Y, T -> Yambig
- The new ambiiguous statespublic Alignment limitToTaxa(java.util.Collection<java.lang.String> limit)
limit
- The taxa to limit the new alignment topublic double getRawFreq(java.lang.String character)
character
- The character to get the frequency forpublic int getClassSize(java.lang.String cl)
cl
- The classpublic java.util.List<java.lang.String> getSiteClasses()
public boolean hasClasses()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object