úÎB-><2      !"#$%&'()*+,-./01;FThe folding functions. It could happen that we need different folding K functions with the same type, hence the class-based approach. The default ' instance uses the usual ring methods.  DCalculate the ninio asymmetric malus. Can not be written using ring  functions alone as a 2 or 3 functions is required. Applies a terminal AU/GU penalty, where required.  TODO shouldn'0t this be just: if CG||GC then one else termAU? Apply terminal AU penalty !Blarge hairpin loops >30 require special calculations that involve  4?, rounding and other stuff that can not be handled by the Ring  class alone "#56HSimple hairpin loops. If (i,j) pairs then, first, try to do a lookup of L the exact sequence of the hairpin in a tabulated list. If this fails then, * second, try length 3 hairpins and so on. 7Extend a stem by another pair. 8KThese are special cases of interior loops. Short iloops, such as 1x2 loops 2 are completely tabulated. Look each one up here. &TODO needs 1-bulges as a special case 9JA large number of iloops up to a total maximum loop size of 30 have to be M checked. There are about 300 cases for j-i>>30. In addition, this loop does < not like fusion very much and does many different lookups. MTODO Any performance increase here should yield substantial improvements for 0 the overall performance of folding algorithms. LTODO performance improvement: Split mismatch calculation into its own table 4 in the caller. Callee gets an additional argument. 4TODO didjs needs to go back into a *Limit function. :IA bulge on the left side of the inner closing pair. 1-bulges are treated  as tabulated interior loops.  (..((...)))  01234567890 ;JA bulge on the right side of the inner closing pair. Mirroring bulgeLBase  ((~)...) <H1xn iloops work a bit like bulges. They are more complicated because we  have to consider =! values and terminal mismatches. "TODO how big an improvement would  iloopL1xn be with integrated =  values?  (...(~).) A mirror to the above.  (.(~)...) =Close a multibranch loop by trying to combine one element of m with one  of m1.  [[...]][[...]]  0123456789012345  1 >*Adds a multibranch loop at exactly (i,j). ATrivial function that adds a single unpaired nucleotide within a  multibranch loop. GAdds a multibranch loop at (k,j), with k-i unpaired nucleotides to the  left of k. ? [...]  0123456 $@&A'BJExplicit index generator for interior loops. Does not create indices for:  - bulges 0 k  - 1xn loops 1 k  - 2x3 loops 2 3, 3 2 ! - tabulated 1 1, 1 2, 2 1, 2 2 (CBulge limitations D1xn iloop limits Eclosing of a multibranch loop F add mb helix G mb helix Hadd external loop )  !"#$%&'()  !#"&$%'((!  !  !"#$&'()*+,-.IFolding works on unboxed values of a Ring-type for which a FoldFunctions L instance does exist. By default, we have this for Energy values. Again, we H use a class as we could be interested in probabilistic backtracking or  something like that. )*+,-.IJ.-)*+,)*+,*+,-.&  !)*+,&  !)*+,&  !)*+,&  !)*+,/Sum up a complete (sub-) tree. 0JEvaluate the energy of a secondary structure tree with sequence. We abuse J the normal folding functions with a dummy table full of (one :: Energy). B This is probably slower than another method but quickly written. JTODO this is basically crapfuck ;-) Should use the FoldFunctions directly : instead of that strange table. Should not xxxOpt either. 1@convert an annotated tree into strings that explain each score. TODO this is a stupid name /01KL/01/01M      !"#$%&'()*+,-./0123456789:89;8<=>?@ABCDEFGHIJKLMNOPQRSTUVWXRNAFold-0.0.2.1BioInf.RNAFold.FunctionsBioInf.RNAFoldBioInf.RNAEvalBioInf.RNAFold.EnergyBioInf.RNAFold.EnergyInt FoldFunctionsstackOptstackIdx hairpinOpt hairpinIdxlargeInteriorLoopOptlargeInteriorLoopIdxtabbedInteriorLoopOpttabbedInteriorLoopIdx bulgeLOpt bulgeLIdx bulgeROpt bulgeRIdxinterior1xnLOptinterior1xnLIdxinterior1xnROptinterior1xnRIdxmultibranchIJLoopOptmultibranchIJLoopIdxmultibranchUnpairedJOptmultibranchUnpairedJIdxmultibranchKJHelixOptmultibranchKJHelixIdxmultibranchAddKJHelixOptmultibranchAddKJHelixIdxmultibranchCloseOptmultibranchCloseIdxexternalLoopOptexternalLoopIdxexternalAddLoopOptexternalAddLoopIdx calcNinio calcTermAU calcLargeLoop TurnerTablesTablepairriapringSumL ringProductLtabbedInteriorLoopDistancesFoldfoldfoldST backtrackPairlist ResultTablesrnaEvalannotateWithEnergy explainTreebase GHC.ClassesminmaxGHC.RealfloorCell hairpinBase stackBasetabbedInteriorLoopBaselargeInteriorLoopBase bulgeLBase bulgeRBasemultibranchCloseBaseBiobaseTurner-0.0.2.1Biobase.Turner.TablesniniomultibranchKJHelixBaseexternalAddLoopBaseringSum ringProductinteriorLoopIndices bulgeLimit iloop1xnLimitmultibranchCloseLimitmultibranchAddKJHelixLimitmultibranchKJHelixLimitexternalAddLoopLimitmkTable mkTableWithtreeIJtreeSum