PrimitiveArray-0.8.0.1: Efficient multidimensional arrays

Safe HaskellNone
LanguageHaskell2010

Data.PrimitiveArray.ScoreMatrix

Description

Simple score and distance matrices. These are two-dimensional tables together with row and column vectors of names.

Synopsis

Documentation

data ScoreMatrix t Source #

NxN sized score matrices

TODO needs a vector with the column names!

Constructors

ScoreMatrix 

Fields

Instances

(Unbox t, Eq t) => Eq (ScoreMatrix t) Source # 
(Show t, Unbox t) => Show (ScoreMatrix t) Source # 

(.!.) :: Unbox t => ScoreMatrix t -> (Int, Int) -> t Source #

Get the distance between edges (From,To).

nodeDist :: Unbox t => ScoreMatrix t -> Int -> t Source #

If the initial node has a "distance", it'll be here

rowNameOf :: ScoreMatrix t -> Int -> Text Source #

Get the name of the node at an row index

colNameOf :: ScoreMatrix t -> Int -> Text Source #

Get the name of the node at an column index

numRows :: Unbox t => ScoreMatrix t -> Int Source #

Number of rows in a score matrix.

numCols :: Unbox t => ScoreMatrix t -> Int Source #

Number of columns in a score matrix.

toPartMatrix Source #

Arguments

:: Double

temperature

-> ScoreMatrix Double 
-> ScoreMatrix (Log Double) 

Turns a ScoreMatrix for distances into one scaled by "temperature" for Inside/Outside calculations. Each value is scaled by k -> exp $ negate k / r * t where r = (n-1) * d d = mean of genetic distance

Node scores are turned directly into probabilities.

TODO Again, there is overlap and we should really have newtype Distance and friends.

TODO newtype Temperature = Temperature Double

TODO fix for rows /= cols!!!

fromFile :: FilePath -> IO (ScoreMatrix Double) Source #

Import data.

TODO Should be generalized because Lib-BiobaseBlast does almost the same thing.