rintc: fast and accuracy-aware decomposition of ... · rintc: fast and accuracy-aware decomposition...

16
RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa 1 , Junichi Iwakiri 1 , and Kiyoshi Asai 1,2, 1 Graduate School of Frontier Sciences, The University of Tokyo, Japan. 2 Artificial Intelligence Research Center (AIRC), National Institute of Advanced Industrial Science and Technology (AIST), Japan. The analysis of secondary structures is essential to understand- ing the function of RNAs. Because RNA molecules thermally fluctuate, it is necessary to analyze the probability distribu- tion of secondary structures. Existing methods, however, are not applicable to long RNAs owing to their high computational complexity. Additionally, previous research has suffered from two numerical difficulties: overflow and significant numerical error. In this research, we reduced the computational com- plexity in calculating the landscape of the probability distribu- tion of secondary structures by introducing a maximum-span constraint. In addition, we resolved numerical computation problems through two techniques: extended logsumexp and accuracy-guaranteed numerical computation. We analyzed the stability of the secondary structures of 16S ribosomal RNAs at various temperatures without overflow. The results obtained are consistent with in vivo assay results reported in previous research. Furthermore, we quantitatively assessed numerical stability using our method. These results demonstrate that the proposed method is applicable to long RNAs. Source code is available on https://github.com/eukaryo/rintc. RNA Secondary Structure | Dynamic Programming | Accuracy-Guaranteed Numerical Computation | Interval Arithmetic | Ribosomal RNA Correspondence: asai @k.u-tokyo.ac.jp Introduction Functional noncoding RNAs (ncRNAs) play essential roles in a wide range of biological phenomena. Secondary struc- tures are often crucial for the function of RNAs. There are a number of studies and software tools that can predict a sin- gle secondary structure for a given RNA. According to de- tailed analyses of free energy, however, some RNAs do not always form a single stable structure. Therefore, quantitative evaluations of the fluctuation of RNA secondary structures have recently attracted attention. Recent studies have pro- vided methods to analyze the distribution of RNA secondary structures in more detail using the marginal probability of the Hamming distance(1), (2), (3). The computational costs of basic algorithms used by previ- ous methods are high, but the Fourier transform has been shown to reduce the time complexity of analysis. (4), (5), (6) Those previous methods, however, cannot be used to an- alyze long ncRNAs (e.g., > 1000 nucleotides) because the computational complexities are still too high. In this paper, we show that further reduction of computational complexity is possible by introducing maximum-span constraint on base- pairs (7). While implementing and experimenting with our proposed method, we encountered two numerical computation prob- lems. The first problem consists of numerical errors caused by Fourier transform. Specifically, the magnitude of numer- ical errors is uniform across large and small marginal proba- bilities, resulting in the small marginal probabilities being un- reliable. This phenomenon occurs because the Fourier trans- form distributes numerical errors in its dynamic program- ming post-processing. A previous research (8) mentioned this type of numerical instability, but they have not shown de- tailed analysis. Accuracy-guaranteed numerical computation may provide quantitative evaluation of numerical instability, but this was unexamined by previous studies. In the context of kinetic analyses, for example, meta-stable structures are particularly interesting (9). Meta-stable structures may have considerably high free energy compared to the minimum free energy structure. In such a case, the Boltzmann probability of the meta-stable region can be very small. For reliable eval- uation of meta-stable regions using distance-wise decompo- sition like RintW, quantitative assessment of the numerical error introduced by the Fourier transform method is neces- sary. Interval arithmetic is a method in which arithmetic operations are defined along intervals expressing numerical values be- tween the upper/lower edges. The approximate calculation of pi by Archimedes in the 3rd century BC is known as the oldest example of interval arithmetic. Around the 1950s, in- terval arithmetic came to be used for estimating the upper bounds on the numerical error caused by floating-point arith- metic in computers. For example, Sunaga (10) published one of the first studies in English on comprehensive algo- rithms for interval arithmetic for computers. Numerical cal- culations, however, have been used in only limited research fields, and few early studies were published. The other numerical problem is that overflow occurs for long sequences. In stochastic models such as hidden Markov models common throughout bioinformatics, logsumexp (log- arithm of summation of exponentials) is the standard solu- tion to prevent overflow or underflow in numerical calcula- tion. There is a limitation, however, in that it cannot handle zero nor negative values. This limitation is a problem when processing complex numbers with rectangular coordinates in Takizawa et al. | bioRχiv | May 31, 2019 | 1–16 . CC-BY 4.0 International license certified by peer review) is the author/funder. It is made available under a The copyright holder for this preprint (which was not this version posted May 31, 2019. . https://doi.org/10.1101/656256 doi: bioRxiv preprint

Upload: others

Post on 04-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

RintC: fast and accuracy-aware decompositionof distributions of RNA secondary structures

with extended logsumexpHiroki Takizawa1, Junichi Iwakiri1, and Kiyoshi Asai1,2,�

1Graduate School of Frontier Sciences, The University of Tokyo, Japan.2Artificial Intelligence Research Center (AIRC), National Institute of Advanced Industrial Science and Technology (AIST), Japan.

The analysis of secondary structures is essential to understand-ing the function of RNAs. Because RNA molecules thermallyfluctuate, it is necessary to analyze the probability distribu-tion of secondary structures. Existing methods, however, arenot applicable to long RNAs owing to their high computationalcomplexity. Additionally, previous research has suffered fromtwo numerical difficulties: overflow and significant numericalerror. In this research, we reduced the computational com-plexity in calculating the landscape of the probability distribu-tion of secondary structures by introducing a maximum-spanconstraint. In addition, we resolved numerical computationproblems through two techniques: extended logsumexp andaccuracy-guaranteed numerical computation. We analyzed thestability of the secondary structures of 16S ribosomal RNAs atvarious temperatures without overflow. The results obtainedare consistent with in vivo assay results reported in previousresearch. Furthermore, we quantitatively assessed numericalstability using our method. These results demonstrate that theproposed method is applicable to long RNAs. Source code isavailable on https://github.com/eukaryo/rintc.

RNA Secondary Structure | Dynamic Programming | Accuracy-GuaranteedNumerical Computation | Interval Arithmetic | Ribosomal RNA

Correspondence: asai @k.u-tokyo.ac.jp

Introduction

Functional noncoding RNAs (ncRNAs) play essential rolesin a wide range of biological phenomena. Secondary struc-tures are often crucial for the function of RNAs. There are anumber of studies and software tools that can predict a sin-gle secondary structure for a given RNA. According to de-tailed analyses of free energy, however, some RNAs do notalways form a single stable structure. Therefore, quantitativeevaluations of the fluctuation of RNA secondary structureshave recently attracted attention. Recent studies have pro-vided methods to analyze the distribution of RNA secondarystructures in more detail using the marginal probability of theHamming distance(1), (2), (3).The computational costs of basic algorithms used by previ-ous methods are high, but the Fourier transform has beenshown to reduce the time complexity of analysis. (4), (5),(6) Those previous methods, however, cannot be used to an-alyze long ncRNAs (e.g., > 1000 nucleotides) because thecomputational complexities are still too high. In this paper,we show that further reduction of computational complexity

is possible by introducing maximum-span constraint on base-pairs (7).While implementing and experimenting with our proposedmethod, we encountered two numerical computation prob-lems. The first problem consists of numerical errors causedby Fourier transform. Specifically, the magnitude of numer-ical errors is uniform across large and small marginal proba-bilities, resulting in the small marginal probabilities being un-reliable. This phenomenon occurs because the Fourier trans-form distributes numerical errors in its dynamic program-ming post-processing. A previous research (8) mentionedthis type of numerical instability, but they have not shown de-tailed analysis. Accuracy-guaranteed numerical computationmay provide quantitative evaluation of numerical instability,but this was unexamined by previous studies. In the contextof kinetic analyses, for example, meta-stable structures areparticularly interesting (9). Meta-stable structures may haveconsiderably high free energy compared to the minimum freeenergy structure. In such a case, the Boltzmann probabilityof the meta-stable region can be very small. For reliable eval-uation of meta-stable regions using distance-wise decompo-sition like RintW, quantitative assessment of the numericalerror introduced by the Fourier transform method is neces-sary.Interval arithmetic is a method in which arithmetic operationsare defined along intervals expressing numerical values be-tween the upper/lower edges. The approximate calculationof pi by Archimedes in the 3rd century BC is known as theoldest example of interval arithmetic. Around the 1950s, in-terval arithmetic came to be used for estimating the upperbounds on the numerical error caused by floating-point arith-metic in computers. For example, Sunaga (10) publishedone of the first studies in English on comprehensive algo-rithms for interval arithmetic for computers. Numerical cal-culations, however, have been used in only limited researchfields, and few early studies were published.The other numerical problem is that overflow occurs for longsequences. In stochastic models such as hidden Markovmodels common throughout bioinformatics, logsumexp (log-arithm of summation of exponentials) is the standard solu-tion to prevent overflow or underflow in numerical calcula-tion. There is a limitation, however, in that it cannot handlezero nor negative values. This limitation is a problem whenprocessing complex numbers with rectangular coordinates in

Takizawa et al. | bioRχiv | May 31, 2019 | 1–16

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 2: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

Fourier transform. One solution is to apply logsumexp onlyto radii using polar coordinates, but simple application of po-lar coordinates causes problems when combined with inter-val arithmetic for accuracy-guaranteed numerical computa-tion. Complicated conditions occur when the angular intervalcrosses zero or the radius interval contains zero. In this paper,in addition to a radius of polar coordinates, normalized or-thogonal coordinates, rather than angles, are combined. Con-sequently, we can realize the advantages of logsumexp andinterval arithmetic while preserving the simplicity of imple-mentation.We introduced maximum-span constraint to RintW in orderto reduce the computational costs. While Turner energy pa-rameters have been determined by experiments using shortRNA, the computational analysis tends to be unstable whenRNA can form long range base-pairs (11). Our method lostlittle by excluding long range base-pairs.

Methods

A. RintW + maximum-span. At first, we introducedmaximum-span constraint in base pairs to the baseline al-gorithm of RintW (6). Detailed descriptions of RintW andthe proposed method are in the accompanying supplementaryfile. The inputs of the algorithm are an RNA sequence and areference secondary structure, and the outputs are the exis-tence probability and the base pairing probability matrix foreach Hamming distance from the reference secondary struc-ture.

A.1. the representation of RNA secondary structure. As acomputer-efficient expression, the RNA secondary structurewas represented by a binary upper triangular matrix σ whereeach element was {0,1}. Each element of σ was decided asfollows.

σi,j ={

1 (i < j and (i, j) forms a base pair)0 (otherwise)

The distance between two RNA secondary structures σ1,σ2were determined by the number of elements with differentvalues, namely, Hamming distance.It was also possible to use distance other than Hamming dis-tance (5), but this time Hamming distance was used. The rea-son is that when the RNA secondary structure changes withtime, it can be considered to be limited to the change of theHamming distance 1, that is, whether one base pair is gener-ated or extinguished. Hamming distance is a natural distancein that sense. Also, many previous studies (1), (4), (6) usedHamming distance, which was considered to be a standardmethod. For example, 5’-3’ distance (12) is known as a dis-tance other than the Hamming distance, but introducing thiswas out of scope of this work.Only secondary structures that satisfy the following con-straints were considered. N = sequence length.

1. Watson-Crick base pairs(A-T, C-G) or wobble basepairs(G-U) only exist.

2. (prohibition of pseudo-knot) for all 1≤ i < j < k < l≤N , (i,k) and (j, l) do not form base pairs at the sametime.

3. (max loop constraint) for all 1 ≤ i < j < k < l ≤ N ,if (i, l) and (j,k) form base pairs and no paired baseexists between i+ 1 and j− 1 nor between k+ 1 andl− 1, then j− i+ l−k ≤ C+ 2. C is a max-loop pa-rameter, and We usedC = 30 following many previousworks.

4. (max span constraint) for all 1 ≤ i < j ≤ N , if (i, j)forms a base pair, then j− i≤W .

1. and 2. were the standard constraints used in the previousmethods (1), (4), (6). 3. is called max loop constraint. Thisconstraint was adopted by many of RNA secondary structureanalysis methods using the energy model (13) described inthe next section. This constraint reduces the time complexity.It is empirically known that this constraint has little effecton the calculation result. 4. is a constraint being studied inother previous works (14), (15), (7), (16), (11), but it was notused in the research by RintW(6) and we introduced it. Thisconstraint is considered to be suitable for examining localstructural motifs. (11) )

A.2. energy model. Each structure was considered to haveenergy, and this Boltzmann probability was analyzed. Anenergy model (13) that can be analyzed by dynamic program-ming was adopted. In this model, the energy of the secondarystructure was expressed by the sum of the following func-tions.

1. fh(i, j) = the energy of base pair (i, j) forming a hair-pin loop.

2. fl(i, j,k, l) = the energy of base pair (i, l) and (j,k)making a 2-Loop when i < j < k < l .

3. fmc = the energy of having one multi loop.

4. fmi = the energy of having one internal branch ofmulti loop.

5. fd(i, j) = the energy of base pair (i, j) forming a multiloop or being an outermost base pair.

A.3. polynomial approach. In previous researches (4), (5),(6), the polynomial approach was used as a method to re-duce the time complexity of dynamic programming. For de-tails of the approach, see the description of the previous arti-cles. Briefly, a naïve dynamic programming method requiresa convolution operation. This operation is regarded as com-putation in the spatial domain and is expressed by calculationin the frequency domain. Convolution operation can be con-verted to an inner product, and the computational complex-ity is reduced. After completing the dynamic programmingcomputation, shift to the spatial domain by performing theFourier transform. The same method was used in this study.

2 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 3: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

A RintW + maximum-span

A.4. Preprocessing. As in the RintW algorithm, we calculate the following gZ0 (i, j) functions in O(N2) time as preprocessing,to obtain the gains of the Hamming distance gZ1 to gZ8 and gW1 to gW5for (1≤ i≤N)

gZ0 (i, i) = gZ0 (i, i−1) = 0

for (1≤ i < j ≤N)

gZ0 (i, j) =j−1∑p=i

j∑q=p+1

σpq

= σij +gZ0 (i+1, j)+gZ0 (i, j−1)−gZ0 (i+1, j−1)

where σ is a binary matrix representation of the reference secondary structure. The maximum Hamming distance of thesecondary structure from the representative secondary structure (Hmax) is also computed at this time (5).

A.5. Definitions of Function gs.

b(i, j) = 1−2σijgZ1 (i, j) = gZ0 (i, j)

gZ2 (i, j,k) = gZ0 (i, j)−gZ0 (i,k)−gZ0 (k+1, j)gZ3 (i, j,k) = gZ0 (i, j)−gZ0 (i,k)gZ4 (i, j) = gZ0 (i, j)+ b(i, j)

gZ5 (i, j,k, l) = gZ0 (i, j)−gZ0 (k, l)+ b(i, j)gZ6 (i, j,k) = gZ0 (i, j)−gZ0 (i+1, j−1)−gZ0 (k,j−1)+ b(i, j)gZ7 (i, j,k) = gZ0 (i, j)−gZ0 (k,j)gZ8 (i, j,k) = gZ0 (i, j)−gZ0 (i,k−1)−gZ0 (k,j)gZ9 (i, j,k) = gZ3 (i, j,k)gW1 (i, j) = gZ0 (1,N)−gZ0 (i, j)−gZ0 (1, i−1)−gZ0 (j+1,N)

gW2 (i, j,h, l) = gZ0 (h, l)−gZ0 (i, j)+ b(h, l)gW3 (i, j,h, l) = gW2 (i, j,h, l)−gZ0 (h+1, i−1)gW4 (i, j,h, l) = gW2 (i, j,h, l)−gZ0 (j+1, l−1)gW5 (i, j,h, l) = gW2 (i, j,h, l)−gZ0 (h+1, i−1)−gZ0 (j+1, l−1)

These functions calculate the Hamming distance of a substructure from the reference substructure. These functions were alsoused in previous researches. (5), (6) According to Mori et al. research (5), by changing this function, one can decomposethe structures by another distance indicator. (i.e. other than the Hamming distance) This indicates a further potential of thisconcept, but it was out of the scope of this study to examine it.

A.6. Dynamic programming of the partition function. In the following equations, x is the (Hmax + 1)-th root of unity. IfCooley–Tukey fast Fourier transform (FFT) is used instead of discrete Fourier transform (DFT) in post-processing, x is thesmallest power of 2 that is equal to or greater than (Hmax+ 1). There are (Hmax+ 1) kinds of (Hmax+ 1)-th roots of unitycalculated independently. Therefore, parallel computation is possible.In order to avoid overflow, the proposed extended logsumexp is used. In the following equations, g∗∗ and− f∗

kT are real numbers,

but xg∗∗ and e−

f∗kT are converted into complex logsumexp type. Consequently, All DP-variable Z∗∗,∗, W

∗∗,∗, and Q∗∗,∗ are also

complex logsumexp type.Initialization:

for (1≤ i≤N)Zi,i = Zi,i−1 = 1Z1i,i = Zbi,i = Zmi,i = Zmi,i−1 = Zm1

i,i = 0

W b1,N =

{1 ((1,N) forms a base pair)0 (otherwise)

Takizawa et al. | RintC bioRχiv | 3

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 4: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

Recursion:for (1≤ i < j ≤N) s.t. (j− i≤W )

Z1,j = xgZ1 (1,j) +

j−1∑h=1

Z1,h−1Z1h,jx

gZ2 (1,j,h)

Zi,N = Zi+1,NxgZ

7 (i,N,i+1)+min(N,i+W )∑

h=i+1Zbi,he

− fd(i,h)kT Zh+1,Nx

gZ2 (i,N,h)

Z1i,j =

min(j,i+W )∑h=i+1

Zbi,he− fd(i,h)

kT xgZ3 (i,j,h)

Zbi,j = e−fh(i,j)

kT xgZ4 (i,j)

+min(i+C+1,j−2)∑

h=i+1

j−1∑l=max(h+1,j+h−i−C−2)

Zbh,le− fl(i,h,l,j)

kT xgZ5 (i,h,l,j)

+j−1∑h=i+2

Zmi+1,h−1Zm1h,j−1e

− fd(j,i)+fmckT xg

Z6 (i,j,h)

Zmi,j =j−1∑h=i

(xgZ7 (i,j,h) +Zmi,h−1x

gZ8 (i,j,h))Zm1

h,j

Zm1i,j =

j∑h=i+1

Zbi,he− fd(i,h)+fmi

kT xgZ3 (i,j,h)

W bi,j = Z1,i−1Zj+1,Ne

− fd(i,j)kT xg

W1 (i,j)

+i−1∑

h=max(1,i−C−1,i−W )

min(N,h+W,j+h−i+C+2)∑l=j+1

W bh,le− fl(h,i,j,l)

kT xgW2 (h,i,j,l)

+i−1∑

h=max(1,i−W )

min(N,h+W )∑l=j+1

W bh,le− fd(l,h)+fmc+fd(i,j)+fmi

kT (

Zmh+1,i−1xgW

3 (h,i,j,l)

+Zmj+1,l−1xgW

4 (h,i,j,l)

+Zh+1,i−1Zj+1,l−1xgW

5 (h,i,j,l))Qbi,j = Zbi,jW

bi,j

The Z∗,∗ functions are the inside partition functions, which represent the sums of all the Boltzmann factors in the correspondingsub-sequences. Z1

∗,∗, Zb∗,∗, Z

m∗,∗, and Zm1

∗,∗ are the specified partition functions defined in the McCaskill algorithm (17). W bi,j is

the outside partition function, which represents the outside of the base-pair (i, j). The Qbi,j is the conditional partition function,the sum of all the Boltzmann factors when (i, j) forms a base pair.The values gZ1 to gZ8 and gW1 to gW5 , which are computed using the pre-computed function gZ0 (i, j), are the gains of theHamming distance for the transitions represented by the recursions of partition functions. The significant difference fromRintW is that the recursions of Z1,n, Z1

i,j , and W bi,j include the maximum-span constraint W of base-pairs in their range of the

sum. A small improvement is that only edges are considered in the sum for Z∗,∗ (Z1,j and Zi,N ). Regarding the maximum-span constraint of base pairs, the algorithmic concept is equivalent to the calculation of dynamic programming (DP) variablesαOuter and βOuter in Rfold (7) and ParasoR (11), but the notation of RintW is followed in the above recursions.

4 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 5: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

B Interval arithmetic and accuracy assurance

A.7. Fourier transform and post-processing. For all (i, j),such as (1 ≤ i ≤ j ≤ N) and (j− i ≤W ), by consideringQbi,j and Z1,N of (Hmax + 1) ways as a complex numbersequence of (Hmax + 1) elements and performing Fouriertransformation, the conditional partition functions on eachHamming distance are obtained. Let Z(d)1,N and Q(d)bi,jbe the conditional partition functions on Hamming distanced of Z1,n and Qbi,j , respectively. Then, the existence proba-bility on Hamming distance d is written as

Z(d)1,N∑Hmaxd=0 Z(d)1,N

,

and the base-pairing probability on Hamming distance d iswritten as

Q(d)bi,jZ(d)1,N

.

A.8. Computational complexity. In the following description,N is the length of the sequence, Hmax is the maximumHamming distance from the reference structure, and U isthe degree of parallelism. Here U ≤ Hmax + 1 is as-sumed. In the original RintW algorithm, the computa-tional complexity of pre-processing is O(N2) in both timeand space. In the partition function calculation, the timecomplexity is O(N4Hmax/U) and the space complexity isO(N2HmaxU). The original RintW uses DFT for post-processing; the time complexity of post-processing part isO(N2H2

max/U), and its space complexity is O(HmaxU).SinceHmax ≤N holds, the computational complexity of thepost-processing can be ignored in total complexity in bothtime and space. Finally, the time and space complexity ofthe original RintW algorithm as a whole areO(N4Hmax/U)and O(N2HmaxU), respectively.When the maximum-span constraint is introduced, the com-putational complexity of pre-processing remains O(N2) inboth time and space. In the distribution function calculation,the time complexity is O(NW 3Hmax/U), and the spacecomplexity is O(NWHmaxU) for the maximum-span ofbase pair W . When DFT is used for post-processing, thecomplexity of the post-processing is O(NWH2

max/U) intime and O(HmaxU) in space. Because the Hmax valuemay be close toN , the computational complexity of the post-processing cannot be ignored. By using FFT instead of DFT,we can reduce the time complexity of the post-processingcomponent to O(NWHmaxlog(Hmax)/U). Then, the to-tal computational complexity is O(N(N +WHmax(W 2 +log(Hmax))/U)) in time and O(N(N + WHmaxU)) inspace.The summary of computational complexities is shown, withthe notation simplified by using Hmax ≤N , in Table 1.

B. Interval arithmetic and accuracy assurance. In thissubsection we briefly explain the rounding mode controlfunction of IEEE 754, and the accuracy assurance arithmetic.Representing real numbers by floating-point numbers cancause deviations from actual values. Therefore, numerical

values can conceivably be held as an interval including theactual value. We define arithmetic operations between inter-vals to obtain an interval necessarily containing the resultsof arithmetic operations on actual values. Then, the upperbound of the numerical error is obtained as the width of theinterval of the calculation result. Most modern computersuse the IEEE 754 method for floating-point arithmetic. Thismethod has a rounding mode control function, and we canspecify truncation and rounding-up. By using this function,the accuracy assurance calculation described above can beexecuted efficiently.Our accuracy assurance calculation used the kv library (18))implemented in C++. The kv library is open source softwareand requires only C++ Boost for its backend.

C. Logsumexp on complex numbers with intervalarithmetic. A method to perform logsumexp on whole com-plex numbers has been developed. Details of the calculationalgorithm are provided in the following subsections. Thereare different parts of algorithms for scalar and interval types,but those for scalar types are described in the supplementaryfile. In this subsection, only methods for interval types aredescribed. If only the scalar type is considered, the complexnumber defined in polar coordinates and logsumexp definedonly in terms of a radius are sufficient. Extensions to intervalarithmetic, however, are complicated.The Vienna RNA Package (19) prevents overflow by scaling.Their scaling factor construction is sophisticated, and undersome assumptions, their scaling is equivalent to a kind of log-sumexp. The original RintW (6) also utilized the same scal-ing technique as Vienna. However, with Vienna’s method, thedeviation between the scaling factor and the value of the ac-tual distribution function can increase exponentially, so over-flowing cannot be completely avoided. Unlike them, logsum-exp does not need scaling factors, and overflows are com-pletely avoided.

C.1. Notation and representation. In this subsection, a brack-eting character like [x] indicates an interval type variable. Apair of values in a bracket (e.g., [0,1]) indicates a closed in-terval. When two variables are enclosed (e.g., [x,y]), eachvariable x and y is a scalar type (or floating-point type), notan interval type. It is possible to convert one scalar x into aninterval type while guaranteeing accuracy. Such an intervalvariable is expressed as [x,x] (i.e., [x,x] is an interval that in-cludes the real value x). Finally, a function fupper([x]) = ufor obtaining the maximum value of the interval type variable[x] = [l,u], a function flower([x]) = l for obtaining the min-imum value, and a function fmid([x]) = l+u

2 for obtainingthe median value are used. It is assumed that they are notnecessarily accuracy-guaranteed. In this subsection, the baseof log is e.To represent the complex number [a] + [b]i, ([r], [c], [d]) isheld for

[a]+ [b]i⊆ e[r]([c]+ [d]i)

.

Takizawa et al. | RintC bioRχiv | 5

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 6: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

RintW, time RintC (proposed), timepreprocessing O(N2) O(N2)

main calculation O(N5/U) O(N2W 3/U)postprocessing (DFT) O(N4/U) O(N3W/U)postprocessing (FFT) O(N3logN/U) O(N2WlogN/U)

total (DFT) O(N5/U) O(N2W (W 2 +N)/U)total (FFT) O(N5/U) O(N2W (W 2 + logN)/U)

RintW, space RintC (proposed), spacepreprocessing O(N2) O(N2)

main calculation O(N3U) O(N2WU)postprocessing (DFT) O(NU) O(NU)postprocessing (FFT) O(NU) O(NU)

total (DFT) O(N3U) O(N2WU)total (FFT) O(N3U) O(N2WU)

Table 1. Computational complexity of the existing and proposed methods are summarized. N = sequence length. W = maximum-span. Note thatHmax ≤N andW ≤Nalways holds. U = degree of parallelism.

However, as a normalization condition,

fupper([c]2 +[d]2) ={

0 ([a] = [0,0] and [b] = [0,0])1 (otherwise)

must be satisfied. It is assumed that 1 is numerically almost1. The difference from 1 accumulates by multiplication, butit is reset by addition. For convenience, [r] = [0,0] must besatisfied when ([a] = [0,0] and [b] = [0,0]).

The normalization protocol and conversion protocol betweenthis and usual representation are described in the supplemen-tary file. Multiplication and addition protocols are describedbelow.

C.2. Multiplication. The multiplication of the two values([r1], [c1], [d1]) and ([r2], [c2], [d2]) can be described as

([r1], [c1], [d1])([r2], [c2], [d2])

= e[r1]([c1]+ [d1]i)e[r2]([c2]+ [d2]i)

= e[r1]+[r2]([c1]+ [d1]i)([c2]+ [d2]i)

= e[r1]+[r2](([c1][c2]− [d1][d2])+([c1][d2]+ [d1][c2])i),

and ([r1] + [r2], [c1][c2]− [d1][d2], [c1][d2] + [d1][c2]) is ob-tained as a solution. In normalization post-processing, if[c1][c2]− [d1][d2] = [c1][d2] + [d1][c2] = [0,0], [r] = [0,0] issubstituted. Otherwise, because the product of the complexnumbers with absolute value 1 is absolute value 1, it is natu-rally normalized.

Algorithm 1 Multiplication

Input: (([r1], [c1], [d1]),([r2], [c2], [d2]))::((Interval,Interval,Interval),(Interval,Interval,Interval))where

IsNormalized([r1], [c1], [d1]) = True andIsNormalized([r2], [c2], [d2]) = True

Output: ([r], [c], [d])::(Interval,Interval,Interval) wheree[r]([c]+ [d]i)⊇ e[r1]([c1]+ [d1]i)e[r2]([c2]+ [d2]i) andIsNormalized([r], [c], [d]) = True

1: [r]⇐ [r1]+ [r2]2: [c]⇐ [c1][c2]− [d1][d2]3: [d]⇐ [c1][d2]+ [d1][c2]4: if ([c], [d]) = ([0,0], [0,0]) then5: [r]⇐ [0,0]6: end if7: return ([r], [c], [d])

C.3. Addition. Consider the sum of the two values([r1], [c1], [d1]) and ([r2], [c2], [d2]). Since addition iscommutative, assuming fmid([r1]) ≥ fmid([r2]) does notdecrease generality. Then, it can be formulated as

p= fupper([r1])−fmid([r1])+fupper([r2])−fmid([r2]) (p≥ 0)

and

([r1], [c1], [d1])+([r2], [c2], [d2])

= e[r1]([c1]+ [d1]i)+e[r2]([c2]+ [d2]i)

= e[r1]([c1]+ [d1]i)+e[r1](e[r2]−[r1][c2]+e[r2]−[r1][d2]i)

= e[r1](([c1]+e[r2]−[r1][c2])+([d1]+e[r2]−[r1][d2])i)

= e[r1]+[p,p]((e−[p,p][c1]+e[r2]−[r1]−[p,p][c2])

+(e−[p,p][d1]+e[r2]−[r1]−[p,p][d2])i).

Thus, fupper(e−[p,p]) ≤ 1 follows from the assumption ofp ≥ 0. Additionally, fupper(e[r2]−[r1]−[p,p]) ≤ 1 follows

6 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 7: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

D Experimental procedure

from the assumption that fmid([r1])≥ fmid([r2]) (the proofis provided in the Supplementary materials). Thereforee−[p,p] and e[r2]−[r1]−[p,p] can be directly calculated with-out overflow occurring. Therefore,

[r′] = [r1]+ [p,p]

[c′] = (e−[p,p][c1]+e[r2]−[r1]−[p,p][c2])

[d′] = (e−[p,p][d1]+e[r2]−[r1]−[p,p][d2])

can be calculated, and ([r′], [c′], [d′]) satisfies

([r1], [c1], [d1])+([r2], [c2], [d2]) = ([r′], [c′], [d′])

as the summation. Finally, since this is not normalized, nor-malization processing is required.

Algorithm 2 Addition

Input: (([r1], [c1], [d1]),([r2], [c2], [d2]))::((Interval,Interval,Interval),(Interval,Interval,Interval))where

IsNormalized([r1], [c1], [d1]) = True andIsNormalized([r2], [c2], [d2]) = True

Output: ([r], [c], [d])::(Interval,Interval,Interval) wheree[r]([c] + [d]i) ⊇ e[r1]([c1] + [d1]i) + e[r2]([c2] + [d2]i)andIsNormalized([r], [c], [d]) = True

1: if fmid([r1])< fmid([r2]) then2: return Addition(([r2], [c2], [d2]),([r1], [c1], [d1]))3: end if4: p ⇐ fupper([r1]) − fmid([r1]) + fupper([r2]) −fmid([r2])

5: [k1]⇐ e−[p,p]

6: [k2]⇐ e[r2]−[r1]−[p,p]

7: [r]⇐ [r1]+ [p,p]8: [c]⇐ [k1][c1]+ [k2][c2]9: [d]⇐ [k1][d1]+ [k2][d2]

10: return Normalize([r], [c], [d])

In the classic logsumexp, it is known that one can reduce thenumerical error of summation by using summation-specifictechnique than recursively using the two-operand additionfunction. For the summation-specific technique, in three ormore operands, one choice the maximum number as the scal-ing factor and scale the others. On the other hand, we de-veloped only the normal two-operand addition function. Fol-lowing experiment showed that our method brings sufficientnumerical accuracy. Nevertheless, further improvement maybe still possible.

C.4. Requirements for an accuracy assurance calculation li-brary. The functions that the accuracy assurance calculationlibrary must perform in this method are as follows:

1. The conversion from scalar to interval type guaranteesaccuracy.

0 100 200 300 400 500 600

sequence length (nt)

0

0.5

1

1.5

2

2.5

tim

e (

s)

× 104 Computation Time

W=100 (ours)W= N (RintW)

Fig. 1. Calculation time of the proposed method. The red solid line representsy = 0.0010101x2. The purple dashed line represents y = 3.0163e− 10x5.Both lines were obtained by fitting to the result using the least squares method.

2. Four arithmetic operations, log, and exp, with accuracyassurance for the interval type.

3. The previously described fupper([x]) and fmid([x]).

Results and Discussion

D. Experimental procedure. The S151 Rfam Dataset‘with all pseudoknots removed’ (20) was used for evaluationof time complexity and numerical accuracy in interval oper-ation.For the application of our proposed method to RNAmolecules longer than those in the S151 Rfam dataset (20),the primary sequences and the corresponding native sec-ondary structures of 16S rRNAs were obtained from three-dimensional structures of E. coli and T. thermophilus 70Sribosomes from the Nucleic Acid Database (NDB, (21),(22). The NDB IDs of the E. coli and T. thermophilus ri-bosome structures were 4V9D (chainID: AA)(23) and 4V51(chainID: AA)(24), respectively. As the secondary struc-tures of these 16S rRNAs, base pairs were selected accordingto the "base pair hydrogen bonding classification" providedby NDB. Specifically, base-pairs were classified as 1 in theLeontis–Westhof classification (25) and either 19, 20, or 28 inthe Saenger classification (26). Base-to-base correspondencebetween the primary sequence and its secondary structure(derived from the three-dimensional structure in which sev-eral residues are missing) was estimated using Needleman–Wunsch alignment (27).The energy parameter rna_turner2004.par included in the Vi-enna RNA package (19) version 2.4.9 was used. However,the source code itself of Vienna was not used. The algorithmswere implemented by the authors, except for parameter filereading, which is based on ParasoR’s implementation. (11)

E. Computation time. To demonstrate computational effi-ciency, the computation time of the proposed method usingthe S151 Rfam Dataset (20) was measured. In the proposedmethod, the reference structures were obtained by Centroid-Fold (28)(γ = 1.0). All cores of the Intel Core i7 4770 CPUwere used as a computational resource in this measurement.

Takizawa et al. | RintC bioRχiv | 7

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 8: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

0 100 200 300 400 500 600

sequence length (nt)

0.01

0.1

1

10

100

1000

10000

100000ti

me

(se

con

d)

computation timeW=50

W=100

W=200

W=400

W=N

Fig. 2. Calculation time of the proposed method. Each data point is the calculationtime of a single sequence from S151Rfam dataset.

35 40 45 50 55temperature (Celsius)

150

200

250

300

350

400

450

500

550

Cre

dib

ility

Lim

it (

0.5

)

Thermal-stability Analysis of 16S rRNAs

E.coli , initial reference E.coli , refined reference T.thermophilus, initial reference T.thermophilus, refined reference E.coli , natural reference T.thermophilus, natural reference

Fig. 3. Thermal-stability analysis for secondary structures of E. coli and T. ther-mophilus 16S rRNAs. The "initial reference" is the reference structure obtainedusing CentroidFold. The "refined reference" is the reference structure obtained us-ing RintC and the base-pairing probability matrix (BPPM) (see the section "Thermalstability of ribosomal RNA" for the details). The "natural reference" is the referencestructure derived from the three-dimensional structure. The "experimental proce-dure" section provides a detailed description about the "natural reference."

We measured the computation time in the case where themaximum-span constraint W = 100 is introduced and in thecase where no restriction is applied (equivalent to RintW (6)(Figure 1). This result shows the computation time of themethods using the constraint W = 100 and no-restrictionroughly, which follow the theoretical complexities of thesquare and fifth power, respectively, confirming that com-putational complexity can be reduced by introducing themaximum-span constraint into the proposed method.We also examined how the calculation time changes when thevalue of the maximum-span constraint W is changed (Figure2). 32 Cores of the Intel Xeon Gold 6130 were used as acomputational resource in this experiment. As a result, whenN ≤W , the same calculation time is required regardless ofthe value of W . When W < N , the calculation time is re-duced by the effect of the maximum-span.

F. Thermal stability of ribosomal RNA. As an applicationof the proposed method, we analyzed the thermal stability of

the secondary structures of 16S rRNAs derived from E. coliand T. thermophilus using Credibility Limit (29) as a met-ric. Credibility Limit is a distance in which a certain per-centage of structures is distributed. The larger the Credibil-ity Limit value, the more intense the thermal fluctuation ofthe molecule. The Credibility Limit (0.5) was obtained fromthe Hamming distances of the secondary structures under theproposed method with temperatures ranging from 37 to 55degrees Celsius (Figure 3). For the 16S rRNAs, three types ofreference structure were prepared. (i) The "initial reference"was obtained using CentroidFold. (ii) The "refined reference"was obtained by the following steps: RintC was performedwith the initial reference; a region whose existence probabil-ity is locally high was chosen; BPPM of the region was calcu-lated; and CentroidFold was used to determine a "refined ref-erence" from the BPPM. (iii) The "natural reference" was thereference structure derived from the three-dimensional struc-ture in NDB. This result shows that the rRNA of thermophilicbacteria T. thermophilus had a lower Credibility Limit thanthat of E. coli, which suggests that the thermal stability of T.thermophilus rRNA is higher than that of E. coli rRNA. Ac-cording to an in vivo assay (30), thermophilic bacteria havereduced dynamics of intracellular macromolecules comparedwith mesophilic bacteria. Our experimental result is consis-tent with their results. The use of the natural secondary struc-ture as a representative structure exhibited a relatively higherCredibility Limit, compared with the "initial" and "refined"references. This implies the DP calculation with the Turnermodel is compatible for the representative structure derivedfrom the Turner model, such as the "initial" and "refined" ref-erences. Note that this result would not indicate the advan-tage of "initial" and "refined" references over the "natural"reference.

G. Numerical error evaluation. For a quantitative evalua-tion of RintC numerical error, accuracy-guaranteed numer-ical computations with interval arithmetic were applied tothe calculation process of RintC with the RF00008B se-quence in the S151 Rfam dataset (20). The length of theRF00008B sequence was short enough for the evaluationof time-consuming calculation without any type of Fouriertransform. The numerical errors of three types of calcula-tion (DFT, FFT, and non-FFT) are shown in Figure 4. Forthe DFT and FFT methods, in this result, the numerical error(i.e., interval width) is almost equal to 1, when the calculatedexistence probability is quite small. Interval width = 1 indi-cates that the probability is within [0,1], provides no mean-ingful information owing to numerical error. In contrast, thenumerical error remains low when the existence probabilityis moderate or high. DFT-based results are slightly moreaccurate than FFT-based results. In further numerical errorcomparisons between non-Fourier transform results and DFTor FFT results, the numerical error of the non-Fourier resultis smaller than those of the DFT or FFT results. This im-plies that the problematic numerical error is indeed causedby Fourier transform.The numerical error evaluation was also conducted for all se-quences in the S151 Rfam dataset and E. coli 16s rRNA (Fig-

8 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 9: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

G Numerical error evaluation

-15 -10 -5 0

result value (log10

[median of interval])

-40

-35

-30

-25

-20

-15

-10

-5

0

nu

me

rica

l err

or

(lo

g 10[w

idth

of

inte

rva

l])

Numerical Error with DFT

-15 -10 -5 0

result value (log10

[median of interval])

-40

-35

-30

-25

-20

-15

-10

-5

0

nu

me

rica

l err

or

(lo

g 10[w

idth

of

inte

rva

l])

Numerical Error with FFT

-15 -10 -5 0

result value (log10

[median of interval])

-40

-35

-30

-25

-20

-15

-10

-5

0

nu

me

rica

l err

or

(lo

g 10[w

idth

of

inte

rva

l])

Numerical Error without Fourier Transform

-15 -10 -5 0

result value (log10

[median of interval])

-40

-35

-30

-25

-20

-15

-10

-5

0

nu

me

rica

l err

or

(lo

g 10[w

idth

of

inte

rva

l])

Numerical Error Comparison

DFTFFTwithout FT

Fig. 4. The result of the numerical error experiment with RF00008B(54 nucleotides). The leftmost plot explains the convex hulls for the result values and their errors undereach experimental condition. The three plots to the right are scatter plots of the raw data for the result values and errors under one experimental condition and the convexhulls for each. In this evaluation, the reference structure was obtained by CentroidFold.

-14 -12 -10 -8 -6

DFT accuracy (decimal)

-13

-12

-11

-10

-9

-8

-7

-6

-5

-4

FF

T a

ccu

racy

(d

eci

ma

l)

Accuracy: DFT vs. FFT

S151RfamrRNAy = x

0 500 1000 1500 2000

seq length (nt)

-14

-13

-12

-11

-10

-9

-8

-7

-6

DF

T a

ccu

racy

(d

eci

ma

l)

Accuracy vs. Seq Lengtha b

Fig. 5. The results of the numerical error experiment. (a) Numerical error compar-ison. (b) Relationship between sequence length and numerical error. The x and yaxes have minima of (log10(median) + log10(width)) under the DFT and FFTmethods. The reference structure was obtained using CentroidFold.(28) (γ = 1.0)

ure 5). Each data point corresponds to an individual sequencein the S151 Rfam dataset or E. coli 16s rRNA. In comparisonsof the numerical errors between DFT and FFT versions (Fig-ure 5a), DFT is always more accurate than FFT. This resultis consistent with that shown in Figure 4. In addition, a re-lationship between the numerical error and sequence lengthin the DFT results was also investigated (Figure 5b). Thisresult demonstrates that the numerical error of 16S rRNA isalmost equal to -7, which suggests that the numerical errorfor long RNA sequences (≥ 1000 nt) is sufficiently small forstructures with a moderate or high probability of existence.This accuracy is sufficient for thermal stability analysis be-cause an accurate evaluation of large clusters is only requiredfor their analysis.

ConclusionsSince RNA secondary structures have large thermal fluctu-ations, prediction of the most stable secondary structure isinsufficient for representing native structural behavior of anRNA molecule. Marginal probabilities on Hamming dis-tances from reference structures, which represent the land-scape of all the possible RNA secondary structures, can beefficiently computed by combining Fourier transform withdynamic programming, but the computational costs are stilltoo high for long RNAs.In this research, we have implemented a maximum-span con-straint of base pairs to reduce computational complexity. For

long RNAs, however, there remains another problem: numer-ical overflow. Since the standard method for avoiding over-flow in stochastic models, logsumexp (logarithm of sum ofexponentials), is not directly applicable to Fourier transform,we have developed an extended logsumexp method for wholecomplex numbers. We have shown that reduced computa-tional time enables us to analyze the thermal-stability of longRNAs, such as 16S ribosomal RNAs.We have also adopted accuracy-guaranteed numerical com-putation with interval arithmetic to evaluate numerical errors.We have shown that numerical errors for small probabilitiesare substantial when FFT or DFT is used. Quantitative as-sessment of the observed numerical instabilities, however,reveal that our method achieves sufficient numerical accu-racy for thermodynamic stability analysis of RNA secondarystructures. These results demonstrate that our method is apowerful tool for understanding long RNAs.

ACKNOWLEDGEMENTSThe authors deeply thank the developers of the RintW, ParasoR, and ViennaRNAPackage implementations, which were necessary for the developed software tool.The authors also deeply thank Dr. Shun Sakuraba, who suggested the possibleapplication of maximum-span constraint and numerical problems in previous re-search. The authors also thank members of the Artificial Intelligence ResearchCenter, AIST, and Hisanori Kiryu’s laboratory for useful discussions. Computationswere partially performed on the NIG supercomputer at the ROIS National Instituteof Genetics.This work was supported by MEXT/JSPS KAKENHI Grant Numbers JP16H02484and JP16H06279 to K.A. and JP16K16143 to J.I, JST CREST Grant Number JP-MJCR18S1 to K.A.

Bibliography1. E. Freyhult, V. Moulton, and P. Clote. RNAbor: a web server for RNA structural neighbors.

Nucleic Acids Research, 35(Web Server):W305–W309, may 2007. ISSN 0305-1048. doi:10.1093/nar/gkm255.

2. Ronny Lorenz, Christoph Flamm, and Ivo L. Hofacker. 2D projections of RNA folding land-scapes. IN: GERMAN CONFERENCE ON BIOINFORMATICS, pages 11—-20, 2009.

3. Lee A. Newberg and Charles E. Lawrence. Exact Calculation of Distributions on Integers,with Application to Sequence Alignment. Journal of Computational Biology, 16(1):1–18, jan2009. ISSN 1066-5277. doi: 10.1089/cmb.2008.0137.

4. Evan Senter, Saad Sheikh, Ivan Dotu, Yann Ponty, and Peter Clote. Using the Fast FourierTransform to Accelerate the Computational Search for RNA Conformational Switches. PLoSONE, 7(12):e50506, dec 2012. ISSN 1932-6203. doi: 10.1371/journal.pone.0050506.

5. Ryota Mori, Michiaki Hamada, and Kiyoshi Asai. Efficient calculation of exact probabilitydistributions of integer features on RNA secondary structures. BMC Genomics, 15(Suppl10):S6, dec 2014. ISSN 1471-2164. doi: 10.1186/1471-2164-15-S10-S6.

6. Taichi Hagio, Shun Sakuraba, Junichi Iwakiri, Ryota Mori, and Kiyoshi Asai. Capturing al-ternative secondary structures of RNA by decomposition of base-pairing probabilities. BMCBioinformatics, 19(S1):38, feb 2018. ISSN 1471-2105. doi: 10.1186/s12859-018-2018-4.

7. Hisanori Kiryu, Taishin Kin, and Kiyoshi Asai. Rfold: an exact algorithm for computing localbase pairing probabilities. Bioinformatics, 24(3):367–373, feb 2008. ISSN 1460-2059. doi:10.1093/bioinformatics/btm591.

Takizawa et al. | RintC bioRχiv | 9

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 10: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

8. Evan Senter, Ivan Dotu, and Peter Clote. RNA folding pathways and kinetics using 2Denergy landscapes. Journal of Mathematical Biology, 70(1-2):173–196, jan 2015. ISSN0303-6812. doi: 10.1007/s00285-014-0760-4.

9. Juraj Michálik, Hélène Touzet, and Yann Ponty. Efficient approximations of RNA kineticslandscape using non-redundant sampling. Bioinformatics, 33(14):i283–i292, jul 2017. ISSN1367-4803. doi: 10.1093/bioinformatics/btx269.

10. Teruo Sunaga. Theory of an interval algebra and its application to numerical analysis.Japan Journal of Industrial and Applied Mathematics, 26(2-3):125–143, oct 1958. ISSN0916-7005. doi: 10.1007/BF03186528.

11. Risa Kawaguchi and Hisanori Kiryu. Parallel computation of genome-scale RNA secondarystructure to detect structural constraints on human genome. BMC Bioinformatics, 17(1):203, dec 2016. ISSN 1471-2105. doi: 10.1186/s12859-016-1067-9.

12. Hillary S.W. Han and Christian M. Reidys. The 5-3 Distance of RNA Secondary Structures.Journal of Computational Biology, 19(7):867–878, jul 2012. ISSN 1066-5277. doi: 10.1089/cmb.2011.0301.

13. David H Mathews, Matthew D Disney, Jessica L Childs, Susan J Schroeder, Michael Zuker,and Douglas H Turner. Incorporating chemical modification constraints into a dynamic pro-gramming algorithm for prediction of RNA secondary structure. Proceedings of the NationalAcademy of Sciences of the United States of America, 101(19):7287–92, may 2004. ISSN0027-8424. doi: 10.1073/pnas.0401799101.

14. I. L. Hofacker, B. Priwitzer, and P. F. Stadler. Prediction of locally stable RNA secondarystructures for genome-wide surveys. Bioinformatics, 20(2):186–190, jan 2004. ISSN 1367-4803. doi: 10.1093/bioinformatics/btg388.

15. S. H. Bernhart, I. L. Hofacker, and P. F. Stadler. Local RNA base pairing probabilities inlarge sequences. Bioinformatics, 22(5):614–615, mar 2006. ISSN 1367-4803. doi: 10.1093/bioinformatics/btk014.

16. Sita J. Lange, Daniel Maticzka, Mathias Möhl, Joshua N. Gagnon, Chris M. Brown, andRolf Backofen. Global or local? Predicting secondary structure and accessibility in mRNAs.Nucleic Acids Research, 40(12):5215–5226, jul 2012. ISSN 1362-4962. doi: 10.1093/nar/gks181.

17. J. S. McCaskill. The equilibrium partition function and base pair binding probabilities forRNA secondary structure. Biopolymers, 29(6-7):1105–1119, may 1990. ISSN 0006-3525.doi: 10.1002/bip.360290621.

18. Masahide Kashiwagi. kv - a C++ Library for Verified Numerical Computation, 2018.19. Ronny Lorenz, Stephan H Bernhart, Christian Höner zu Siederdissen, Hakim Tafer,

Christoph Flamm, Peter F Stadler, and Ivo L Hofacker. ViennaRNA Package 2.0. Algorithmsfor Molecular Biology, 6(1):26, nov 2011. ISSN 1748-7188. doi: 10.1186/1748-7188-6-26.

20. C. B. Do, D. A. Woods, and S. Batzoglou. CONTRAfold: RNA secondary structure predictionwithout physics-based models. Bioinformatics, 22(14):e90–e98, jul 2006. ISSN 1367-4803.doi: 10.1093/bioinformatics/btl246.

21. Buvaneswari Coimbatore Narayanan, John Westbrook, Saheli Ghosh, Anton I. Petrov, BlakeSweeney, Craig L. Zirbel, Neocles B. Leontis, and Helen M. Berman. The Nucleic AcidDatabase: new features and capabilities. Nucleic Acids Research, 42(D1):D114–D122, jan2014. ISSN 0305-1048. doi: 10.1093/nar/gkt980.

22. H. M. Berman, W. K. Olson, D. L. Beveridge, J. Westbrook, A. Gelbin, T. Demeny, S. H.Hsieh, A. R. Srinivasan, and B. Schneider. The nucleic acid database. A comprehensiverelational database of three-dimensional structures of nucleic acids. Biophysical Journal,63(3):751–759, sep 1992. ISSN 00063495. doi: 10.1016/S0006-3495(92)81649-1.

23. Jack A Dunkle, Leyi Wang, Michael B Feldman, Arto Pulk, Vincent B Chen, Gary J Kapral,Jonas Noeske, Jane S Richardson, Scott C Blanchard, and Jamie H Doudna Cate. Struc-tures of the bacterial ribosome in classical and hybrid states of tRNA binding. Science (NewYork, N.Y.), 332(6032):981–4, may 2011. ISSN 1095-9203. doi: 10.1126/science.1202692.

24. Maria Selmer, Christine M Dunham, Frank V Murphy, Albert Weixlbaumer, Sabine Petry,Ann C Kelley, John R Weir, and V Ramakrishnan. Structure of the 70S ribosome complexedwith mRNA and tRNA. Science (New York, N.Y.), 313(5795):1935–42, sep 2006. ISSN1095-9203. doi: 10.1126/science.1131127.

25. N B Leontis and E Westhof. Geometric nomenclature and classification of RNA base pairs.RNA (New York, N.Y.), 7(4):499–512, apr 2001. ISSN 1355-8382.

26. Wolfram Saenger. Principles of Nucleic Acid Structure. Springer Advanced Texts inChemistry. Springer New York, New York, NY, 1984. ISBN 978-0-387-90761-1. doi:10.1007/978-1-4612-5190-3.

27. Saul B. Needleman and Christian D. Wunsch. A general method applicable to the searchfor similarities in the amino acid sequence of two proteins. Journal of Molecular Biology, 48(3):443–453, mar 1970. ISSN 0022-2836. doi: 10.1016/0022-2836(70)90057-4.

28. Michiaki Hamada, Hisanori Kiryu, Kengo Sato, Toutai Mituyama, and Kiyoshi Asai. Predic-tion of RNA secondary structure using generalized centroid estimators. Bioinformatics, 25(4):465–473, feb 2009. ISSN 1460-2059. doi: 10.1093/bioinformatics/btn601.

29. Bobbie-Jo M. Webb-Robertson, Lee Ann McCue, and Charles E. Lawrence. MeasuringGlobal Credibility with Application to Local Sequence Alignment. PLoS Computational Biol-ogy, 4(5):e1000077, may 2008. ISSN 1553-7358. doi: 10.1371/journal.pcbi.1000077.

30. Moeava Tehei, Bruno Franzetti, Dominique Madern, Margaret Ginzburg, Ben Z Ginzburg,Marie-Thérèse Giudici-Orticoni, Mireille Bruschi, and Giuseppe Zaccai. Adaptation to ex-treme environments: macromolecular dynamics in bacteria compared in vivo by neutronscattering. EMBO reports, 5(1):66–70, jan 2004. ISSN 1469-221X. doi: 10.1038/sj.embor.7400049.

10 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 11: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

A representation

Supplementary Note 1: All Functions for Logsumexp on Complex Number but not IntervalHere we explain how to perform logsumexp on the whole complex number. In this subsection, we describe methods for thenormal scalar type (or floating point number type) which is not an interval type. In this section, the base of log is e.

A. representation. First, as a representation of the complex number a+ bi, hold (r,c,d) of

a+ bi= er(c+di)However, as a normalization condition,

c2 +d2 ={

0 (a+ bi= 0)1 (otherwise)

must be satisfied. For convenience, it must be satisfied that r = 0 when a+bi= 0. The algorithm for checking whether (r,c,d)is normalized can be written as follows.

Algorithm 3 IsNormalized

Input: (r,c,d)::(Real,Real,Real)Output: Bool

1: if (c,d) = (0,0) then2: if r = 0 then3: return True4: end if5: return False6: end if7: if c2 +d2 = 1 then8: return True9: end if

10: return False

B. normalization. When a number (r′, c′,d′) which is not normalized is given, a method of obtaining the normalized number(r,c,d) = (r′, c′,d′) is as follows.

Algorithm 4 Normalize

Input: (r′, c′,d′)::(Real,Real,Real)Output: (r,c,d)::(Real,Real,Real) where

er(c+di) = er′(c′+d′i) and IsNormalized(r,c,d) = True

1: s⇐ (c′)2 +(d′)2

2: if s= 0 then3: return (0,0,0)4: end if5: t⇐ 1

sqrt(s)6: return (r′− log(t), tc′, td′)

Description:First, compute

s= (c′)2 +(d′)2

t= 1sqrt(s)

t is the reciprocal of the absolute value of the input. At this time

(r,c,d) ={

(0,0,0) (s= 0)(r′− log(t), tc′, td′) (otherwise)

is a normalized solution.

Takizawa et al. | RintC bioRχiv | 11

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 12: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

C. conversion. To obtain (r,c,d) when (a,b) such as a+ bi is given, normalize (0,a,b).

Algorithm 5 ConvertUsualIntoWide

Input: (a,b)::(Real,Real)Output: (r,c,d)::(Real,Real,Real) where

er(c+di) = (a+ bi) and IsNormalized(r,c,d) = True1: return Normalize(0,a,b)

For inverse transformation, calculate normally.

Algorithm 6 ConvertWideIntoUsual

Input: (r,c,d)::(Real,Real,Real)Output: (a,b)::(Real,Real) where (a+ bi) = er(c+di)

1: return (erc,erd)

Algorithm 7 Multiplication

Input: ((r1, c1,d1),(r2, c2,d2))::((Real,Real,Real),(Real,Real,Real)) where

IsNormalized(r1, c1,d1) = True andIsNormalized(r2, c2,d2) = True

Output: (r,c,d)::(Real,Real,Real) whereer(c+di) = er1(c1 +d1i)er2(c2 +d2i) andIsNormalized(r,c,d) = True

1: r⇐ r1 + r22: c⇐ c1c2−d1d23: d⇐ c1d2 +d1c24: if (c,d) = (0,0) then5: r⇐ 06: end if7: return (r,c,d)

D. multiplication. Description:

The multiplication of the two values (r1, c1,d1) and (r2, c2,d2) can be descripted as

(r1, c1,d1)(r2, c2,d2)= er1(c1 +d1i)er2(c2 +d2i)= er1+r2(c1 +d1i)(c2 +d2i)= er1+r2((c1c2−d1d2)+(c1d2 +d1c2)i)

and (r1 + r2, c1c2− d1d2, c1d2 + d1c2) is obtained as a solution. As a post-processing for normalization, if c1c2− d1d2 =c1d2 +d1c2 = 0, substitute r = 0. Otherwise, since the product of the complex numbers with absolute value 1 is absolute value1, it is naturally normalized.

12 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 13: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

E addition

Algorithm 8 Addition

Input: ((r1, c1,d1),(r2, c2,d2))::((Real,Real,Real),(Real,Real,Real)) where

IsNormalized(r1, c1,d1) = True andIsNormalized(r2, c2,d2) = True

Output: (r,c,d)::(Real,Real,Real) whereer(c+di) = er1(c1 +d1i)+er2(c2 +d2i) andIsNormalized(r,c,d) = True

1: if r1 < r2 then2: return Addition((r2, c2,d2),(r1, c1,d1))3: end if4: k⇐ er2−r1

5: r⇐ r16: c⇐ c1 +kc27: d⇐ d1 +kd28: return Normalize(r,c,d)

E. addition. Description:Consider adding the two values (r1, c1,d1) and (r2, c2,d2). Since addition is commutative, assuming r1 ≥ r2 does not losegenerality. Then, it can be formulated as

(r1, c1,d1)+(r2, c2,d2)= er1(c1 +d1i)+er2(c2 +d2i)= er1(c1 +d1i)+er1(er2−r1c2 +er2−r1d2i)= er1((c1 +er2−r1c2)+(d1 +er2−r1d2)i)

Since it is er2−r1 ≤ 1 from the assumption of r1 ≥ r2, er2−r1 can be directly calculated without overflowing. Therefore,

c′ = (c1 +er2−r1c2)d′ = (d1 +er2−r1d2)

can be calculated and (r1, c′,d′) satisfies

(r1, c1,d1)+(r2, c2,d2) = (r1, c′,d′)

as an answer of addition. Finally, since this is not normalized, it needs normalization processing.

Takizawa et al. | RintC bioRχiv | 13

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 14: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

Supplementary Note 2: Auxilary Functions for Logsumexp on Complex Number and IntervalThe algorithm for checking whether ([r], [c], [d]) is normalized can be written as follows.

Algorithm 9 IsNormalized

Input: ([r], [c], [d])::(Interval,Interval,Interval)Output: Bool

1: if (c,d) = ([0,0], [0,0]) then2: if r = [0,0] then3: return True4: end if5: return False6: end if7: if fupper(c2 +d2)≈ 1 then8: return True9: end if

10: return False

A. normalization. When a number ([r′], [c′], [d′]) which is not normalized is given, a method of obtaining the normalizednumber with accuracy assurance ([r], [c], [d])⊇ ([r′], [c′], [d′]) is as follows.

Algorithm 10 Normalize

Input: ([r′], [c′], [d′])::(Interval,Interval,Interval)Output: ([r], [c], [d])::(Interval,Interval,Interval) where

e[r]([c]+ [d]i)⊇ e[r′]([c′]+ [d′]i) andIsNormalized([r], [c], [d]) = True

1: s⇐ fupper([c′]2 +[d′]2)2: if s= 0 then3: return ([0,0], [0,0], [0,0])4: end if5: t⇐ 1

sqrt(s)6: return ([r′]− log([t, t]), [t, t][c′], [t, t][d′])

Description:First, compute

s= fupper([c′]2 +[d′]2)

t= 1sqrt(s)

t is the reciprocal of maximum value of the absolute value of the input. At this time

([r], [c], [d]) ={

([0,0], [0,0], [0,0]) (s= 0)([r′]− log([t, t]), [t, t][c′], [t, t][d′]) (otherwise)

is a normalized solution.

B. conversion. To obtain ([r], [c], [d]) when [a] + [b]i is given, normalize ([0,0], [a], [b]).For inverse transformation, calculatenormally.

Algorithm 11 ConvertUsualIntoWide

Input: ([a], [b])::(Interval,Interval)Output: ([r], [c], [d])::(Interval,Interval,Interval) where

e[r]([c]+ [d]i)⊇ ([a]+ [b]i) and IsNormalized([r], [c], [d]) = True1: return Normalize([0,0], [a], [b])

14 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 15: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

B conversion

Algorithm 12 ConvertWideIntoUsual

Input: ([r], [c], [d])::(Interval,Interval,Interval)Output: ([a], [b])::(Interval,Interval) where ([a]+ [b]i)⊇ e[r]([c]+ [d]i)

1: return (e[r][c],e[r][d])

Takizawa et al. | RintC bioRχiv | 15

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint

Page 16: RintC: fast and accuracy-aware decomposition of ... · RintC: fast and accuracy-aware decomposition of distributions of RNA secondary structures with extended logsumexp Hiroki Takizawa1,

Supplementary Note 3: Proof of Proposition 1

Proposition 1: fupper(e[r2]−[r1]−[p,p])≤ 1Proof:Since they are assumptions with fmid([r1])≥ fmid([r2]) and

p= fupper([r1])−fmid([r1])+fupper([r2])−fmid([r2]) (p≥ 0)

, it holds that

fupper([r2]− [r1])= fupper([r2])−flower([r1])= (fupper([r2])−fmid([r2])+fmid([r2]))− (flower([r1])−fmid([r1])+fmid([r1]))

= (fupper([r2])−fmid([r2])+fmid([r2]))− (−fupper([r1])+fmid([r1])+fmid([r1]))

= (fupper([r1])−fmid([r1])+fupper([r2])−fmid([r2]))+fmid([r2])−fmid([r1])

= p+fmid([r2])−fmid([r1])≤ p.

Therefore,

fupper([r2]− [r1]− [p,p])≤ 0

holds. Since,

fupper(e[r2]−[r1]−[p,p])≤ 1.

QED.

16 | bioRχiv Takizawa et al. | RintC

.CC-BY 4.0 International licensecertified by peer review) is the author/funder. It is made available under aThe copyright holder for this preprint (which was notthis version posted May 31, 2019. . https://doi.org/10.1101/656256doi: bioRxiv preprint