ViennaRNA-extras- ViennaRNA v2 extensions

Safe HaskellNone




Everything needed to wrap RNAfold results, parse lines with RNAfold input, fold a sequence with rnafold, and more.



data RNAfold Source #

Space-efficient RNAfold structure. RNAfold allows a DNA input, but this is not allowed in this data structure. If you want that, keep the original input string around.

This structure provides only Getter's. Only the sequenceID can be updated via sequenceIDlens. This is to prevent accidental updates of fields that are actually interdependent.

Missing parts are sloppily encoded by bogus values and empty strings. All Folded structures and derived values are lazy. In case rnafold was used to construct the structure, calculations are deferred until needed.

TODO newtype the sequence id.

TODO temperature. How to encode? Kelvin? In BiobaseTypes! Could use (Nat)SciTypes!

TODO complete BP probability array

TODO lazy fields for computation on demand!

TODO Wrapped via Maybe?




  • _sequenceID :: !ByteString

    Set to not . null if the sequence was given a name. This is (likely) a fasta-style identifier.

  • _input :: !RNAseq

    The input sequence, converting into an RNA string.

  • _mfe :: !Folded

    Minimum-free energy and corresponding structure.

  • _mfeFrequency :: !Double

    The mfe frequency can be calculated as follows: exp ((ensemble energy - mfe energy) / kT).

    ^ TODO newtype wrapper?

  • _ensemble :: !Folded

    Uses special syntax with unpaired, weakly paired, somewhat paired, somewhat paired up or down, strongly paired up or down for the ensemble. The energy is the *ensemble free energy*.

  • _centroid :: !Folded

    Centroid energy and structure.

  • _centroidDistance :: !Double

    Centroid distance to ensemble.

  • _diversity :: !Double

    Average basepair distance between all structures in the Boltzmann ensemble

    TODO Needs own newtype?

  • _temperature :: !(Maybe Double)

    Temperature in Celsius

    TODO own newtype Celsius


Eq RNAfold Source # 


(==) :: RNAfold -> RNAfold -> Bool #

(/=) :: RNAfold -> RNAfold -> Bool #

Ord RNAfold Source # 
Read RNAfold Source # 
Show RNAfold Source # 
Generic RNAfold Source # 

Associated Types

type Rep RNAfold :: * -> * #


from :: RNAfold -> Rep RNAfold x #

to :: Rep RNAfold x -> RNAfold #

Arbitrary RNAfold Source # 
NFData RNAfold Source # 


rnf :: RNAfold -> () #

type Rep RNAfold Source # 

rnafold :: RNAseq -> RNAfold Source #

Fold a sequence.

This function is threadsafe via the viennaRNA-mutex.

TODO add temperature parameter

TODO consider creating a "super-lens" that updates whenever _input or _temperature change.

pRNAfold :: RNArewrite -> Double -> Parser RNAfold Source #

Parsing for RNAfold. This should parse all variants that RNAfold produces.

The parser for a Folded structure has to deal with different "energy" types. The different energies are bracketed by different types of brackets.

mfe        (((...))) ( -1.20)
ensemble   (((...))) [ -1.41]
centroid   (((...))) { -1.20 d=1.06}

TODO Move into submodule.

TODO pipes-based streaming parser

TODO how to handle parsing the BP probability array, if known?

TODO I think it is possible to figure the line type based on the energy and the brackets around the energy.

QuickCheck generator for RNAfold. This is slightly unusual but allows