de.jstacs.clustering.distances

## Class SequenceScoreDistance

• Direct Known Subclasses:
RandomSequenceScoreDistance

```public class SequenceScoreDistance
extends DistanceMetric<StatisticalModel>```
Class for a distance metric between `StatisticalModel`s based on the correlation of score profiles on De Bruijn sequences. For two `StatisticalModel`s and , we compute the score profiles and on a De Bruijn sequence of length . The distance is then defined based on the Pearson correlation as between these score profiles, maximizing over suitable shifts of the score profiles and both strand orientations.
Author:
Jan Grau
• ### Field Summary

Fields
Modifier and Type Field and Description
`protected boolean` `exp`
if exponential scores should be used
`protected CyclicSequenceAdaptor[]` `seqs`
The De Bruijn sequences
• ### Constructor Summary

Constructors
Modifier Constructor and Description
`protected ` ```SequenceScoreDistance(CyclicSequenceAdaptor[] seqs, boolean exp)```
Creates a new distance for a given set of sequences.
` ` ```SequenceScoreDistance(DiscreteAlphabet alphabet, int n, boolean exp)```
Creates a new distance.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double` ```getDistance(double[][] profiles1, double[][] profiles1Rc, double[][] profiles2, int maxShift)```
Returns the distance between the two score profiles.
`double` ```getDistance(double[][] profiles1, double[][] profiles1Rc, StatisticalModel o2, int motif1Length)```
Returns the distance between a score profile and a model.
`double` ```getDistance(StatisticalModel o1, StatisticalModel o2)```
Returns the distance according to the metric of the two supplied objects.
`double[][]` ```getPairwiseDistanceMatrix(int numThreads, StatisticalModel... objects)```
Multi-threaded computation of the pairwise distance matrix.
`double[][]` ```getProfile(StatisticalModel o, boolean rc)```
Returns the score profile for the model.
• ### Methods inherited from class de.jstacs.clustering.distances.DistanceMetric

`getPairwiseDistanceMatrix`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### seqs

`protected CyclicSequenceAdaptor[] seqs`
The De Bruijn sequences
• #### exp

`protected boolean exp`
if exponential scores should be used
• ### Constructor Detail

• #### SequenceScoreDistance

```public SequenceScoreDistance(DiscreteAlphabet alphabet,
int n,
boolean exp)
throws WrongAlphabetException,
WrongSequenceTypeException```
Creates a new distance.
Parameters:
`alphabet` - the alphabet of the models that may be compared
`n` - the length of n-mers represented in the De Bruijn sequence
`exp` - if exponential scores should be used
Throws:
`WrongAlphabetException` - if the sequence of this alphabet could not be created
`WrongSequenceTypeException` - if the sequence could not be created
• #### SequenceScoreDistance

```protected SequenceScoreDistance(CyclicSequenceAdaptor[] seqs,
boolean exp)```
Creates a new distance for a given set of sequences.
Parameters:
`seqs` - the sequences
`exp` - if exponential scores should be used
• ### Method Detail

• #### getProfile

```public double[][] getProfile(StatisticalModel o,
boolean rc)
throws Exception```
Returns the score profile for the model.
Parameters:
`o` - the mode
`rc` - if the reverse complement should be considered
Returns:
the score profile
Throws:
`Exception` - if the score could not be computed
• #### getDistance

```public double getDistance(double[][] profiles1,
double[][] profiles1Rc,
double[][] profiles2,
int maxShift)
throws Exception```
Returns the distance between the two score profiles.
Parameters:
`profiles1` - the first profile
`profiles1Rc` - the reverse complementary version of the first profile
`profiles2` - the second profile
`maxShift` - the maximum allowed shift between the profiles
Returns:
the distance
Throws:
`Exception` - if the distance could not be computed
• #### getDistance

```public double getDistance(double[][] profiles1,
double[][] profiles1Rc,
StatisticalModel o2,
int motif1Length)
throws Exception```
Returns the distance between a score profile and a model.
Parameters:
`profiles1` - the first profile
`profiles1Rc` - the reverse complementary version of the first profile
`o2` - the model
`motif1Length` - the length of the motif used to compute the first profile
Returns:
the distance
Throws:
`Exception` - if the distance could not be computed
• #### getDistance

```public double getDistance(StatisticalModel o1,
StatisticalModel o2)
throws Exception```
Description copied from class: `DistanceMetric`
Returns the distance according to the metric of the two supplied objects.
Specified by:
`getDistance` in class `DistanceMetric<StatisticalModel>`
Parameters:
`o1` - the first object
`o2` - the second object
Returns:
the distance
Throws:
`Exception` - if the distance could not be computed
• #### getPairwiseDistanceMatrix

```public double[][] getPairwiseDistanceMatrix(int numThreads,
StatisticalModel... objects)
throws Exception```
Multi-threaded computation of the pairwise distance matrix.
Parameters:
`numThreads` - the number of threads
`objects` - the models
Returns:
the distance matrix
Throws:
`Exception` - if the distance could not be computed