Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Probabilistic context-free grammar
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===RNA structure prediction=== Since the 1990s, PCFG has been applied to model [[RNA structure]]s.<ref name="Eddy 1994" /><ref name="Sakakibara 1994" /><ref name="Grat 1995" /><ref name="Lefebvre 1995" /><ref name="Lefebvre 1996" /> Energy minimization<ref name="McCaskill 1990" /><ref name="Juan 1999" /> and PCFG provide ways of predicting RNA secondary structure with comparable performance.<ref name="Eddy 1994" /><ref name="Sakakibara 1994" /><ref name="Durbin 1998" /> However structure prediction by PCFGs is scored probabilistically rather than by minimum free energy calculation. PCFG model parameters are directly derived from frequencies of different features observed in databases of RNA structures <ref name="Dowell 2004" /> rather than by experimental determination as is the case with energy minimization methods.<ref name="Zuker 2000" /><ref name="Mathews 1999" /> The types of various structure that can be modeled by a PCFG include long range interactions, pairwise structure and other nested structures. However, pseudoknots can not be modeled.<ref name="Eddy 1994" /><ref name="Sakakibara 1994" /><ref name="Durbin 1998" /> PCFGs extend CFG by assigning probabilities to each production rule. A maximum probability parse tree from the grammar implies a maximum probability structure. Since RNAs preserve their structures over their primary sequence, RNA structure prediction can be guided by combining evolutionary information from comparative sequence analysis with biophysical knowledge about a structure plausibility based on such probabilities. Also search results for structural homologs using PCFG rules are scored according to PCFG derivations probabilities. Therefore, building grammar to model the behavior of base-pairs and single-stranded regions starts with exploring features of structural [[multiple sequence alignment]] of related RNAs.<ref name="Durbin 1998" /> : <math>S \to aSa | bSb | aa | bb</math> The above grammar generates a string in an outside-in fashion, that is the basepair on the furthest extremes of the terminal is derived first. So a string such as <math>aabaabaa</math> is derived by first generating the distal {{mvar|a}}'s on both sides before moving inwards: : <math>S \Rightarrow aSa \Rightarrow aaSaa \Rightarrow aabSbaa \Rightarrow aabaabaa</math> A PCFG model extendibility allows constraining structure prediction by incorporating expectations about different features of an RNA . Such expectation may reflect for example the propensity for assuming a certain structure by an RNA.<ref name="Dowell 2004" /> However incorporation of too much information may increase PCFG space and memory complexity and it is desirable that a PCFG-based model be as simple as possible.<ref name="Dowell 2004" /><ref name="Knudsen 2003" /> Every possible string {{mvar|x}} a grammar generates is assigned a probability weight <math>P(x|\theta)</math> given the PCFG model <math>\theta</math>. It follows that the sum of all probabilities to all possible grammar productions is <math>\sum_{\text{x}}P(x|\theta)=1</math>. The scores for each paired and unpaired residue explain likelihood for secondary structure formations. Production rules also allow scoring loop lengths as well as the order of base pair stacking hence it is possible to explore the range of all possible generations including suboptimal structures from the grammar and accept or reject structures based on score thresholds.<ref name="Durbin 1998" /><ref name="Dowell 2004" /> ====Implementations==== RNA secondary structure implementations based on PCFG approaches can be utilized in : * Finding consensus structure by optimizing structure joint probabilities over MSA.<ref name="Knudsen 2003" /><ref name="Knudsen 1999" /> * Modeling base-pair covariation to detecting homology in database searches.<ref name="Eddy 1994" /> * pairwise simultaneous folding and alignment.<ref name="Rivas 2001" /><ref name="Holmes 2002" /> Different implementation of these approaches exist. For example, Pfold is used in secondary structure prediction from a group of related RNA sequences,<ref name="Knudsen 2003" /> covariance models are used in searching databases for homologous sequences and RNA annotation and classification,<ref name="Eddy 1994" /><ref name="Gardner 2010" /> RNApromo, CMFinder and TEISER are used in finding stable structural motifs in RNAs.<ref name="Yao 2006" /><ref name="Rabani 2008" /><ref name="Goodarzi 2012" /> ====Design considerations==== PCFG design impacts the secondary structure prediction accuracy. Any useful structure prediction probabilistic model based on PCFG has to maintain simplicity without much compromise to prediction accuracy. Too complex a model of excellent performance on a single sequence may not scale.<ref name="Durbin 1998" /> A grammar based model should be able to: * Find the optimal alignment between a sequence and the PCFG. * Score the probability of the structures for the sequence and subsequences. * Parameterize the model by training on sequences/structures. * Find the optimal grammar parse tree (CYK algorithm). * Check for ambiguous grammar (Conditional Inside algorithm). The resulting of multiple [[parse tree]]s per grammar denotes grammar ambiguity. This may be useful in revealing all possible base-pair structures for a grammar. However an optimal structure is the one where there is one and only one correspondence between the parse tree and the secondary structure. Two types of ambiguities can be distinguished. Parse tree ambiguity and structural ambiguity. Structural ambiguity does not affect thermodynamic approaches as the optimal structure selection is always on the basis of lowest free energy scores.<ref name="Dowell 2004" /> Parse tree ambiguity concerns the existence of multiple parse trees per sequence. Such an ambiguity can reveal all possible base-paired structures for the sequence by generating all possible parse trees then finding the optimal one.<ref name="Sipser 1996" /><ref name="Harrison 1978" /><ref name="Hopcroft 1979" /> In the case of structural ambiguity multiple parse trees describe the same secondary structure. This obscures the CYK algorithm decision on finding an optimal structure as the correspondence between the parse tree and the structure is not unique.<ref name="Giegerich 2000" /> Grammar ambiguity can be checked for by the conditional-inside algorithm.<ref name="Durbin 1998" /><ref name="Dowell 2004" /> ====Building a PCFG model==== A probabilistic context free grammar consists of terminal and nonterminal variables. Each feature to be modeled has a production rule that is assigned a probability estimated from a training set of RNA structures. Production rules are recursively applied until only terminal residues are left. A starting non-terminal <math>\mathbf{\mathit{S}}</math> produces loops. The rest of the grammar proceeds with parameter <math>\mathbf{\mathit{L}}</math> that decide whether a loop is a start of a stem or a single stranded region {{mvar|s}} and parameter <math>\mathbf{\mathit{F}}</math> that produces paired bases. The formalism of this simple PCFG looks like: : <math>\mathit{S \to LS|L}</math> : <math>\mathit{L \to s | dFd}</math> : <math>\mathit{F \to dFd | LS}</math> The application of PCFGs in predicting structures is a multi-step process. In addition, the PCFG itself can be incorporated into probabilistic models that consider RNA evolutionary history or search homologous sequences in databases. In an evolutionary history context inclusion of prior distributions of RNA structures of a [[structural alignment]] in the production rules of the PCFG facilitates good prediction accuracy.<ref name="Knudsen 1999" /> A summary of general steps for utilizing PCFGs in various scenarios: * Generate production rules for the sequences. * Check ambiguity. * Recursively generate parse trees of the possible structures using the grammar. * Rank and score the parse trees for the most plausible sequence.<ref name="Durbin 1998" /> ====Algorithms==== Several algorithms dealing with aspects of PCFG based probabilistic models in RNA structure prediction exist. For instance the inside-outside algorithm and the CYK algorithm. The inside-outside algorithm is a recursive dynamic programming scoring algorithm that can follow [[Expectation-maximization algorithm|expectation-maximization]] paradigms. It computes the total probability of all derivations that are consistent with a given sequence, based on some PCFG. The inside part scores the subtrees from a parse tree and therefore subsequences probabilities given an PCFG. The outside part scores the probability of the complete parse tree for a full sequence.<ref name="Lari and Young 1990" /><ref name="Lari and Young 1991" /> CYK modifies the inside-outside scoring. Note that the term 'CYK algorithm' describes the CYK variant of the inside algorithm that finds an optimal parse tree for a sequence using a PCFG. It extends the actual [[CYK algorithm]] used in non-probabilistic CFGs.<ref name="Durbin 1998" /> The inside algorithm calculates <math>\alpha(i,j,v)</math> probabilities for all <math>i, j, v</math> of a parse subtree rooted at <math>W_v</math> for subsequence <math>x_i,...,x_j</math>. Outside algorithm calculates <math>\beta(i,j,v)</math> probabilities of a complete parse tree for sequence {{mvar|x}} from root excluding the calculation of <math>x_i,...,x_j</math>. The variables {{mvar|α}} and {{mvar|β}} refine the estimation of probability parameters of an PCFG. It is possible to reestimate the PCFG algorithm by finding the expected number of times a state is used in a derivation through summing all the products of {{mvar|α}} and {{mvar|β}} divided by the probability for a sequence {{mvar|x}} given the model <math>P(x|\theta)</math>. It is also possible to find the expected number of times a production rule is used by an expectation-maximization that utilizes the values of {{mvar|α}} and {{mvar|β}}.<ref name="Lari and Young 1990" /><ref name="Lari and Young 1991" /> The CYK algorithm calculates <math>\gamma(i, j, v)</math> to find the most probable parse tree <math>\hat{\pi}</math> and yields <math>\log P(x, \hat{\pi}|\theta)</math>.<ref name="Durbin 1998" /> Memory and time complexity for general PCFG algorithms in RNA structure predictions are <math>O(L^2M)</math> and <math>O(L^3M^3)</math> respectively. Restricting a PCFG may alter this requirement as is the case with database searches methods. ====PCFG in homology search==== Covariance models (CMs) are a special type of PCFGs with applications in database searches for homologs, annotation and RNA classification. Through CMs it is possible to build PCFG-based RNA profiles where related RNAs can be represented by a consensus secondary structure.<ref name ="Eddy 1994" /><ref name="Sakakibara 1994" /> The RNA analysis package Infernal uses such profiles in inference of RNA alignments.<ref name="Nawrocki 2013" /> The Rfam database also uses CMs in classifying RNAs into families based on their structure and sequence information.<ref name="Gardner 2010" /> CMs are designed from a consensus RNA structure. A CM allows [[indel]]s of unlimited length in the alignment. Terminals constitute states in the CM and the transition probabilities between the states is 1 if no indels are considered.<ref name="Durbin 1998" /> Grammars in a CM are as follows: :; <math>P \to aWb</math>:probabilities of pairwise interactions between 16 possible pairs :; <math>L \to aW</math>:probabilities of generating 4 possible single bases on the left :; <math>R \to Wa</math>:probabilities of generating 4 possible single bases on the right :; <math>B \to SS</math>:bifurcation with a probability of 1 :; <math>S \to W</math>:start with a probability of 1 :; <math>E \to \epsilon</math>:end with a probability of 1 The model has 6 possible states and each state grammar includes different types of secondary structure probabilities of the non-terminals. The states are connected by transitions. Ideally current node states connect to all insert states and subsequent node states connect to non-insert states. In order to allow insertion of more than one base insert states connect to themselves.<ref name="Durbin 1998" /> In order to score a CM model the inside-outside algorithms are used. CMs use a slightly different implementation of CYK. Log-odds emission scores for the optimum parse tree - <math>\log \hat{e}</math> - are calculated out of the emitting states <math>P,~L,~R</math>. Since these scores are a function of sequence length a more discriminative measure to recover an optimum parse tree probability score- <math>\log\text{P}(x, \hat{\pi}|\theta)</math> - is reached by limiting the maximum length of the sequence to be aligned and calculating the log-odds relative to a null. The computation time of this step is linear to the database size and the algorithm has a memory complexity of <math>O(M_aD+M_bD^2)</math>.<ref name="Durbin 1998" /> ==== Example: Using evolutionary information to guide structure prediction ==== The KH-99 algorithm by Knudsen and Hein lays the basis of the Pfold approach to predicting RNA secondary structure.<ref name="Knudsen 2003" /> In this approach the parameterization requires evolutionary history information derived from an alignment tree in addition to probabilities of columns and mutations. The grammar probabilities are observed from a training dataset. ===== Estimate column probabilities for paired and unpaired bases ===== In a structural alignment the probabilities of the unpaired bases columns and the paired bases columns are independent of other columns. By counting bases in single base positions and paired positions one obtains the frequencies of bases in loops and stems. For basepair {{mvar|X}} and {{mvar|Y}} an occurrence of <math>XY</math> is also counted as an occurrence of <math>YX</math>. Identical basepairs such as <math>XX</math> are counted twice. ===== Calculate mutation rates for paired and unpaired bases ===== By pairing sequences in all possible ways overall mutation rates are estimated. In order to recover plausible mutations a sequence identity threshold should be used so that the comparison is between similar sequences. This approach uses 85% identity threshold between pairing sequences. First single base positions differences -except for gapped columns- between sequence pairs are counted such that if the same position in two sequences had different bases {{mvar|X, Y}} the count of the difference is incremented for each sequence. {{nowrap|while <math>X\ne Y</math>}} {{nowrap|<math> C_{\text{XY}} +1</math> first sequence pair}} {{nowrap|<math> C_{\text{YX}} +1</math> second sequence pair}} {{nowrap|Calculate mutation rates.}} {{nowrap|Let <math>r_{\text{XY}}= </math> mutation of base X to base Y <math>= \frac {K~C_{\text{XY}}} {P_{x}P_{s}}</math>}} {{nowrap|Let <math>r_{\text{XX}}= </math> the negative of the rate of X mutation to other bases <math>= - \sum r_{\text{XY}}</math>}} {{nowrap|<math>P_{s} =</math> the probability that the base is not paired.}} For unpaired bases a 4 X 4 mutation rate matrix is used that satisfies that the mutation flow from X to Y is reversible:<ref name="Tavaré 1986" /> : <math>PX^rXY = PY^rYX</math> For basepairs a 16 X 16 rate distribution matrix is similarly generated.<ref name="Muse 1995" /><ref name="Schöniger 1994" /> The PCFG is used to predict the prior probability distribution of the structure whereas posterior probabilities are estimated by the inside-outside algorithm and the most likely structure is found by the CYK algorithm.<ref name="Knudsen 2003" /> ===== Estimate alignment probabilities ===== After calculating the column prior probabilities the alignment probability is estimated by summing over all possible secondary structures. Any column {{mvar|C}} in a secondary structure <math>\sigma</math> for a sequence {{mvar|D}} of length {{mvar|l}} such that <math>D=(C_1,~C_2, ...C_l )</math> can be scored with respect to the alignment tree {{mvar|T}} and the mutational model {{mvar|M}}. The prior distribution given by the PCFG is <math>P(\sigma|M)</math>. The phylogenetic tree, {{mvar|T}} can be calculated from the model by maximum likelihood estimation. Note that gaps are treated as unknown bases and the summation can be done through [[dynamic programming]].<ref name="Baker 1979" /> : <math>P(D|T,M)</math> : <math>=\sum P (D, \sigma |T,M)</math> : <math>=\sum P(D|\sigma, T, M) P(\sigma|T,M)</math> : <math>=\sum P(D|\sigma,T,M) P(\sigma|M)</math> ===== Assign production probabilities to each rule in the grammar ===== Each structure in the grammar is assigned production probabilities devised from the structures of the training dataset. These prior probabilities give weight to predictions accuracy.<ref name="Knudsen 1999" /><ref name="Lari and Young 1990" /><ref name="Lari and Young 1991" /> The number of times each rule is used depends on the observations from the training dataset for that particular grammar feature. These probabilities are written in parentheses in the grammar formalism and each rule will have a total of 100%.<ref name="Knudsen 2003" /> For instance: : <math> S \to LS (80\%) |L (20\%)</math> : <math>L \to s (70\%) | dFd (30\%)</math> : <math>F \to dFd (60.4\%)| LS (39.6\%)</math> ===== Predict the structure likelihood ===== Given the prior alignment frequencies of the data the most likely structure from the ensemble predicted by the grammar can then be computed by maximizing <math>P(\sigma|D,T,M)</math> through the CYK algorithm. The structure with the highest predicted number of correct predictions is reported as the consensus structure.<ref name="Knudsen 2003" /> : <math>\sigma_{MAP}= \arg\underset{\sigma}\max P(D| \sigma,T^ML, M) P(\sigma|M)</math> ===== Pfold improvements on the KH-99 algorithm ===== PCFG based approaches are desired to be scalable and general enough. Compromising speed for accuracy needs to as minimal as possible. Pfold addresses the limitations of the KH-99 algorithm with respect to scalability, gaps, speed and accuracy.<ref name="Knudsen 2003" /> *In Pfold gaps are treated as unknown. In this sense the probability of a gapped column equals that of an ungapped one. *In Pfold the tree {{mvar|T}} is calculated prior to structure prediction through neighbor joining and not by maximum likelihood through the PCFG grammar. Only the branch lengths are adjusted to maximum likelihood estimates. *An assumption of Pfold is that all sequences have the same structure. Sequence identity threshold and allowing a 1% probability that any nucleotide becomes another limit the performance deterioration due to alignment errors.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)