MC-Fold-DP- Folding algorithm based on nucleotide cyclic motifs.

Safe HaskellNone




TODO bonus system for matching () bracking still broken?!



fold :: MotifDB -> Primary -> Constraint -> TablesSource

Folding wrapper

foldST :: MotifDB -> Primary -> Constraint -> ST s TablesSource

Folding in the ST monad. the number of dncm tables is the same as the number of known double NCMs.

backtrack :: MotifDB -> Double -> Primary -> Constraint -> Tables -> [(Double, D1Secondary)]Source

Backtracking suboptimal results

Combining NCMs

fncmSingle :: MotifDB -> Primary -> Constraint -> Int -> Int -> DoubleSource

singleNCM insertion

fncmDS :: MotifDB -> Primary -> Constraint -> Int -> Int -> Int -> Int -> Table2 -> DoubleSource

double NCM extend single NCM. We do not care that this is comparatively slow as it is called only a few times, anyway.

TODO make faster (better lookup system) TODO otherwise case TODO eats another ~10% performance

fncmDD :: MotifDB -> Primary -> Constraint -> Int -> Int -> Int -> Int -> [Table2] -> Vector (Int, Double)Source

double NCM extending another double NCM.

TODO this one could profit from performance improvements. But check first vs. multibranch timings TODO remove otherwise case TODO improve performance, eats ~66% of total time TODO improve: return empty vector on error, write special minimum function that has eInf on empty

fStemExt :: [Table2] -> Int -> Int -> Vector (Int, Int, Double)Source

Add one stem for external calculations

TODO make efficient

fStemExtExt :: [Table2] -> Table2 -> Int -> Int -> Vector (Int, Int, Double)Source

Combine stems for external calculations

fMulti :: MotifDB -> Primary -> Constraint -> Int -> Int -> Table2 -> Table2 -> Vector (Int, Double)Source

Close a multibranched loop with a singleNCM

TODO close with singleNCM

fMMbrStem :: Int -> Int -> Table2 -> Table2 -> Vector (Int, Double)Source

Connect a partial multibranched structure with a hairpin. Note that the dncm hairpin part wants one table, not the list of all tables.

fMStem :: Int -> Int -> Table2 -> Vector (Int, Double)Source

Add the first stem

fInterior :: MotifDB -> Primary -> Constraint -> Int -> Int -> Table2 -> Vector ((Int, Int), Double)Source

Interior loops of some size

TODO this could profit from a log-based scoring function

Helper functions

mkTable2 :: (Num t, Constants b, PrimArrayOpsM (t, t) b m) => t -> m (PrimArray (t, t) b, PrimArrayM (t, t) b m)Source

The default two-dim table

mkTable2With :: (Num t, PrimArrayOpsM (t, t) b m) => b -> t -> m (PrimArray (t, t) b, PrimArrayM (t, t) b m)Source

Create a 2-dim table

vuminimumP :: (Ord a, Constants a, Unbox t, Unbox a) => Vector (t, a) -> aSource

minimum for unboxed vectors, capturing possible 0-length. Vectors in this algorithm always carry positional information.

TODO the next version of the vector library should handle snd better

vuminimum :: (Ord a, Constants a, Unbox a) => Vector a -> aSource

types and constants

giveBonus :: Constraint -> Int -> Int -> DoubleSource

Give a certain bonusScore for the constraints that have been fulfilled.

TODO should we be more lenient with constraints that would increase the total energy?