statalign.postprocess.utils
Class Mapping

java.lang.Object
  extended by statalign.postprocess.utils.Mapping

public class Mapping
extends java.lang.Object


Constructor Summary
Mapping()
           
 
Method Summary
static int[] getGappedToUngappedMapping(java.lang.String alignedSequence)
           
static int[] getProjectionIndices(java.lang.String alignedSequence, char gapChar)
           
static int getUngappedPosition(java.lang.String sequence, int gappedPos, char gapChar)
          Returns the position in the sequence without gaps.
static int[] getUngappedToGappedMapping(java.lang.String alignedSequence)
           
static float[] projectarray(java.lang.String alignedSequence, float[] array, char gapChar)
           
static float[] projectArray2(java.lang.String alignedSequence, float[] array, char gapChar)
           
static double[][] projectMatrix(java.lang.String alignedSequence, double[][] matrix, char gapChar)
           
static float[][] projectMatrix(java.lang.String alignedSequence, float[][] matrix, char gapChar)
           
static float[][] projectMatrix2(java.lang.String alignedSequence, float[][] matrix, char gapChar)
          Given an aligned sequence of length n from an alignment of length n and a n*n matrix corresponding to the alignment.
static int[] projectPairedSites(java.lang.String alignedSequence, int[] pairedSites)
           
static java.lang.String projectSequence(java.lang.String alignedSequence, java.lang.String sequenceFromAlignment, char gapChar)
           
static java.lang.String projectSequence2(java.lang.String alignedSequence, java.lang.String sequenceFromAlignment, char gapChar)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mapping

public Mapping()
Method Detail

getUngappedPosition

public static int getUngappedPosition(java.lang.String sequence,
                                      int gappedPos,
                                      char gapChar)
Returns the position in the sequence without gaps.

Parameters:
sequence - a gapped sequence.
gappedPos - the position with gaps (just the character position).
Returns:
a position in the string ignoring gaps.

projectMatrix

public static float[][] projectMatrix(java.lang.String alignedSequence,
                                      float[][] matrix,
                                      char gapChar)

getProjectionIndices

public static int[] getProjectionIndices(java.lang.String alignedSequence,
                                         char gapChar)

projectMatrix

public static double[][] projectMatrix(java.lang.String alignedSequence,
                                       double[][] matrix,
                                       char gapChar)

projectMatrix2

public static float[][] projectMatrix2(java.lang.String alignedSequence,
                                       float[][] matrix,
                                       char gapChar)
Given an aligned sequence of length n from an alignment of length n and a n*n matrix corresponding to the alignment. This method removes gaps from the sequence to generate a sequence of length m, where m <= n and projects the specified n*n matrix onto a matrix of size m*m.

Parameters:
alignedSequence - a sequence of length n from an alignment of length n.
matrix - a n*n matrix.
Returns:
the projected matrix.

projectarray

public static float[] projectarray(java.lang.String alignedSequence,
                                   float[] array,
                                   char gapChar)

projectSequence2

public static java.lang.String projectSequence2(java.lang.String alignedSequence,
                                                java.lang.String sequenceFromAlignment,
                                                char gapChar)

projectSequence

public static java.lang.String projectSequence(java.lang.String alignedSequence,
                                               java.lang.String sequenceFromAlignment,
                                               char gapChar)

projectArray2

public static float[] projectArray2(java.lang.String alignedSequence,
                                    float[] array,
                                    char gapChar)

getUngappedToGappedMapping

public static int[] getUngappedToGappedMapping(java.lang.String alignedSequence)

getGappedToUngappedMapping

public static int[] getGappedToUngappedMapping(java.lang.String alignedSequence)

projectPairedSites

public static int[] projectPairedSites(java.lang.String alignedSequence,
                                       int[] pairedSites)