Chemical features of small molecules can be abstracted to 3D pharmacophore models, which are easy to generate, interpret, and adapt by medicinal chemists. Three-dimensional pharmacophores can be used to efficiently match and align molecules according to their chemical feature pattern, which facilitates the virtual screening of even large compound databases. Existing alignment methods, used in computational drug discovery and bio-activity prediction, are often not suitable for finding matches between pharmacophores accurately as they purely aim to minimize RMSD or maximize volume overlap, when the actual goal is to match as many features as possible within the positional tolerances of the pharmacophore features. As a consequence, the obtained alignment results are often suboptimal in terms of the number of geometrically matched feature pairs, which increases the false-negative rate, thus negatively affecting the outcome of virtual screening experiments. We addressed this issue by introducing a new alignment algorithm, Greedy 3-Point Search (G3PS), which aims at finding optimal alignments by using a matching-feature-pair maximizing search strategy while at the same time being faster than competing methods. TheSince pharmacophore features model non-bonding interactions of functional groups and moieties without being tied to the underlying chemical structure, a single pharmacophore model may cover a wide variety of molecular structures with distinct scaffolds and functional groups that expose the same feature pattern. Pharmacophore-based techniques thus have an inherent scaffold hopping ability, which is of high value for lead optimization tasks or the tailored design of drug molecule .One of the most prominent application of pharmacophores is their use as a filter for the virtual screening of large compound libraries , which aims at finding molecules providing the same chemical feature pattern as specified by the query pharmacophore ,8. FoundFor virtual screening, query pharmacophore features are usually associated with certain positional tolerances to accommodate slight pharmacophore differences resulting from distinct molecular scaffolds and associated conformational spaces. How well two particular features match depends on how many feature pairs can be overlapped at most, given the optimal rotation and translation. The process of finding such an optimal rigid body transformation is called alignment. Pharmacophore alignment can be considered as the “heart” of the pharmacophore-based screening process in which the ultimate decision is made whether two pharmacophores match or do not match. Therefore, high robustness, reliability, and computational efficiency of the underlying algorithm are key factors regarding the usability of the screening software in real-world scenarios. Additional consideration has to be put on the conformational flexibility of molecules. Various methods for aligning molecules in a “flexible” way have been proposed , each wiFor tackling the pharmacophore alignment problem, several methods and algorithms were devised ,16,17. MThe algorithm by Wolber et al.  due to . Should Other alignment algorithms are based on volume overlap and model atoms or pharmacophore features such as Gaussian volumes, for which they optimize towards maximum overlap .ROCS  is a welPharao  is also Existing alignment methods that optimize towards minimizing the root mean squared distance (RMSD) of corresponding feature pairs disregard that worse RMSDs may allow for more features to match. This disconnect between the optimization goal and the actual goal of alignment can be intuitively understood when thinking about the best case for an unambiguous alignment with RMSD. For any pair of pharmacophores, the best solution regarding this criterion would be to only align the three best matching features, resulting in a smaller RMSD than if one were to include even only one additional feature pair. For this reason, alignments may be discarded as the algorithm favoured the perfect fit of few features over the user defined model definitions. Methods optimizing for volume overlap of pharmacophore features modelled by Gaussian volumes have the same inherent problem since after optimization for maximum overlap, features may no longer fulfil positional and/or directional constraints and will be considered non-matching. This is an issue as the aim of the alignment, even for these algorithms, is to maximize the number of matching features. This problem affects the results of virtual screening drastically as the tested pharmacophore may be able to fit all of the features of a query pharmacophore but may still not be found due to the optimization goal. For illustration, Another problem with the existing methods is how they deal with the allowed omission of user-defined less-critical “optional” features during pharmacophore alignment. The RM algorithm, for example, performs a combinatorial sampling and generates all possible combinations with #o missing features. If the models contain many features and #o is large, this will lead to an explosion of computational complexity and results in significantly longer runtimes. The generation of combinations based on omitted features and using them purely with Kabsch alignment additionally leads to another unintuitive issue: as the method may not identify a possible match without the omitted features due to the nature of purely optimizing towards RMSD, computing an alignment for less features may, by chance, find alignments where more of the features match. If aligning a larger number of features did not result in a valid alignment, less features are tried, and the centroid computed for the Kabsch alignment will be at a different place. With a different centroid, the algorithm may now be able to find an alignment for which the previously unmatched features match by coincidence. Thereby, allowing omitted features could lead to finding alignments that actually should have been found without them or even completely different alignments.The treatment of exclusion volume spheres (see the methods section for details) is also problematic. Existing methods compute the alignments without considering these features and only discard the result post computation when they find exclusion volume constraints to be violated. This can lead to solutions, possibly even very good ones, to be discarded only because an exclusion sphere gets slightly touched. Visually, this would be an easy problem to solve, as just slightly moving a molecule may yield a valid alignment.In summary, the core issue with all the discussed methods is that the optimization goal they follow is not in line with the intuition of pharmacophore models. As individual features have a positional tolerance threshold for matching, the best alignment solution may not be the one with minimal feature-pair RMSD or maximum volume overlap but the one providing the largest number of matched feature pairs under the given feature position and direction constraints. The latter criterion should be given preference especially when pharmacophore models are used as virtual screening filters in order to reliably identify all database molecules that provide a specific chemical feature pattern.In the herein presented work, we address all of the above discussed main problems of the existing pharmacophore alignment methods by introducing a new alignment algorithm, Greedy 3-Point Search (G3PS), which aims at finding optimal alignments by using a matching feature pair maximizing search strategy while at the same time being faster than competing methods. The performance of the presented algorithm regarding its reliability in the identification of possible pharmacophore matches and its computational efficiency was assessed by screening several molecule datasets taken from the DUD-E database ,29 with This section provides a detailed description of our new alignment algorithm G3PS. Before presenting any details of the new algorithm, we first want to provide a definition of the used pharmacophore representation, introduce important concepts regarding the goodness of fit of two pharmacophore models given an optimal transformation, and point out additional aspects that are relevant for pharmacophore alignment.Pharmacophores. Pharmacophores are a collection of labelled points representing chemical features [A, we denote feature i as features ,2,3. ComExclusion Volume Spheres. A pharmacophore A may contain additional features a and all exclusion spheres Fully Fitting Models. For two models to fully fit, there must exist a transformation from pharmacophore A to B (and B to A) that includes only translation and rotation  for which the following holds:A and B where:There exists a mapping for all features of (1)All individual features map uniquely to a feature of the other model, creating index pairs (2)The labels (feature types) of paired features are equal (3)The paired features distance is smaller than the larger distance threshold Maximum Fitting Models. Models with maximum fit may not meet the criterion of all features mapping to pairs, but all features of the query pharmacophore do. In other words, the pharmacophore that is used as a query will fully fit a subset of the other pharmacophore. This is the best achievable fit two models of different size can have. If the query pharmacophore is larger than the tested one, such a fit is not possible, and, at best, a partial fit can be achieved by allowing features to be omitted.Partially Fitting Models. Models fitting partially are ones for which less than the number of features in the query pharmacophore match. To define the bound for a sufficient fit, a maximum number of omitted feature Quality of Model Fit. The goal of aligning two pharmacophore models is to find a transformation that allows for the largest number of features to match. For this reason, the most important measure of quality is the number of matching pairs. A matching pair is defined as two features, one from each pharmacophore, for which all restricting properties are fulfilled, including having the same feature type and their distance being smaller than the larger distance threshold. If the number of matching feature pairs is equal for two found model alignment solutions, the quality of alignment can then be asserted by calculating the RMSD of the matched pairs. We want to put additional emphasis on the fact that the RMSD should only be considered regarding the alignment quality after determining the maximum number of matching features, as aiming for the smallest possible RMSD does not optimize towards finding the largest match. The best example for this is to only consider the best matching pair for computing the root mean squared distance. Any model (where at least one feature type matches) can achieve an RMSD of 0 if we only align one feature pair. By extension, a smaller number of matching features is more likely to have a small RMSD.Our new alignment algorithm was implemented in a development version of Ligandscout ,18 usingTo find a starting point for iterative refinement, at least three points need to be fixed in each of the pharmacophores, which allows to create an initial alignment. The number of such three-pair guesses being generated is an important factor for the overall runtime of the algorithm, as it defines how often refinement needs to be performed. Still, the downside of only having one or few starting alignments is that the globally optimal alignment may be missed. Therefore, we allow the user to define the maximum number of sampled guesses, enabling them to trade computation time for accuracy.Single Best Guess. To compute an initial guess that is likely to result in a globally optimal matching, we computed a matrix describing how dissimilar each feature of one pharmacophore is to the features of the other. The creation of this dissimilarity matrix is performed by encoding each feature, taking its neighbourhood into account. Observing a feature Comparing these encodings for all features of one pharmacophore (rows) with all features of the other (columns) will then result in the values of the matrix , this is in practice very fast, as permutations of the same three pairs can be ignored, and pairs with incompatible feature types can be skipped. We also found that this guess-generating process is negligible in runtime compared to the iterative refinement of the found guesses.Trying All Possibilities. It is also possible to just use all combinations of three pairs as starting points for iterative refinement. For this, we do not need to compute a dissimilarity matrix for features but just keep track that all pairs contain features of the same type. This should result in the most accurate alignment, as the largest possible number of starting combinations is sampled, but it has the downside of being more computationally expensive, due to the time needed for refinement. Still, this should be faster than choosing a different algorithm altogether as there are fewer three-pair combinations than if one computes all possible combinations  for the features, as other methods may do.P ,Given a list of starting matches P using the Kabsch Algorithm.Align pairs F “forbidden” for all feature pairs.Build a matrix –Mark pairs with different types forbidden.–Mark columns and rows related to features in P forbidden.F contains unmarked entries:While –P.Iteratively improve Return matching pairs and alignment matrix.For each initial guess of three matching pairs, iterative refinement is performed to both align the collected pairs and to find additional pairs that fit. This idea is similar to the Iterative Closest Point (ICP) algorithm , which iF tracks which pairs could be feasible to expand the matched feature pairs and can indicate when the algorithm should be terminated. Each iteration, this improvement process checks a possible addition to the matching pairs and computes a new alignment while setting at least one entry of F as forbidden. Due to the strict increase in marked entries, one can be sure that the method terminates. Additionally, one can stop this process earlier if all features match or if we only care about finding any alignment, while omitted features are allowed and have a sufficiently large matching. Each iteration of the improvement performs the following steps:F.Find closest pair (by distance) Create temporary pair combination Align pairs If –Try applying translation.If –Delete –F.Mark pair –P.Restore alignment of –Continue.Otherwise,–Set –F forbidden.Mark rows and columns related to –Continue.The matrix In many cases, it is not necessary to compute the alignment for all of the guesses presented. After refining a guess, the contained tree-pair combinations are stored, and subsequent guesses, starting with three points that were already collected by a previous refinement, are skipped. This is done as in most cases, and refining from those pairs would converge toward the same solution as was previously found.In the post-processing step, additional requirements for a valid alignment are checked. One of these checks is the collision with exclusion volumes see , for whiDodging Exclusion Volume Spheres. If the resulting alignment includes atoms that collide with exclusion volumes, additional translations (currently up to three) can be applied to try to “dodge” those exclusion volumes to save the alignment. An example for this is provided in After those translations, if there are still collisions, the alignment has to be discarded, otherwise the pharmacophore feature thresholds for matched pairs need to be checked again. Based on whether or not the features still are within their allowed threshold distances, the alignment may now be valid or not. This may save a solution that only had a minor exclusion volume clash from being discarded even though it may have been a reasonable alignment.Other requirements imposed by pharmacophore features could include a variety of properties like direction vectors or plane normals. Here, as part of the model, one can assume the direction in which the feature should point, and any matching features should also roughly point in that direction after alignment. If this is not the case, the feature is considered unmatched,, and if this leads to less-matched features than required, the solution is discarded. This could also be an interesting topic for further investigation in a follow-up work, as it may be possible to consider these direction vectors in the alignment process itself.To benchmark the number of found matches and the required computation time, we implemented our alignment algorithm in a development version of LigandScout for use in virtual screening. Here, the goal was to find molecules, abstracted by pharmacophores, matching one or more query pharmacophores. Since also a significant amount of completely unfeasible pharmacophore combinations would be aligned in a typical virtual screening run, pre-processing filters are usually applied to reduce the overall computation time . This waTo obtain more sensible results, the hits were again filtered after the alignment. Here, alignments were discarded if the features did not meet additional requirements like the directions of feature vectors not being sufficiently close. If there were still clashes with exclusion volumes (after trying to fix those), the alignment was also discarded. The remainder of the found solutions was then accepted and presented as the output hit-list. This filtering based on model restrictions was performed equally for both of the benchmarked algorithms.Additionally, note that the pharmacophores benchmarked were not manually optimized for separating actives from inactives/decoys. Even though this is what one wants to achieve in practice, the type of retrieved molecules should only depend on the quality of the model. In constrast, the alignment method (which was the focus of our benchmarks) should be able to accurately retrieve all molecules that fit the query model. For this reason, finding additional hits, regardless of if they are actives or decoys, indicates that the method that did not find them was not able to fulfil the user query accurately and omitted results the user asked for. As a side effect of using a more-accurate alignment method and retrieving molecules that fit the query model more precisely, one may need to adjust the model as, in expectation, more hits will be found. As this is often not desirable, reducing the size of feature spheres or additionally filtering the hits with stronger restrictions after screening may be advisable.All computations for the measurements below were run multi-threaded on an AMD Ryzen 9 5900X 12-Core (24 threads) 3.7 Ghz CPU in Windows 10, taking the average of five runs. Before the first measured run, one full non-measured benchmarking run was performed as a “warmup phase” to ensure the different methods and runs neither benefited nor got punished for start-up-related factors like the CPUs branch prediction and I/O caching.First, we assessed the impact of the chosen number of computed guesses for our G3PS algorithm. For this, we compared different datasets in regard to the computation time needed per guess and the number of hits found depending on the number of allowed omitted features.As can be seen in During testing, we visually analysed differences between RM and G3PS. An example can be seen in We also found that many combinations of molecules could not be aligned with the RM method as it could not identify three matching feature pairs. An example of such a combination can be seen in For the benchmarking datasets, we selected 10 different targets from the DUD-E database ,29 and jNote that we included the GCR dataset and used a pharmacophore with nine features to also measure the performance and accuracy with comparatively larger models. Due to this large number of features, the model was more selective than the ones from the other datasets, and fewer found hits were expected regardless of the chosen alignment method.In the following, all comparisons are made to the RM algorithm . Both meThe runtime and resulting hits for our virtual screening experiments without omitted features can be seen in Starting at one omitted feature , the runIncreasing the number of omitted features to two  again inAs already seen with two omitted features, three omitted features  continueThe Greedy 3-Point Search method for alignment brings a variety of benefits over existing methods. With translations applied in the iterative refinement and the general method of collecting additional pairs based on three starting pairs, our algorithm was able to optimize for maximum matching feature counts. In this way, alignments are not missed that should actually be possible for the two given pharmacophore models. As the algorithm looks for the largest possible match iteratively instead of computing alignments for combinatorially generated feature subsets, the number of omitted features does not impact the runtime, making it orders of magnitude faster than competing methods. With this iterative refinement process, the problem that more omitted features could lead to more found hits than with fewer omitted features due to feature centroid changes is also avoided. The independence from the omitted feature count makes our method especially suitable for fragment screening where a larger model needs to be aligned to multiple very small fragment pharmacophores, resulting in a high number of required omitted features. The algorithm can also be tuned by the user for accuracy or performance by adapting the number of sampled refinement starting points, while a small number of starting points still finds the best alignment most of the time. Another commonly found weakness of existing methods is that alignments may be discarded because exclusion volumes are slightly touched, even though very minor changes would allow for a valid, possibly even near-optimal solution. G3PS can avoid this problem in the post-processing step by applying minor translations, thereby not dropping such good alignments.A logical extension to the iterative refinement process could be to include additional information like feature-direction vectors already in this stage. This would allow for an earlier detection of feature pairings where not all constraints can be met and thus could potentially achieve an improvement in runtime. Alternatively, one could try to consider constraints like feature directions during the alignment itself. This could improve the positioning in space such that these restrictions are more likely to be fulfilled without additional intervention and could thereby reduce the number of guesses needed to find a good alignment.Further research could also be targeted at extracting parts of the method for GPU computation. A large part of our algorithm consists of fundamental mathematical operations, and additional performance can possibly be gained by using the computational resources provided by graphics accelerators.We presented a new algorithm, Greedy 3-Point Search, for aligning two pharmacophores in a way that the number of matching features is maximized. This avoids the problem of missing valid alignments due to an unfit optimization target, resulting in a higher number of solutions in agreement with the specified positional tolerances of the pharmacophoric features. The new method iteratively refines starting guesses, finding the largest match without having to consider the allowed number of omitted features. For this reason, the runtime of the algorithm does not depend on omitted features but only the number of starting guesses used. This allows a user to find a trade-off between high accuracy of results and low execution time, while still obtaining good results when the fast variant is chosen. For ease of use, we proposed two default parameter settings for the number of starting guesses, which should cover the needs of most users. Additionally, we touched on exclusion volume restrictions and how to recover from alignments that were deemed invalid due to only barely violating exclusion volume constraints.As our method is able to find hits more accurately, and thereby presents the user more screening hits overall, it will be important to look into how this affects the way pharmacophores are usually refined by expert users. It may now be of benefit to reduce positional tolerances or to narrow down allowed angle deviations for directed features to improve a pharmacophore model’s ability to discriminate between active and inactive molecules. Aside from its impact on virtual screening results, the higher probability to find valid alignments will also have an influence on the results obtained by other pharmacophore-based techniques. For lead optimization tasks, the robustness of our algorithm will significantly extend the possibilities when it comes to the structural modification of molecules. Pharmacophore-guided replacements of chemical functionalities by bioisosteric groups or even scaffold hops have a higher chance to succeed due to the largely reduced risk of failures when attempting a realignment of the template pharmacophore. For ligand-based pharmacophore modeling procedures, following a feature-count maximizing alignment strategy will, on average, result in the perception of a higher amount of common training-set ligand features than one would obtain using a pure RMSD-minimizing strategy. Unfortunately, the average impact of our new alignment algorithm on the outcome of these pharmacophore-based techniques cannot be quantified easily since several other methods and case-specific factors are also of influence and need to be accounted for. However, we are confident that taking advantage of the robustness and the feature-count maximizing search strategy of our new algorithm would be beneficial for any pharmacophore-based technique relying on pharmacophore alignment and thus would contribute to its further development.


The multiple sequence alignment (MSA) is an increasingly important task in bioinformatics as we have to deal with the constantly increasing gene‐ and protein sequence databases. MSA is applied in phylogenetic analysis, in discovering conservative protein domains, in the assignment of secondary and tertiary structural features in proteins, or in the metagenomic sample analysis and gene discovery. Usually, the focus is on the MSA of long sequences, since in the practice these tasks appear most frequently. However, the strict analysis of the optimal MSA of short sequences is an area of negligence, and findings there may contribute to better and faster algorithms for the multiple alignment of long sequences. In the present contribution, we are examining length‐1 sequences using arbitrary metric and length‐2 sequences using unit metric, and we show that the optimum of the MSA problem can be achieved by the trivial alignment in both cases. While the exact optimal global and local alignments of two sequences can be computed in quadratic time with the Neddleman‐WunschHeuristic MSA algorithms include the different versions of CLUSTAL,Multiple sequence alignment algorithms have a range of applications in bioinformatics, for example, in HMM profile building in the famous HMMER suite of programs,In general, the MSA problem is computationally hard .It is known that for a constant number of sequences, the MSA problem is solvable in polynomial time by dynamic programing algorithms . Therefore, the MSA problem is “easy”, that is, polynomial time computable, if the number of the sequences is small . To the best of our knowledge, no one examined the complexity of MSA when the number of the sequences is not small, but their length is.One can assume that for length‐1 (and perhaps even for length‐2) sequences, it may not be that hard to find an optimal alignment. Furthermore, if an optimal alignment for short sequences can be determined in polynomial time, then it could also help to develop faster or more accurate heuristic algorithms. In this work, some new results regarding the alignment of short sequences are presented.1.1Definition 1LetΣ=a1,…,anbe a finite alphabet; a string overΣis called a sequence. The pair of sequencess1′,s2′is an alignment of sequencess1ands2if fori=1,2:si′is obtained fromsiby inserting gaps  into or at either end ofsiand after that,s1′ands2′have the same length. It is assumed that "—" is not an element of alphabetΣ.s1′ is uniquely corresponded to a character of s2′, simply by locating at the same position.The alignment of Definition ℓ be the common length of s1′ and s2′. The cost of this alignment isd is a score scheme over Σ∪‐, and sj′i is the ith character of sj′. The score scheme is usually required to be a metric on the set Σ∪‐, that is, it needs to satisfy d=0⇔u=v;d=d; and the triangle inequality: du,w≤du,v+dv,w, ∀u,v,w∈Σ∪‐. A frequently used score scheme is the unit metric, where du,v=0 if u=v and 1 otherwise. We call an alignment optimal for two sequences if its cost is minimal among every possible alignments.Let k≥2 be a positive integer, and suppose that we want to align the sequences s1,s2,…,sk. Let us insert gaps into or at either end of strings s1,s2,…,sk, so that they have the same length ℓ, and in the proper order, write the k sequences s1′,s2′,…,sk′, each of length ℓ, under one another. This table can be considered a matrix of size k×ℓ, and it is called a multiple alignment of sequences s1,s2,…,sk. Different scoring methods can be applied for multiple alignments, perhaps the most often used one is the sum of pairs method, where the cost is the sum of the costs of the alignments of the k2 pairs from the aligned sequences. More exactly, if s1,…,sk are sequences to be aligned, then their sum of pair costThe definition of aligning two sequences can easily be generalized for more strings: let Examples. (i) Let S :=CCG,GCG,CGC. The following set of sequences is a multiple alignment A of S:A)=3+0+0+2=5.Using the unit metric and computing the costs of the columns, cost(Σ now contain only two characters (C and G) with the following metric:(ii) Let S:=CG,GC,GG. A multiple alignment A of S:Let A =A is equal to 2+2+2=6.Using the given metric, cost 2Σ). An important earlier result needs to be quoted hereIn this section, we focus on aligning length‐1 sequences Σ, such that U contains only identical sequences, and let A be an optimal alignment of S. Let AU denote the restriction of A to the rows of U. ThenLet U be a subset of a set S of sequences over An important corollary of this theorem is the following one: it is enough to examine the sets of pairwise different sequences because in each optimal alignment, every instance of a given sequence is aligned identically.The next definition will be used frequently throughout this work:Definition 3Let S be a set of sequences that have the same length.Ais called the trivial alignment of S ifAis constructed by writing every sequence under each another, without using any gaps.2.1The main result of this subsection is the next theorem:Theorem 4k2.Using unit metric, there cannot be a multiple sequence alignment for length‐1 sequences that has cost less than the cost of their trivial alignment. Additionally, if we align k pairwise different length‐1 sequences, then the cost of an optimal alignment is k different characters has a cost of k2: there are k2 pairs among these characters and in every pair, there are two different sequences, so the cost of an aligned pair is always 1.By Theorem 2, we may assume that the characters to be aligned are pairwise different. It is easy to see that the trivial alignment of ℓ≥2, then the general structure of the n×ℓ matrix of this multiple alignment is as follows: ∀i:1≤i≤ℓ, there are ki characters in the ith column, where ∑i=1ℓki=k, and they are placed so that in each row, there is only one character and ℓ‐1 gaps  that a multiple alignment for k different length‐1 sequences cannot have a higher cost than k2‐k/2‐k2/2ℓ, if the length of aligned sequences is ℓ. Since ℓ≤k, the cost can be at most k2‐k and this limit can be reached if there is only one character in every column and in every row, then the cost is kk‐1=k2‐k.Note: From the proof, it is also clear =cost(1)+cost(2).Similarly, the cost of the second column iscostA can be determined by pairing the dai,‐ summands in cost1 to the summands of same form in cost2 and using the triangle inequality. For example, for a fix i (1≤i≤k1) and ∀j:k1+1≤j≤k, it is true that dai,‐+daj,‐≥dai,aj, soA lower bound for cost1 when we consider summands of the form of dai,aj for this fix i.It is useful to notice that the summands on the right side of this inequality are exactly those ones that are not included in 1≤i≤k1, the following lower bound can be given:By considering this inequality for every This implies thatC is not optimal; therefore, A cannot be an optimal alignment of S. By this contradiction, it is proved that an optimal alignment of S cannot have exactly 2 columns.It is assumed that the trivial alignment with cost ∀i:2≤i<ℓ that an optimal alignment cannot have exactly i columns, and let A be an optimal alignment with ℓ columns. Considering the cost of the first two columns of A, there are k1 sequences in the first column and k2 sequences in the second one. It is enough to prove that by merging these two columns, the cost of the new alignment is lower than the cost of A. The cost of these columns  blocks after permuting the rows of A  and (iv); moreover, every sequence's first character is aligned with each another in T (and it holds similarly for every second character of the sequences of S). Nevertheless, in a non‐trivial alignment A, there are aligned sequences whose first or second characters are not aligned with each other in A. This implies that it is enough to give an upper bound for the cost of these characters in T that are aligned with each other in T but are not aligned with each other in A, using parts of cost(A) for this bound. (Because every part of cost (A) is non‐negative, if a bijection can be given between the letter‐letter alignments in T that are not aligned in A and some other alignments of characters of A , so that the latter alignments have always at least as much cost as the former ones, then it means that cost A≥ cost(T).)In the trivial alignment d denotes the unit metric, then the following inequality holds for every pair of sets P,R on arbitrary alphabet (where P and R can contain a letter more than once):If ai and aj) are not aligned in A (it can be assumed that aj has bigger column index). This implies that the element that is in the intersection of the row of aj and the column of ai must be a gap. dai,aj≤dai,‐, so the cost of the alignment of ai and aj in T can be estimated by the cost of the alignment of two characters in A.Using this inequality, a bijection mentioned above can be given: first, let be considered two sequences whose first characters ((ai and aj) are not aligned in A, then (assuming that aj has bigger column index) the element in the intersection of the row of ai and the column of aj must be a gap. The same estimation can be given like before, meaning that the cost of the alignment of ai and aj in T is less or equal to the cost of a character‐gap alignment in A.Similarly, if two sequences are considered whose second characters A, let Bi and Bj be the two blocks whose sequences’ first characters are not aligned in A. Assuming that the first characters of sequences in Bj have bigger column index, there must be Bj gaps in the intersection of the column of the first characters of sequences in Bi and the rows of Bj. If we denote the first letters of the sequences of BiBj by abiabj, then (because of the statements of the latter two paragraphs) the following holds:Considering the block setting Table  of A, leT, which are not present in A, and character‐gap alignments in A lead to a result that the latter costs in A cannot be less than the corresponding costs in T. We also need to show that this assignment is a bijection, that is, there are no character‐gap alignments that are used more than one time.Besides that, a similar result can be established if we consider two blocks whose sequences’ second characters are not aligned, using the gaps of the block that has the column with smaller column index  with the same metric on Σ as in the Example ii at the end of the Introduction. Let S be also the same as in Example ii: S=CG,GC,GG. The trivial alignment of S has a cost of 8, but as Table S that has cost only of 6.As the next example shows, the trivial alignment will not always be optimal for length‐2 sequences if an arbitrary metric is used. Let In the previous section, it was shown that we can easily determine the minimum cost of a set to be aligned if it includes only length‐1 sequences; moreover, we also can construct an optimal alignment in the most trivial way using any metric. We have also seen that for length‐2 sequences, the trivial alignment is optimal if the unit metric is used but it is not optimal for arbitrary metric. Besides that, it is also known that the trivial alignment is not always optimal for length‐3 sequences even using unit metric.i at the end of the Introduction, let S be as follows:As in Example 6, but it is not optimal: as we have seen, there is a non‐trivial alignment A of S so that cost A is only 5 (see Table Using the unit metric, the cost of the trivial alignment is 5In this work, it was shown that the MSA problem is “easy” for length‐1 sequences and also for length‐2 sequences in special cases. While the MSA problem is well‐examined for a small number of long sequences, it is a pioneering work covering the specialties of a large number of very short sequences.NP‐hard,Since we know that the general problem is The authors declare no conflict of interest.KT proved the theorems, wrote the first version of this manuscript, and prepared figures. VG initiated the study, finalized the manuscript, and secured funding.


The significant decline in the cost of genome sequencing has dramatically changed the typical bioinformatics pipeline for analysing sequencing data. Where traditionally, the computational challenge of sequencing is now secondary to genomic data analysis. Short read alignment (SRA) is a ubiquitous process within every modern bioinformatics pipeline in the field of genomics and is often regarded as the principal computational bottleneck. Many hardware and software approaches have been provided to solve the challenge of acceleration. However, previous attempts to increase throughput using many-core processing strategies have enjoyed limited success, mainly due to a dependence on global memory for each computational block. The limited scalability and high energy costs of many-core SRA implementations pose a significant constraint in maintaining acceleration. The Networks-On-Chip (NoC) hardware interconnect mechanism has advanced the scalability of many-core computing systems and, more recently, has demonstrated potential in SRA implementations by integrating multiple computational blocks such as pre-alignment filtering and sequence alignment efficiently, while minimizing memory latency and global memory access. This article provides a state of the art review on current hardware acceleration strategies for genomic data analysis, and it establishes the challenges and opportunities of utilizing NoCs as a critical building block in next-generation sequencing (NGS) technologies for advancing the speed of analysis. In the 1990s, the human genome project created the first draft sequence of the entire human genome at an estimated cost of USD 3 billion . Since tIn the field of genomics, short read alignment (SRA) is an essential component within the modern bioinformatics pipeline and is one of the most significant computational challenges to date . For perThis article presents a review of the literature on the computational challenges of SRA and in particular, focuses on hardware acceleration strategies. Furthermore, it examines previously implemented NoCs as a mechanism to overcome the principle problem of memory accessibility that currently limits the scale of acceleration. Section 2 provides contextual background and introduce the process of SRA and a typical genomics study with bioinformatics pipeline. Sections 3 and 4 present the principle computational challenges and opportunities related to SRA, focusing on hardware acceleration and NoCs. Lastly, Sections 5 and 6 offer discussion and concluding thoughts on the information presented.NGS techniques are massively parallel, allowing for whole-genome sequencing at unprecedented scale and speed  method commercialized by ABI/Life Technologies represent the second generation of sequencing methods and beginning of NGS revolution. Shorter read lengths (35-700 bp) and high-throughput (1 million—2 billion) are the notable features of these methods. The chemistry behind these methods has been extensively reviewed elsewhere .lsewhere . SequencThird generation: Single Molecule Real-Time (SMRT) sequencing method commercialized by Pacific Biosciences, produces 100 - 200 gigabases per single 20-hour run, with approximately 30000 bp read lengths  molecules  genotyping, i.e. testing for known mutations, and ii) variation analysis, i.e. scanning for any mutation or variants in a target genomic region. Variants are defined as single nucleotide variants (SNVs), small insertions and deletions (indels) and structural variants (SVs) (ts (SVs) .Variant calling focuses on the identification of genetic variants at a whole genome or exome level from DNA sequencing data by comparing it to a known reference genome. For cases where no reference is available or consist of a high number of variants or poor quality sequence alignments, de novo assembly can recover genomic variation at the expense of computational resources  is an integral part of the bioinformatics pipeline, one which ultimately determines the quality of insights achieved  file (BWA (Bowtie (SOAP (Li AM) file . This prAM) file  and a reile    and AtlaVariant calling is of primary importance to clinical practice and pharmacogenomics   (The output reads from NGS machines lack any genome location (coordinates) information. Consequently, for meaningful insights, each read must be first mapped to a known reference genome  between the two sequences consists of four distinct steps: i) defining the scoring schema, ii) initializing the boundary conditions for top row and left column of the matrix, iii) populating the matrix using an update function and finally iv) backtracking to highlight the optimal alignment(s) .Defining the scoring schema: A penalty or cost function is an arbitrary integer assigned for the match, mismatch and insertion or deletion represented as ted as Δ , and generation. .An alternative and more sophisticated method of imposing penalty scores is an affine gap penalty model, which distinguishes between the cost of opening a gap and the cost of continuing a gap rather than applying a fixed penalty for gaps greater than 1 bp in length : In the case of NW global alignment, the optimal alignment score is achieved in only the lower-right cell of the DP matrix. Therefore, optimum alignment is recovered by tracing a path back through the matrix from ignments . In the ignments .Consider an example whereby two sequences lignment  and SW llignment  strategiFollowing the above scoring schema and Equations 4 and 5, the matrix for NW global alignment is initialized for top row and leftmost column, and populated from the recurrence relationship defined in Equation 8 . For SW via global or local alignment at the expense of speed and power consumption  cluster is a series of interconnected desktop computers with central processing units (CPUs) or network servers linked together to form a computing array, typically in a ‘master-mason’ configuration , computing nodes are connected remotely usually over the internet (internet . One of Graphics processing units (GPUs) are high performance integrated circuits first proposed for graphic processing in 1973  ( (FPGAs)  are a pr (FPGAs) .Due to the significant volume of data involved in sequence alignment, a stark relationship exists between scalability and speed of execution. The reliance on global memory access results in a substantial increase in system delays as the system scales in both volumes of data and processing cores. To successfully address the issue of scalability with the ability to maintain a high throughput of data from memory to processing cores, researchers such as via the use of multiple parallel paths with multiple packets. A comprehensive review of NoC structures and design is given by To appropriately convey the significance of NoC enabled hardware acceleration, it is necessary to illustrate the core components of an NoC which is comprised of three distinct physical parts ; networkIn addition, BWA scales linearly, whereas HISAT2  with lossless compression methodologies, have attempted to bring the unfathomable data quantity to more manageable proportions  covering 9 bp each, therefore composed of 18 bits  contributing 2kB per reading for storage in on-chip SRAM  and 5x from changing the random access pattern to near sequential  methodology  within the array due to the short ReRAM cell endurance  interconnect for data transfer instead of a crossbar (4 (reads per second) increase in speed compared to traditional CPU based alignment. The dependence on large external memory significantly limits scalability as the operational cost rises with the number of computational units . InitialAs ASAP , Northern Ireland, UK.None declared.


Comparison of the performance of sequence alignments constructed by MAHDS and previously developed algorithms using the CS and Z score criteria and the benchmark alignment database (BAliBASE) indicated that, although the quality of the alignments built with MAHDS was somewhat lower than that of the other algorithms, it was compensated by greater statistical significance. MAHDS could construct statistically significant alignments of artificial sequences with x ≤ 4.8, whereas the other algorithms  could not perform that at x > 2.4. The application of MAHDS to align 21 families of highly diverged proteins (identity < 20%) from Pfam and HOMSTRAD databases showed that it could calculate statistically significant alignments in cases when the other methods failed. Thus, MAHDS could be used to construct statistically significant multiple alignments of highly divergent protein sequences, which accumulated multiple mutations during evolution.The aim of this work was to compare the multiple alignment methods MAHDS, T-Coffee, MUSCLE, Clustal Omega, Kalign, MAFFT, and PRANK in their ability to align highly divergent amino acid sequences. To accomplish this, we created test amino acid sequences with an average number of substitutions per amino acid ( Algorithms for multiple sequence alignment (MSA) are widely used in modern molecular biology for numerous purposes, including evolutionary studies and molecular modeling. Thus, the publication describing the ClustalW multiple alignment algorithm  is amongIn general, the construction of an MSA is an NP-complete problem, for which no direct solution by dynamic programming methods is possible in a reasonable time, even using modern supercomputers . TherefoIterative methods such as PRRN/PRRP  and MUSCSome MSA algorithms such as SAM  and HMMEx) ranges from 0 to 4.4. At the same time, the other methods such as ClustalW 7], and othan 2.4 . A statiMA’, which is not based on pairwise alignments and direct calculation of MA’ = ζ(SI) but uses patterns (images) of random multiple alignments (IMAR) [IMAR such an image IMAm that would be the closest to IMA = f(MA). The degree of closeness between IMAm and IMA cannot be assessed, since MA and its image IMA = f(MA) are unknown at x > 2.4 for most protein families. However, we can arrive as close as possible to IMA by increasing the similarity measure between each sequence from set SI and IMAm., which can be carried out using global two-dimensional alignment. Each such comparison would produce a maximum value of similarity function Fmax(i) , and the sum mIMA and IMA. The greater mF is obtained with the same global alignment parameters, the more similarity there is between mIMA and each sequence from set SI and the closer mIMA is to IMA. We will also use mF as an objective function when running a genetic algorithm to calculate mIMA, which then would be used to define multiple alignment: mMA = −1(IMAmf).However, there is another way of constructing s (IMAR) . These if and f−1. As function f, we can take the algorithm for creating a position weight matrix (PWM), which would be the image of multiple alignment, i.e., IMA = PWM and IMAm = PWMm  was expanded from 4 to 20 symbols to correspond to the number of amino acids so that protein sequences could be aligned. The scheme of the algorithm is shown in Compared to the method described in , here weSI sequences whose number is N (step 1). In step 2, we created a set (Q) of random PWMs, each of which served as a random image IMAR. In step 3, we used a genetic algorithm to optimize each PWM from set Q and determine PWMm = mIMA. In step 4, we created multiple alignment mMA for sequences from set SI, which corresponded to the found PWMm. Finally, in step 5 we evaluated the statistical significance of the Monte Carlo alignment.At the beginning, we have Q of random PWMs, PWM rows were represented by 20 amino acids and columns by integers from 1 to L; thus, the PWM dimensions were 20 rows and L columns. A random PWM was obtained from a random amino acid sequence S1 of length Lk (k = 103), in which the frequencies of amino acids corresponded with those in the sequences of set SI. Then, a sequence containing integers from 1 to L was generated, copied k times, and joined in tandem to yield sequence S2.To create set M(s1(i), s2(i)) = M(s1(i), s2(i)) + 1 for all i from 1 to Lxk, determined sums Q   was similar in the alignment of sequences from set SI with each random PWM. For normalization purposes, two restrictions were imposed on PWMs:1(i)p and 2(i)p are probabilities of amino acids in sequence S1 and of symbols in sequence S2., respectively. Upon transformation, any PWM used in the algorithm must be reduced to the given 2R and dK. The matrix transformation procedure is described in detail in [Then, we performed transformation of the matrices from set etail in .2R cannot be set constant, since in this case the number of cells in the PWM would increase and the cell values would not remain in approximately the same order (as needed) but would rather tend to approach zero in order to correspond to Equation (1). Therefore, 2R was specified as a function of the period and cardinality of the SI sequence alphabet: 2 = RLAinLR, where LR is the multiplier parameter, which can be used to scale 2R.However, it should be noted that SI may have different lengths, we created sets of matrices Q(L) with length L ranging from Q(L) set contained 500 PWMs.As the sequences in set .1L¯ see . Each Q with the size |Q| = 500 PWMs (Q(L), global alignment with each sequence from set SI was carried out. We calculated similarity function Fmax(l) at point (L1(l), L), where l is the sequence number in set SI, L is the number of columns in the PWM, and L1 is the length of the l-th sequence from set SI. Then, the mF value was calculated and used as an objective function for PWM matrices from set Q(L):k is the index of the matrix from set Q(L).Then, we calculated PWMetail in ,33 , was saved, whereas two PWMs with the smallest mF values were excluded from set Q(L). Then, we created two children from the remaining PWMs; as before [mF value. In addition, random mutations were introduced into 50 randomly selected PWMs (except children created at this step) by replacing one random element by a random value evenly distributed in the interval from −10 to 10. After these changes, a new Q(L) set was generated, its matrices compared with the sequences from set SI, and a new vector mF(k)  was obtained. The procedure of modifying set Q(L) was iterated until mF(1) ceased to increase during the last 10 cycles. As a result of the genetic algorithm for set Q(L), mF(1) (denoted as LmF(1)) and the corresponding PWM were obtained.The PWMs were ranked according to s before ,33, the Q(L) set for L from L value for which LmF(1) was maximal; it was denoted as mL and the corresponding matrix as PWMm.The iterative procedure was performed in each SI(l) of length L1(l) was aligned with a PWM of number k from set Q(L). Sequence SI(l) was denoted as S3 and its elements as s3(i), where i = 1, 2, ..., L1(l). We also used sequence S4 with elements s4(j), where j = 1, 2, ..., L.Next, sequence s3(i) and s4(j), we used the global alignment algorithm [Q(L) [d and e are gap opening and gap extension penalties, respectively. Fmax(l) = F(L1(l),L)  we remembered the number of the cell from which we arrived at this cell using Formula (4). As a measure of similarity between set SI(l) and the PWM from set Q(L), we have chosen:m of length mL (SI(l) using matrix F’, and the results were applied to calculate multiple alignments of sequences SI(l) , which were evaluated according to m)mF.To construct the alignment of sequences lgorithm  with an hm [Q(L)  instead L1(l),L)  was usedength Lm  was aligmMA for the SI sequences  sequences  with PWMm. For this, sequence S4 with elements s4(j)  was arranged horizontally, and under it the alignments of SI(l) sequences  generated in SI(l) sequences had an insertion of k amino acids compared to sequence S4, then additional k columns were created for these amino acids in the s4(j) sequence (if they were not created for any other SI(l) previously). As a result, mMA was constructed.To obtain equences , step 4,mMA obtained with mPWM PWM using Formula (6), its arithmetic mean D(mF(mPWM)), and, finally, Z:Z value greater than threshold Z0 indicated that the alignment obtained with mPWM was statistically significant.To evaluate the statistical significance of the constructed multiple alignment ith PWMm , step 5,MA with length K containing α sequences, each denoted as k = 1, 2, ..., α and j = 1, 2, ..., K). Let us also introduce sequence S6 with elements s6(j), j = 1, 2, ..., K representing consecutive numbers from 1 to K; S6 would be used as column numbers for MA. First, we transform MA to remove those columns where the number of amino acids is less than α/2 and that of deletions is more than α/2; as a result, multiple alignment MA’ of length K’ is obtained. At the same time, sequence S6 is transformed by eliminating the numbers equal to those of the columns to be removed. As a result, we obtain sequence K’. Then, we calculate the amino acid frequency matrix for MA’ denoted as V, where i = 1, 2, …, 20 and j = 1, 2, …, K’; each element shows the number of type i residues at position j of MA’. Next, we calculate the PWM based on matrix V as: X(i) is the number of type i residues, and Y(j) is the total number of residues in the j-th column of MA’. Then, we transform PWM according to Formulas (2) and (3).The algorithm described above can be applied to evaluate the statistical significance of any alignment. Let us take an PWM′, the weight of MA can be determined. First, we compute the sum for all k = 1, 2, ..., α and j = 1, 2, ..., K: Del(i) vector, which shows the number of deletions with size i in MA. Finally, we calculate MA weight. Then, statistical significance should be evaluated by estimating mean D(MAF). For this, symbols characterizing deletions are removed from k = 1, 2, ..., α, and the statistical significance is determined for matrix PWM′ and sequences N = K, and mPWM = PWM′. Thus, we calculate the Z value for MA, which enables comparison of different MAs by their statistical significance.After calculating Anc of length L and then a set of descendant sequences Des(i)  by adding a given number of random substitutions and/or indels to Anc in a random order. In case of random substitutions without indels, the lengths of child sequences were the same and equal to L, and the number of substitutions in each Des(i) sequence with respect to Anc was denoted as s1. Let us show that the presence of s1 random substitutions in each Des(i) sequence leads to 2s1 random substitutions between any two Des sequences.To compare the performance of MA methods T-Coffee, MUSCLE, Clustal Omega, Kalign, MAFFT, and PRANK with that of the MAHDS algorithm, we used artificial sequences, which can be created with a given number of amino acid substitutions and indels for convenience of analysis. To generate an artificial sequence, we first created a random ancestor sequence Anc, the probability that in sequence Des(1) with the number of substitutions s1 a residue at position j will be changed is 1/L. Then, the probability that after s1 replacements residue j will not be replaced is:When one random substitution is made in sequence Des(1) sequence occur with equal probability. For the rest of amino acids, it is likely that during the last replacement in a given position, the original amino acid will appear as substitution. The probability of falling into this category is:j in sequence Des(1) will match the residue at Anc is:We assume that amino acid substitutions during the creation of the j remains unchanged after random substitutions.The events described in Formulas (9) and (10) are applicable to all situations, when a residue at position Des(2) and Des(3) are independently generated from sequence Anc by making s2 random substitutions. Then, for both sequences, Formulas (8)–(10) can be presented as: mP3 as a probability that in Des(2) and Des(3) two residues could match. If mP3 = mP, then the evolutionary distance between Anc and Des(1) is equal to that between Des(2) and Des(3), which means that, on average, the same number of amino acids coincide between Anc and Des(1) and between Des(2) and Des(3). In Des(2) and Des(3), the proportion of residues unchanged compared to Anc is 02P; then, the proportion of residues preserved at the same positions of child sequences is Des(2) and Des(3). Other amino acids matching in Des(2) and Des(3) include those that have been substituted with the same residues in both sequences, and the probability of such events is Now, let us consider the case when sequences Anc in Des(2) could match the one randomly replaced in Des(3) and vice versa. The sum of the two probabilities is: mP3 = mP, then 02P and 0P are substituted, then:Finally, there is a probability that a residue that remained from 2s random substitutions introduced in Des(i) sequences is equivalent to twice the number of 2s mutations in pairwise comparison of Des(i) sequences relative to Anc, which happens under the condition that all child sequences in set Des(i)  are generated independently of each other. We used this property in the calculation of the average number of mutations between Des(i) sequences.Formula (11) means that the number of https://github.com/katri2/MAHDS_addition (21 March 2022). Programs developed in paragraphs 4.6.2 and 4.7 can be obtained from the site


Correction to: BMC Genomics 22, 683 (2021)https://doi.org/10.1186/s12864-021-07975-7Following publication of the original article , an erroIt currently reads:In “Library preparation, HTS and data analysis” in the Methods section, the description “Overlapping paired-end reads from the 5′ RACE-based library were merged with FLASH [20], and these merged sequences were aligned to the germline Vγ and Jγ segments identified above using a local BLAST program (version 2.2.30) and each sequence was assigned an optimal germline Vγ and Jγ segments” is wrong. Actually, the atuhors used the 3′ end reads which contain the Cγ-specific reverse primer for 5′ RACE and 250 bp in length to analyze the optimal germline Vγ and Jγ segments that participated in Vγ-Jγ rearrangement. This error does not influence any conclusion of this paper.It should read:In “Library preparation, HTS and data analysis” in the Methods section, use “The 3′ end reads which contain the Cγ-specific reverse primer for 5′ RACE and 250 bp in length were aligned to the germline Vγ and Jγ segments identified above using a local BLAST program (version 2.2.30) and each sequence was assigned an optimal germline Vγ and Jγ segments.”All the changes requested are implemented in this correction and the original article  has been


The function of non-coding RNA sequences is largely determined by their spatial conformation, namely the secondary structure of the molecule, formed by Watson–Crick interactions between nucleotides. Hence, modern RNA alignment algorithms routinely take structural information into account. In order to discover yet unknown RNA families and infer their possible functions, the structural alignment of RNAs is an essential task. This task demands a lot of computational resources, especially for aligning many long sequences, and it therefore requires efficient algorithms that utilize modern hardware when available. A subset of the secondary structures contains overlapping interactions , which add additional complexity to the problem and are often ignored in available software.We present the SeqAn-based software LaRA 2 that is significantly faster than comparable software for accurate pairwise and multiple alignments of structured RNA sequences. In contrast to other programs our approach can handle arbitrary pseudoknots. As an improved re-implementation of the LaRA tool for structural alignments, LaRA 2 uses multi-threading and vectorization for parallel execution and a new heuristic for computing a lower boundary of the solution. Our algorithmic improvements yield a program that is up to 130 times faster than the previous version.With LaRA 2 we provide a tool to analyse large sets of RNA secondary structures in relatively short time, based on structural alignment. The produced alignments can be used to derive structural motifs for the search in genomic databases. Non-coding RNAs (ncRNAs) are RNA molecules that do not translate into proteins, but instead have various functions, e.g. they participate in splicing or gene regulation. Analysing ncRNA molecules by comparison to functionally related RNA molecules requires more than sequence information, because their function is primarily determined by their structure, which is often better conserved than the primary sequence. Hence, sequence–structure alignment rewards the conservation of structural interactions of the ncRNA molecules, which is a key property for many applications, e.g. finding homologous structures of known ncRNA families , phylogeIt is now well-established that ncRNA molecules introduce an additional layer in genetic information processing. They play a significant, active role in cell and developmental biology and carry out many tasks that were previously attributed exclusively to proteins. However, only a small fraction of ncRNA families have been identified so far and many more can still be discovered . StructuOwing to the importance of ncRNA molecules, there has been a steady stream of developments for analysing the molecules computationally. Specific rules govern RNA structure formation, therefore structured RNAs provide clear patterns of selection with base pairing patterns directly reflecting structural conservation . In othen. The tool LocARNA [Considering structural information unfortunately adds complexity to the problem of aligning two or several sequences. The original algorithm for simultaneous alignment and folding by Sankoff  has the  LocARNA  reduces al {O}}n^$$\end{doldAlignM  and LaRAldAlignM .Fig. 1ThIt is estimated that about udoknots , which amentclass2pt{minimudoknots  that hasudoknots . In pseuudoknots . In factudoknots –26.A short run time in relation to the problem size is an important aspect. Given the current rapid increase of the size of data sets it is essential to have efficient implementations available that solve the structural alignment problem in reasonable time, while securing a sufficient quality of the results. Some programs already allow to distribute the work on several cores for parallel execution through multi-threading. We go a step further and combine multi-threading and vectorization with SIMD instructions: By storing the data of 4 or 8 alignments in vectors we compute a vector of alignments simultaneously on each core. For example, with 16 cores and vector length 8, we process 128 alignments simultaneously.Previous work has been done on the vectorization of the pairwise alignment computation using the wavefront approach , 28 and In 2007 and 2008 the tools LaRA and T-LaRA , 30 intrWe present an improved and parallelized version of the LaRA program for RNA sequence–structure alignment, which is up to n. The paper demonstrates besides RNAmountAlign also good performance for LocARNA [For a complete overview of all tools related to sequence–structure alignment we refer to the review paper by Lalwani et al. . A recen LocARNA . LocARNAl Pankov , which hThe general workflow for LaRA is as follows: For given entclass1pt{minimaKatoh and Toh  presenteThe following paragraphs introduce how LaRA solves pairwise sequence–structure alignments, however for the mathematical background we refer to the LaRA paper .Vertical alignment edges exist between each combination of a node from the first sequence and a node from the second sequence. For distinction, we use the term line for this type of edge. If a line l is active, i.e. the connected nodes are aligned, the flag Horizontal interaction edges represent structural alignment. Let l which is incident to the left interaction partners and line m which is incident to the right interaction partners. We draw two directed edges  and  between those two lines and assign weights l, m) is active and 0 otherwise.In order to represent a valid alignment, the graph needs to satisfy the following constraints:All active lines must be conflict-free, i.e. any two lines with Each line is incident to at most 1 interaction edge.An interaction edge can only be active if the line at its origin is active.l, m) the reverse edge must also be active: For any active interaction edge  of the sequences to be aligned by using the RNAfold tool , a widelrelaxed solution, because it may violate the last constraint. Its score valid solution, because the computed alignment is optimal with respect to fewer constraints.The problem can be solved by applying Lagrange relaxation on the last constraint: The maximum profit that a line can contribute is the weight of the maximum weighted outgoing edge plus the line weight itself, minus a penalty if the last constraint has been violated. The maximum score for each line is interpreted as a value in a position-specific score matrix, which is then used by a global alignment algorithm, e.g. Needleman and Wunsch . As a rel and m the equation valid structural alignment and its score If for all pairs of lines Overall, LaRA iteratively solves the relaxed problem, where the penalty for violating the constraint is incorporated in the scoring matrix. In each iteration after the alignment a new lower bound is computed by finding the best structural interactions of this alignment. The solutions get increasingly better through the iterations and the bounds entclass1pt{minimaThe following subsections describe algorithmic and implementation details of the LaRA 2 program and point out the differences from the old version.LaRA 2 consists of five main steps as can be seen in Fig. The second step computes and validates the alignment graph, which we introduced in the previous section, ensuring that the constraints are satisfied. The application of a sequence alignment algorithm ensures that aligned base pairs are mutually conflict-free: in Fig. Step three formalizes the constraints as an integer linear program (ILP) with an objective function designed to maximize the weighted sum of sequence and structure scores, as introduced in the previous section.In the fourth step we solve the ILP with Lagrangian Relaxation. The solution to the relaxed ILP can be computed via a sequence alignment with position-specific scores, and it serves as an upper boundary of the optimal solution. It is based on the Needleman-Wunsch algorithm in which we allow choosing among three different gap scoring models: Linear , DynamicStep five combines the pairwise alignments progressively according to the pairwise similarity. We use the multiple sequence alignment program T-Coffee or the MAFFT X-INS-i framework to combine all pairwise alignments into one multiple alignment.In the following subsections we describe deeply some of the most important optimizations implemented in LaRA 2 for improving both performances and quality of produced alignments.structure annotation. An RNA sequence is a string of n characters over the RNA alphabet n is given as an i and nucleotide j forming a pair in the secondary structure of the RNA molecule.LaRA 2 works on a set of at least two RNA sequences with RNAfold tool [If the structure information is not available, LaRA 2 can internally compute it with the old tool , which cThe first implementation of the LaRA algorithm  computesTo make the LaRA algorithm amenable for acceleration via vectorization, we changed the internal logic. In the LaRA algorithm each individual, pairwise sequence–structure alignment is solved using a Lagrange relaxation approach which in essence computes a series of interleaved standard sequence alignments with position dependent scores and a matching routine to adapt the Lagrange multipliers. In Algorithm 1 the code in line 3 shows the inner loop which computes per iteration one alignment followed by a general matching to update weights for the alignment in the next iteration. all pairwise sequence alignments followed by a parallelized version of the matchings. This can be seen in Algorithm 2. This parallelized computation of the first iteration step is then followed by the second iteration of sequence alignments and matchings. We measured that the sequence alignment step is about 200 times faster on a 16 core standard Xeon processor with 256 bit SIMD registers  position-specific score matrix A valid solution  of the original alignment problem is computed by applying a maximum weighted matching (MWM) algorithm on the interaction graph that is depicted in Fig. We have tested two different heuristics for MWM: The Blossom algorithm by Edmonds , which iThe main idea of the Blossom algorithm is to search for cycles consisting of an odd number of edges and contract each such cycle into a single node, which is called a blossom. The search is then continued in the reduced graph.k edges from the beginning of this list and perform an exhaustive search on the maximum weighting combination. The selected edges become part of the resulting matching and all incident edges are excluded from the list. We repeat this process with the next k heaviest edges from the list until the list is empty.In our greedy approach we generate a list of all edges sorted by their weight. Then we consider the heaviest We find that using the greedy approach with The score for the lower bound of the current LaRA 2 iteration is the sum of the weights of the edges that are part of the computed matching, plus the sequence alignment score. The highest score over all iterations together with the corresponding alignment is reported as the valid solution of the pairwise sequence–structure alignment problem.LaRA 2 can produce two different output formats, which can be selected with a parameter: MSA library for T-Coffee  and pairThe MSA library is a data structure that stores the base pairings with their individual scores for each of the T-Coffee  algorithThe pairwise alignment output is designed to be parsed by the MAFFT framework and contains three lines per pairwise alignment: The first line is a header line similar to the FastA format containing both sequence identifiers, and the other two lines consist of the first and the second aligned sequence. The aligned sequences possibly contain gap symbols and have equal length. Through the four-way-consistency score in MAFFT it incorporates the structural information not only through the (here unweighted) base pairs in the pairwise alignments but additionally from the initial base pair probabilities resulting from the McCaskill algorithm.In case We implemented the algorithm for pairwise structural alignments in a new C++ program with the name LaRA 2, which computes structural alignments with pseudoknots in high quality. It is capable of processing large data sets because of its enormous speed-up thanks to its implementation optimized for multi-threading and vectorization. The name reflects that the underlying model is the one of LaRA  that hashttps://seqan.github.io/lara/ provides assistance for using LaRA 2 with T-Coffee or MAFFT for multiple structural alignments and demonstrates the supported input and output formats.Alongside the program we develop an interactive iPython manual that serves as a template for getting started and provides practical use cases. Furthermore, the manual on ® Xeon® CPU E5-2650 v3 with 2.30 GHz and 126 GB RAM. We compiled with GCC version 9 and where applicable, we used up to 16 threads and AVX2 instructions. For the benchmarks we have used the program versions and parameters displayed in Table In order to demonstrate the performance of LaRA 2 compared to relevant existing software, we evaluate three different benchmarks with focus on multiple alignment with conserved structure, run time on a large data set, and the detection of pseudoknots. All benchmarks have been performed on a Linux server using an x86_64 architecture with IntelIn this benchmark we show the performance across several RNA families dependent on the sequence similarity. We took the BRAliBase 2.1 data set, which consists of 388 reference alignments of 5 sequences each. For RNAmountAlign we excluded 46 sequences that contain the character ‘N’, because the program does not accept wildcard symbols.In order to evaluate the resulting multiple structural alignments we use two metrics: SPS and MCC. The sum-of-pairs (SPS) score is a measure of similarity between the test alignment and the curated reference alignment that is available in the Rfam database . Values RNAalifold from the ViennaRNA package [PETfold [i in the test alignment and i in the reference. Based on these sets we define the confusion matrix and calculate the MCC. Note that the true negative (tn) value contains the number of all possible base pairs that are contained in neither the test nor the reference set.In order to compute the MCC Eq. , we foll package . We have[PETfold  as well,[PETfold . In the RAliBase , we diviThe results demonstrate that LaRA 2 performs as good as LocARNA and LaRA 1, and better than RNAmountAlign and MAFFT. In the alignments with more than Another question that has concerned us is the performance drop of all programs around the s et al.  have poiFor the structure evaluation with Matthews correlation coefficient we find again that LaRA 2 has the same performance as LocARNA and LaRA 1, while outperforming RNAmountAlign and MAFFT. An interesting observation is the decline of the reference curve for high sequence similarity, which is mainly represented by alignments of the tRNA family. For the reference curve we computed the optimal structures of the BRAliBase reference alignments with RNAalifold  , which is impressive in the light of its non-parallel execution, but shadowed by its performance in the benchmark. LaRA 2 with MAFFT runs in less than 13 min, LocARNA takes almost 35 min and the single-threaded LaRA requires more than 1 h to compute the test alignments. MAFFT is the fastest among all tested tools, however this is expected because sequence alignment is a less complex problem. As there are only five sequences aligned at a time, parallel execution has just a minor effect compared to the benchmark in the following subsection.In addition, we examined the time and memory consumption of LaRA 2 with respect to the average sequence length. As the BRAliBase data set contains rather short sequences (up to 300 bases) we extended the set with two additional RNA families from the RNAStrAlign database : TelomerIn order to demonstrate the ability of LaRA 2 to process large data sets in reasonable time, we use the plastids data set from the 5SrRNAdb  databaseThe speed-up of LaRA 2 with MAFFT using 16 threads is about 9 which is much better than the other tools. With T-Coffee it reduces to a factor of 3 due to the non-parallel implementation of T-Coffee. Still this is the same speed-up as LocARNA. Taking a look at the peak memory allocation in Table In addition, we use the Plasmids data set to demonstrate the scaling of the run time of pairwise structural alignments with LaRA 2 in the light of SIMD instruction sets and multi-threading. Figure RNAfold, which takes constantly 25 seconds. An additional effect has a larger memory allocation, e.g. for AVX2 instructions and 16 threads the program needs to allocate 128 alignments.The effect of SIMD instructions is a speed-up of Although it is estimated that eudoknot  the mostWe show with SPS values of some pseudoknotted RNAs from Rfam and in a graphical example that LaRA 2 actually detects pseudoknots. SPS scores express the similarity to the reference alignment and therefore a high score indicates that the pseudoknot is aligned properly, however a low score can result from a different location and is not sufficient to prove the absence of the pseudoknot in the test alignment.The scores in Table We have chosen a structure for the graphical example where the pseudoknot interactions are biologically essential: Athanasopoulos et al.  describeWe computed the structural multiple alignment from the seed sequences with all the tools. Based on these alignments we ran IPknot  Any restrictions to use by non-academics: None


Many important applications in bioinformatics, including sequence alignment and protein family profiling, employ sequence weighting schemes to mitigate the effects of non-independence of homologous sequences and under- or over-representation of certain taxa in a dataset. These schemes aim to assign high weights to sequences that are ‘novel’ compared to the others in the same dataset, and low weights to sequences that are over-represented.We formalise this principle by rigorously defining the evolutionary ‘novelty’ of a sequence within an alignment. This results in new sequence weights that we call ‘phylogenetic novelty scores’. These scores have various desirable properties, and we showcase their use by considering, as an example application, the inference of character frequencies at an alignment column—important, for example, in protein family profiling. We give computationally efficient algorithms for calculating our scores and, using simulations, show that they are versatile and can improve the accuracy of character frequency estimation compared to existing sequence weighting schemes.Our phylogenetic novelty scores can be useful when an evolutionarily meaningful system for adjusting for uneven taxon sampling is desired. They have numerous possible applications, including estimation of evolutionary conservation scores and sequence logos, identification of targets in conservation biology, and improving and measuring sequence alignment accuracy.The online version contains supplementary material available at 10.1186/s12859-021-04183-8. Some of the most popular applications in bioinformatics, including multiple sequence alignment , sequencrd, with r the number of different characters at the considered alignment column and d the number of times the character of the considered sequence and position appears in the considered alignment column. The idea of this weighting scheme is to give equal weight to all characters observed at one alignment column, dividing this weight equally among those sequences sharing that character at that position. This method has the advantage of being very fast to calculate, and of giving higher weights to sequences with more rare characters that are, therefore, likely more distantly related.PSI-BLAST , for exaHMMER  and the Other sequence weighting schemes have also been proposed, although they have seen fewer applications. Maximum discrimination sequence weighting  is a comThe many weighting schemes proposed have rarely been assessed and compared under different scenarios. We show that heuristic approaches can suffer from limitations: for example GSC94, while providing good performance on ultrametric trees, can lead to inaccurate results on non-ultrametric trees. Instead, here we propose a new weighting scheme, the first to be derived from the idea of evolutionary ‘novelty’. We quantify the novelty of each sequence compared to the other sequences under consideration by computing the probability that, at a given position, sequences are ‘phylogenetically identical by descent’ (PIBD): that is, that they descended from a common ancestor without any substitution occurring. Our terminology highlights the similarity with the concept of “identity by descent” in population genetics (see e.g. ), where As shown by the examples above, this new weighting scheme has a number of possible applications, from gene family profiles and multiple sequence alignment evaluation to ecology and conservation biology. The aim of our work is to provide a new sequence weighting scheme that is robust to the choice of application and scenario, therefore giving the possibility of improving the accuracy of these bioinformatics tasks, while at the same time being sufficiently computationally efficient to be used on large datasets. As an example, we focus on the task of inferring character frequencies at an alignment column. Inference of character frequencies is not only important for gene family profiling, but also for modeling evolutionary fitness, calculating conservation scores, and visualizing sequence logos –38. We sN tips s is compared to the other tips of A. We start by defining weights that are a function of We consider a phylogenetic tree As a motivating example, if es e.g. , 39, 40), 40\docuIf instead 1, as in , 39, 40.A even if they share the same character, as long as they are not PIBD.A simple way to describe how novel s) that are PIBD to s, i. For example, s) in s at some arbitrary alignment column. We then define the weight s within t are PIBD is t/2, t, of course.We usually cannot know for sure if sequences are PIBD and at which alignment column, so we define  model  is the most computationally efficient, and so is described below, but may also be the most difficult to understand. For this reason, we also mention other approaches and include their full description in the Supplement. In the following we assume that the phylogeny evolver [INDELible [i to a tip of i tips. The final weight of a tip is then obtained by averaging its scores over all iterations. Weights D. A straightforward but inefficient way to achieve the same result is to simulate characters without any conditioning, and discard those iterations that do not match D. These approaches are described in more detail in the Supplement.We can calculate PNS by simulating sequence evolution along ds  unt unt\docu[evolver  or “methNDELible  that onlapproach  to samplWe can calculate PNS via brute-force, that is, by enumerating all possible mutational histories on T iteratively on each subtree of The ESNs lgorithm . See theN.We now present the main, efficient algorithm that we use and recommend for calculating PNS. It can be used for calculating either lgorithm . The metroach of . The comQ is given. We make no assumptions regarding the state space of the substitution process, which can comprise nucleotide, amino acid or codon states [k at the end of a branch of length t, conditional on having character j at its start, is then j and column k of j at the top node of a branch of length t, we denote the probability that no substitution occurs along the branch, and therefore also that the top and bottom nodes of the branch are PIBD, as:j, the character at the start of the branch. This is because In the following we assume that the substitution rate matrix n states , and excn states ). The prtQ). See  for a mos of D; for the case that one is interested in D as non-informative.  As before, we denote the observed character at tip s by s also as Our objective is to calculate, for each tip mentclass2pt{minimi tips in i tips in j in i tips in j in i tips in j in For most of the following, we condition probabilities on information from only part of s of j, and for The first step of the up phase is to initialise b with length t connects the two nodes b splits b) and all its descendant nodes and branches, and b) not in b, and therefore know j and every j and every b, while the second summand relates to the case in which at least one mutation event happens on b. Graphical examples for Eqs. i is larger than the number of tips in Next, starting from the tips, we move iteratively ‘upward’, toward the root of mentclass2pt{minimj and every j and every N. Equation Thanks to Eq. j. We stop once we reach node j and b of length t connecting nodes b. Assuming that we have already visited iteratively all ancestor branches of b, and therefore know j and j and j and j. After we have visited every internal node of s using Eq. j and all s (and its parent branch) from s, for all characters j and each s as:D). In the case D is empty, that is, if we want to calculate weights s sum over i to 1. In either case, the final PNS scores can be easily calculated substituting the results from Eq. Using Eqs. mentclasspt{minimamentclass2pt{minimWe summarise the ‘down’ stage of the algorithm in Eq. N. In some circumstances, for example when s, we have The most efficient algorithm above has cubic cost in mentclass2pt{minimj [Inference of character frequencies specifically for a single alignment column has broad applications such as modeling selection , 35, andracter j . This dep(j) of character j within the given column as an estimate of the true frequency p(j), which will be dominated by within-human genetic variation. However, human sequences are highly correlated, as they have very short divergence time between each other, so within-human allele frequencies will typically not represent evolutionary equilibrium character distributions. The problem here is that using p(j) as an estimate of The simplest inference method is to use the observed frequency s at the alignment column D under consideration, and A traditional way to address this problem is to use sequence weights, for example our s, the score of s at an alignment column D, which we will denote rd, with r the number of different characters in D and d the number of times character D. The weight for sequence s, which we denote D of alignment A.We investigate and compare the performance, for character frequency inference, of the three weighting schemes introduced above: fined by , which ws is assigned as the initialisation value of the weight s. Then, every time an internal branch b is visited, its length t is distributed among the weights of its descendant sequences. More precisely, first t is split among the tips, with the part s being b. Secondly, each GSC94 defines sequence weights iteratively along a phylogeny, by visiting branches in post-order traversal (from the tips to the root). First, all terminal branches (those connected to the tips of p(j) based on the observed frequencies, and A using FastTree v2.1.10 [D at a time, only the equilibrium character frequencies In addition to the character frequency inference  v2.1.10 ) and thej 100 times in an alignment column from 100 distantly related species leads all above methods to infer j; however, so also does observing j two times within an alignment column of just two closely related sequences. While in the first scenario there should be little uncertainty regarding the inferred frequencies, in the second scenario uncertainty should be elevated. Using a Bayesian method is a natural way to address this issue, and also allows the inclusion of priors over characters frequencies. Here we present a Bayesian variant of the weight-based character frequency inference of Eq. Above, we introduced point estimate methods for character frequency inference. These methods do not measure inference uncertainty, and this can result in a very limited summary of the available data. For example, observing character A is composed of N independent (non-homologous) sequences, the likelihood of a column D is A are related by a phylogeny priori. Alternative priors are possible, and some might be more realistic, but usually at the cost of introducing more parameters in the model. Our approximation of the posterior probability a posteriori and ML B is the number of possible characters in the considered alphabet, scipy [If as BEAST  or MRBAYas BEAST , but at ibutions . The .Specific equilibrium character frequencies mentclass2pt{minimp(j) described above),the observed character frequencies in the alignment column  with PhyML v3.1 .All the methods above, except FastTree and PhyML, were implemented in custom Python scripts available from https://bitbucket.org/nicofmay/noveltyscores.Our aim is, for each replicate and each alignment column, to infer  v2.1.10 . We thenWe consider alternative tree lengths, which we obtain by multiplying all branch lengths in the tree in Fig. We consider the case of amino acid characters instead of nucleotides. In this case, we simulate under an LG substitution model , and whementclass2pt{minimTo test the effect of very biased taxon sampling in an alignment, we added multiple (either 100 or 1000) human tips to the tree in Fig. To test the robustness of methods to the assumption of an ultrametric tree , we consider the case of a strongly non-ultrametric trees, as is common for some viruses such as influenza.In addition to the basic simulation scenario, we also consider variant scenarios in order to investigate how certain parameters can affect the results:https://bitbucket.org/nicofmay/noveltyscores), making use of the phylogenetic python package dendropy [We implemented all the considered weighting schemes and all simulations within custom Python scripts , which also needs to be run once for each alignment column. All other approaches are at least one order of magnitude faster than PhyML and Computational efficiency is one of the main requirements for applicability of weighting schemes, in particular when considering large datasets; for this reason, here we compare the computational demand of different approaches. Calculating sequence weights based on a phylogeny (PNS and GSC94) usually requires limited computational demand, with the dominant cost being the estimation of the phylogeny itself Fig. : Fig. S4entclass1pt{minimaHere we assess the ability of different weighting schemes, including those derived from our new PNS methods, to facilitate inference of column-specific character frequencies. We measure the accuracy of an approach by calculating, at each alignment column, the Euclidean distance between simulated and inferred character frequencies. ML phylogenetic inference with PhyML is almost always the most accurate method Figs.  and 5. TAll the weighting schemes considered improve character frequency inference compared to the simplest approach of counting the observed characters at an alignment column Figs.  and 5. GWe note that in Figs. A limitation of GSC94 is that it does not work well with trees in which tips have very different distances from root (non-ultrametric trees). This effect has limited impact in our basic simulation scenario, as the tree in Fig. Using sequence weights conditional on the data at the specific column, i.e. entclass1pt{minimaUsing a Bayesian approach to character frequency inference means that the prior on character frequencies can affect the result of the inference. This can have a positive effect if the prior distribution is based on reliable evidence from sources other than the currently considered dataset. However, in our simulations we consider a completely arbitrary prior  and this has the effect of slightly shifting the inferred frequencies closer to a uniform distribution  based on rigorous mathematical principles. These scores summarise how novel is a sequence , in evolutionary terms, with respect to the rest of the alignment  and have a number of desirable properties, including meeting the objective criteria of .We have showcased our scores’ potential use by considering, as an example application, the inference of position-specific character frequencies. We demonstrate, using simulations, that our scores can improve accuracy of character frequency estimation compared to some popular sequence weighting schemes, in particular HH94  see forC, E. Thip(j) is the frequency of character j at a given alignment column, and B is the number of characters (p(j) are inferred from the observed character frequencies at an alignment column; however, as we have shown, our PNS can significantly improve the inference of these frequencies, and therefore of conservation scores. Our simulations suggest that this is in fact the case   or the nPD , quadratPD [Q  and the ument}HP .Lastly, we note that our scores could be used to improve the definition of phylogenetic effective sample size to be used for AICc  and BIC We have proposed new sequence weights that benefit from a number of favourable properties and are derived from rigorous mathematical evolutionary principles. These weights do not enjoy the same level of computational efficiency and simplicity of some other methods, in particular due to the requirement of an input phylogenetic tree relating the considered sequences. However, when applied to the inference of character frequencies, we showed that these sequence weights can be used effectively in a broad range of scenarios, offering considerable computational advantage over full phylogenetic ML estimation, and often leading to more accurate estimates than other sequence weighting schemes. Thanks to their computational efficiency and robustness to phylogenetic assumptions, our phylogenetic novelty scores could have a positive impact in a number of fields, from sequence alignment and protein family profiling to phylogenetics and conservation biology.Additional file 1. Supplementary Methods and Figures.