Collections of genetic sequences belonging to related organisms contain information on the evolutionary constraints to which the organisms have been subjected. Heavily constrained regions can be investigated to understand their roles in an organism’s life cycle, and drugs can be sought to disrupt these roles. In organisms with low genetic diversity, such as newly-emerged pathogens, it is key to obtain this information early to develop new treatments. Here, we present methods that ensure we can leverage all the information available in a low-signal, low-noise set of sequences, to find contiguous regions of relatively conserved nucleic acid. We demonstrate the application of these methods by analysing over 5 million genome sequences of the recently-emerged RNA virus SARS-CoV-2 and correlating these results with an analysis of 119 genome sequences of SARS-CoV. We propose the precise location of a previously described packaging signal, and discuss explanations for other regions of high conservation. A key challenge in the development of antivirals is the relative lack of targets that are sufficiently conserved across multiple families of viruses for drugs to exhibit a broad spectrum of activity. Coupled with the need to avoid host toxicity from drug cross-reactivity with host molecules, the identification of drug targets that control key lifecycle features of viruses, but that do not have close analogues in the host or in unrelated viruses, becomes an important goal. The identification and functional characterisation of such targets is a difficult informatic and biological problem, precisely because of the lack of analogues for comparison.3, noted a previously undescribed open reading frame in enteroviruses4, and identified conserved structural elements in group A rotaviruses5. Many such approaches have used a sliding window technique to find conserved regions in sequences: such a technique is often adequate, as demonstrated by its successes, and is particularly appropriate when the length scale of the expected regions is known, but otherwise it imposes a length scale on the problem that may make it more difficult to discover regions differing from this scale. The difficulty may be overcome by repeating analyses with different window sizes, at a cost of increased computational and analytical time and increased risk of false-positive signals.One class of approaches to this problem seeks to find regions of high conservation in viral nucleic acid that cannot be explained by conservation in resultant amino acids. The idea of these approaches is that such nucleic acid conservation may correlate with previously uncharacterised lifecycle features. Such approaches have, for example, found packaging signals and previously undescribed proteins in influenza A virus6, showing that this approach could find previously discovered conserved regions of nucleic acid in influenza A virus and group A rotaviruses, and successfully applied this approach to a new analysis of HIV-17. Such an approach is more efficient at finding conserved regions of unexpected length scales, potentially at the cost of being less efficient at finding conserved regions at tuned length scales.We have previously described a scale-agnostic approach to this problem8. In this example it is likely that viruses have explored accessible evolutionary space in the past, reaching a high reproductive fitness niche from which little deviation is observed in recently sequenced samples. In both cases, we need to use all the information available in a low noise, low signal context to discover conserved regions: in the first case, because we wish to develop therapeutics for an emerging disease as early as possible; in the second case, because waiting will not yield substantially more information and so any attempts to develop therapeutics can only use the information already available.All the approaches described so far work in RNA virus genome datasets in which relatively high variability is seen between different sequenced samples. This means that both “signal” (conserved) and “background” (variable) regions are seen to exhibit variability, but the lower variability in signal regions can be detected. However, even amongst RNA virus genome datasets there may be found examples where the overall variability between samples is low and so it is more challenging to distinguish signal from background. There are two important classes of such datasets. The first class contains datasets of truly newly emerged viruses, such as SARS-CoV-2, where the dataset available represents well the evolutionary space the human-tropic virus has explored but variability is still low because limited time means the overall explored region is small. The second class contains datasets of highly adapted viruses, such as the flaviviruses, which have likely co-evolved with more than one host species for timescales around 100 million yearsHere, we present three key ideas, aimed at improving detection of conserved regions in viral genome data that has low variability. We benchmark these ideas where appropriate. We then apply the ideas to the example of SARS-CoV-2. The first key idea, of weighting analysed sequence by the information it yields, is only possible following development of our previous scale-agnostic approach. The second key idea, of ranking loci by variability rather than using a raw variability measure when variability is low, is the natural extension to this scenario of a number of non-parametric tests in basic statistical theory. Whilst it does not rely upon the first idea of weighting, the second idea functions much more robustly in its presence. The third key idea, of attempting to remove interfering signal, functions independently from the first two ideas, but is of particular importance when there is low variability in all observed signals.1. That underlying method starts with an alignment of viral sequences, and for each codon within a gene allocates a score equal to the sum of the Hamming distances at that codon between every possible pairing of sequences in the alignment. To take amino acid conservation into account, that score is then normalised by dividing by the score that would have been given for a set of codons encoding the same amino acids, but with codon usage equal to the overall codon usage of the genome. To evaluate for regions of sequence conservation, this original method simply considered moving averages across a sliding window of contiguous codon loci. We previously improved upon the use of moving averages, by instead taking the normalised distance sums, further normalising them to have mean zero and standard deviation one, and then considering the problem as equivalent to finding the “steepest” descent in a random walk, where “steepest” means the most extreme Z-statistic, and tends towards finding contiguous regions of codons with higher-than-average conservation6.When investigating sequences at the nucleic acid level, a major cause for sequence conservation in coding regions is the need for amino acid conservation. To detect other causes of nucleic acid conservation, any method used must account for amino acid conservation. Our method is based upon such a methodThese previous methods, plus related methods, still all suffer from the implicit assumption that each codon yields the same amount of information on nucleic acid conservation (as opposed to amino acid conservation). This assumption is untrue: for example, where amino acid conservation requires that a single codon be used at a locus , all the conservation can be explained at the amino acid level, and so no extra RNA conservation independently of the amino acid conservation can be distinguished. Varying levels of information on nucleic acid conservation may be obtained from other loci, depending upon the degree of amino acid constraint, the number of codons that generate the amino acid(s) seen, and bias in codon usage. An example of the extent to which the information content of individual loci may vary is given for the SARS-CoV-2 E gene, in Fig. The first of the key methodological improvements that allow us to find regions of nucleic acid conservation is to apply a weighting to each locus, with weights proportional to the information that locus gives us on nucleotide conservation beyond what is required for amino acid conservation  into outliers Fig. A,B. ThesThe solution to this issue of skewness is to move from a parametric test to the appropriate non-parametric equivalent, that is, by using ranked data , the risk of such an approach is that conserved features unique to one virus, or found in different genomic locations between the viruses, may be obscured.After analysing SARS-CoV-2 sequences, we then proceeded to analyse 119 sequences of SARS-CoV, as a cross-check in a related virus to find analogous conserved regions. Analysing SARS-CoV alone represents an extremely challenging scenario in terms of information, because a small number of sequences from human infections were obtained over a short evolutionary time, before the SARS outbreak was terminated. Although SARS-CoV sequences can be aligned and analysed alongside SARS-CoV-2 sequences  lies within a region previously shown to be associated with packaging RNAs into virus-like particles19. Motivated by this, we produced folds of a series of regions with slightly different lengths from our predicted region, as a sensitivity analysis of the predicted structures. Similarly to a previously reported discrepancy for minimum free energy folding of the MHV region20, most of the predictions for a larger region have more than one stem-loop; one stem-loop in the middle of the region remains consistently predicted  close to the region identified demonstrates a set of nine complementary base pairs  with some similarity to the base of the stem-loop previously reported as associated with a packaging signal in Murine Hepatitis Virus (MHV)ted Fig. . We post21. The more recent work17 provides experimental evidence to constrain the key packaging signal to the region containing nucleotides 19,881–20,031. Our fold of our predicted conserved region  also overlaps with a region shown to be associated with viral RNA packagingion Fig.  predictsion Fig. . The res22. Such a possibility would be a plausible alternative explanation for the conservation we find, although the boundaries of the conserved region we find combined with the biological corroboration above seem more consistent with a packaging signal.A larger region containing the conserved region identified in SARS-CoV-2 by our algorithm has been postulated as a negative-sense open reading frame12. These regions that are identified as conserved are therefore correctly placed to function, respectively, as the transcription-regulatory sequences-body (TRS-B) leading to RdRp pausing and switching to the Some of the smaller regions identified by our algorithm with high confidence in SARS-CoV-2 have been identified as forming the 12 recorded 149,744 sgRNAs corresponding to this TRS-B in their experiments). However, it is also likely to be the TRS-L-dependent noncanonical for a non-canonical sgRNA produced with higher efficiency than the E sgRNA . This non-canonical sgRNA would result in a frameshift in the E protein, leading to a truncation. The functions of both sgRNAs may be important.The region we identify within 3b, nucleotides 26,234–26,254, is likely the canonical TRS-B for forming E sgRNA , and an analogous conserved region is identified within SARS-CoV.The region identified second within E, nucleotides 26278–26301, is likely the TRS-B for the non-canonical sgRNA mentioned above. In addition, it is a candidate low-efficiency TRS-B for M sgRNA  and the region containing the corresponding initiation codon, respectively.The two regions we identify within 7b, nucleotides 27,771–27,788 and 27,813–27,830, reflect a low-efficiency TRS-B that appears to yield a truncated form of 7b , and so care must be taken when making inferences about conserved functions of the short sequences identified above. However, the number of sgRNAs observed corresponding to the likely canonical E, non-canonical E, and truncated-7b TRSs noted above give strong corroborative evidence for our observed conservation and for the conservation at the additional truncated-7b initiation site.et al.13. Where there are overlapping alternate open reading frames, the higher conservation in the wobble positions in the frame being analysed can lead to the region being identified as conserved. The previously identified alternate open reading frame terminates The region we identify within M, nucleotides 27,159–27,191, has been identified as an overlapping alternate open reading frame in ribosomal profiling experiments by Finkel 23. As the protocol uses overlapping amplicons of around 400 nucleotides, any conserved region greater than 400 nucleotides long, and many just shorter than this, will contain a primer site, so we only highlight the presence of primer sites fully contained within regions shorter than 250 nucleotides that are identified as conserved. The frequency of such primer-binding sites is high and not all such sites are identified as conserved: furthermore, primers are designed to avoid variable regions, so are more likely to be found in regions that are truly conserved, especially in later versions of the ARTIC protocol. In consequence, where a conserved region is identified as overlapping a primer binding site, this should be viewed as a possible contribution to observed conservation, but not as the only explanation.Our algorithm can identify any conservation seen in a dataset, even when that conservation is artefactual. One of the potential risks in the SARS-CoV-2 dataset is inadvertent identification of binding regions for primers used in common sequencing workflows . We have highlighted in our summary where identified conserved regions overlap with primer binding sites in the commonly-used ARTIC sequencing protocolWe have presented, and demonstrated the application to biological sequences of, a new technique customised towards maximising the signal-to-noise ratio when analysing sequences with low signal and low noise. This technique can complement other techniques to investigate newly-emerged pathogens, as well as pathogens where the amount of information on sequence diversity will remain forever-limited. The application we have demonstrated focusses towards RNA conservation in coding regions; however, by altering the distance and weight measures used, it would be straightforward to amend the technique to apply to non-coding nucleic acid or to amino acid sequences. The packaging signal characterisation seen in SARS-CoV-2 demonstrates how this technique can assist in isolating key lifecycle features in RNA viruses; isolating such features is a precursor to developing drugs targeted against them.6. As a result, in practice the algorithm runs slightly faster when analysing data from more sequences. The main part of the algorithm itself takes a few hours to run on a desktop computer, and the main factor affecting complexity is the nucleotide length of the individual genes analysed. Pre-processing to generate codon frequencies of course takes longer in the case of larger datasets. In the case of very large datasets, such as SARS-CoV-2, careful memory management is required, and data must be stored in a way that minimises floating point errors. Overall, our algorithm has substantial speed and memory advantages over exhaustive tree-based approaches on large datasets, at the expense of removing the ability to investigate evolutionary history. Its main advantage over many approaches designed for use on desktop computers is that it still uses all of a large dataset for the main analysis, rather than attempting to select “representative” sequences to save memory and processor time.Through our demonstration of our technique with both SARS-CoV and SARS-CoV-2, we have shown how our algorithm can work to analyse around a hundred sequences or several million sequences. Because the main input to the algorithm is a list of codon frequencies, the number of sequences involved does not substantially affect the performance of the algorithm. In fact, with more sequences the measure of conservation used varies more between loci. Greater variability means the algorithm can more easily limit which pairs of loci need to be analysed as possible start and end points for conserved regions6 of being scale-agnostic in determining regions of conservation. This increases its ability to find truly unknown features of interest, which may lack analogues in host organisms and therefore have reduced risk of toxicity as drug targets. However, two limitations ensue. The first is that if the length scale of a feature of interest being sought is known, then this algorithm has reduced sensitivity in comparison with algorithms tuned to the length of the feature of interest. Secondly and more importantly, where the difference in conservation between signal and background is relatively small, random variation may lead to the inclusion or exclusion of some codons at the end of a feature of interest. This artefact most likely explains why the conserved features we identify in SARS-CoV are in general longer than those identified in SARS-CoV-2: because of the extremely low variability seen in the SARS-CoV dataset, it is likely that the algorithm has called as conserved some non-critical regions contiguous with regions whose conservation is critical to the virus’s lifecycle. What is surprising, given the low variability even of the SARS-CoV-2 dataset and the extremely low variability of the SARS-CoV dataset, is that our algorithm identifies conserved regions in SARS-CoV at all and that some of them have clear analogues in SARS-CoV-2.Our algorithm retains the advantage of its predecessorIn general, our algorithm most easily finds longer contiguous regions of conservation, because of the statistical properties of the algorithm used. Other methods may therefore be more suitable for investigating point mutations. Our algorithm is particularly unsuited for detecting single amino acid variations that may be associated with fitness changes, as for example seen in SARS-CoV-2 variants, since in addition to being poorly suited for investigating nucleotide point mutations, our algorithm is implemented in a way that investigates nucleotide conservation/variation that cannot be explained by amino acid conservation/variation.Our method retains the limitation seen in classical non-parametric tests that even using the non-parametric ranked test to overcome poor convergence to the central limit, our test statistics can still be far from normally distributed when ranks are tied. In most cases, presence of poor convergence can be diagnosed through inspection of graphical output, so that the method is useful notwithstanding this issue. To increase automation of the workflow and to give a more rigorous indication of whether the assumption of normality is valid, it will be necessary to develop a test for normality appropriate to this scenario. Such a test is likely to be analogous to existing tests for normality, in the same way that the non-parametric version of the analysis we have developed here is analogous to the non-parametric versions of classical statistical tests. The mathematics required to develop a test for normality should also allow formal demonstration of the rate at which the ranked test converges to a central limit.What we have presented is a method for in silico analysis of biological sequences. In common with all such analysis techniques, its primary limitation for biological application is that it does not give the biological explanation for observed conservation, but highlights regions for further investigation. When the biological relevance of an identified region is clear, the technique facilitates further investigation. When the biological relevance is less clear, the technique only gives a very broad guide towards possible ways to proceed.i in the alignment can be represented by a number 1 we consider as loci individual codons in coding regions of viral RNA, and at each locus generate a sum of all Hamming distances between pairs of codons for all possible pairings of sequences in the alignment (“pairwise distance”). This sum is normalised by dividing by the pairwise distance that would be observed if the observed codons were replaced so as to give the same amino acid frequency, but with the codon usage per amino acid matching the average usage across the entire gene or genome . In an earlier version of the method we present here6, that normalised pairwise distance was then taken to be the vertical deviation for that locus in a random walk where each codon was associated with unit horizontal deviation, following a method designed for assigning parentage to recombinant genes24. The overall walk was normalised to give mean vertical deviation of zero and variance of the vertical deviation of one, and an appeal to the Central Limit Theorem made to argue that the steepest descent by Z-statistic should be evaluated for statistical significance.The idea underlying our work is that in an alignment of genetic sequences, the between-sequence diversity seen at a single locus The key idea of this present work is that the earlier random walk paradigm can be refined by moving from the unit of horizontal movement in the random walk being the number of loci, with each locus counting equally, to the unit of horizontal movement being the information gained from each locus. For example, at a locus where the amino acid usage is constrained to be methionine, no further information is gained by considering codon usage, since every sequence is constrained to use the codon AUG. Note that since the observed codon usage exactly matches the expected codon usage, the normalised pairwise distance here is 1. In contrast, at a locus where the amino acid usage is constrained to be glutamine , substantial extra information is conveyed by observing that the codons actually seen match the overall usage in the genome (say e.g. 1:1 ratio of each), despite the normalised pairwise distance being 1 as in the methionine case, since in the presence of strong nucleic acid constraint  a normalised pairwise distance of 0 would be observed, which is not possible in the methionine case. Including the methionine case, where no information is gained, in the random walk unnecessarily dilutes the information it is possible to obtain from analysing the walk. We note that our method does not depend upon the underlying biology explaining the overall codon usage in the genome , just the measured resultant usage.The appropriate way to account for the variability in information gained from each locus is to construct a walk where the horizontal distance moved per locus is equal to the information gained from that locus, and the normalised pairwise distance now defines the gradient of the step, so that the vertical distance moved in the walk is . For each amino acid seen at a locus in an alignment, the calculated probabilities are multiplied together to obtain p.More formally, for each locus in the gene being analysed, we calculate the Shannon information, i) as a weight, which acts as a coefficient of the diversity value n is the total number of loci, and hence the appropriate normalisation factor to obtain a standard deviation of 1 (preserving orientation) isi of the walk, the horizontal displacement is 6, we are now in a position to treat the Next, we use the calculated Shannon information at each locus  this may be particularly problematic, with most loci apparently conserved and walks dominated by a small number of variable loci. Ultimately, in this scenario the statistic risks simply picking out the longest run between observed random variation. The problem is a breakdown of the parametric assumption in the low variability scenario.The weighting technique we have described above is especially important for samples of sequences that do not explore a large portion of evolutionary space, as it improves signal-to-noise ratio in sample sets with low amounts of signal. However, in such samples, the rate of convergence of the test statistic to a normal statistic will still be slow, and for short subsequences .We note that there are two ways analysis can cease immediately following this procedure. The first, straightforward, way is if the originally identified most extreme descent still fails to cross a significance threshold. The second way is if the most extreme descent identified following excision of the second most extreme descent is no longer identical to the original. This can occur if, for example, excision of the second region leads to a new, more extreme region formed by the regions adjacent to the second region. In this case, we work on the basis that if there is a piece of original background that is now more extreme than the putative signal, then this is an indication that the original signal was not significantly different from the background and stop.E. coli sequences to analyse for benchmarking, we searched GenBank using the string ((“Escherichia coli”[Organism] OR escherichia coli[All Fields]) AND rsma[All Fields]) AND “Escherichia coli”[porgn] AND (bacteria[filter] AND (“4500000”[SLEN] : “999999999999999999”[SLEN]) AND (“0001/01/01”[PDAT] : “2021/12/20”[PDAT])). We downloaded sequences in gene-annotated format and then selected (into separate files) sequences corresponding to the housekeeping genes adk, icd, fumC, recA, mdh, gyrB, and purA (i.e. the genes of the Achtman multilocus sequence typing schema9). Sequences that did not begin ATG and end with a termination codon, and sequences containing ambiguous nucleotide characters, were omitted from analysis. A list of accession numbers of sequences used in each gene may be found in Tables To find appropriate Because sequences were highly conserved, it was possible for each gene to undertake manual curation and alignment of sequences. A list of the curation steps undertaken may be found in Table Aligned sequences corresponding to the individual genes were then analysed using the procedure detailed above, for each permutation of normalised pairwise distances being unweighted/weighted by information, using raw/ranked normalised pairwise distances, and including a check for potentially interfering signals. Output may be found in the Supplementary Information Figs. –S18.26.We downloaded sequences from the GISAID database for analysis. Sequences downloaded were all those uploaded up to and including 17th March 2022, with the host set to human and using the “Complete” and “High coverage” options. The rationale for these options is that our analysis aims to understand selection pressures on SARS-CoV-2 in human hosts, and to use our algorithm we ideally need entire genes  to have been sequenced unambiguously. A list of downloaded sequences, with submitter attributions, may be found in GISAID EPI_SET 20220720bs27 with the keeplength and addfragments options (and otherwise default options). Although aligning to a single reference sequence may generate less optimal alignments than a full alignment, and is done in a way that fails to account for nucleotide insertions, a full alignment was not computationally tractable and the level of conservation of the SARS-CoV-2 genomes resulted in a reasonable alignment with minimal information loss.Nucleotide sequences were aligned to the Wuhan-Hu-1 reference sequence  using MAFFTGenes and subgenomic regions for analysis were extracted by nucleotide reference in the alignment, taking into account the Alignments of extracted regions were further curated by removing sequences containing ambiguous nucleotides, by removing sequences without stop codons in the final 30 nucleotide region of genes being analysed, by removing sequences with straightforward frameshifts (a number of gaps that is not a multiple of 3), and by removing sequences with 7.The counts of each codon represented in the alignment at each locus were recorded, and pairwise distances were calculated as described above. For each gene, these pairwise distances were then analysed for significant regions using the procedure detailed above, for each permutation of normalised pairwise distances being unweighted/weighted by information, and using raw/ranked normalised pairwise distances. In each case, a check for potentially interfering signals was undertaken as described above and signals that were significant in the absence of a potentially interfering signal were recorded. Gaps in the alignments were handled as described in our previous workReview of significant regions for biological relevance was undertaken only for the analysis with information weighting and ranked normalised pairwise distances, since these options would be expected to produce the fewest spurious results.16; a reverse complement of the alignment was similarly folded. To avoid exceeding RNAalifold’s memory limit, a single example of each possible sequence was used to reduce the memory required and folding was not attempted with regions of length For each significant region of length cis-acting sequences, plus regions with possibly artefactual conservation resulting from properties of common sequencing protocols.Regions were manually reviewed for out-of-frame coding potential, and for known features of interest including regions known to affect transcription or translation, packaging signals, and other Graphical output from this analysis not included in the main text may be found in Figs. We downloaded sequences from GenBank for analysis. The search term used was (“Severe acute respiratory syndrome coronavirus”[Organism] OR sars-cov[All Fields] OR sars[All Fields]) AND (viruses[filter] AND is_nuccore[filter] AND (“29000”[SLEN] : “30000”[SLEN]) AND (“0001/01/01”[PDAT] : “2018/12/31”[PDAT])). The date range in the search reflects the end of the SARS-CoV outbreak and the higher probability that sequences submitted after the end of 2018 are SARS-CoV sequences that have undergone multiple passages in culture, or that SARS-CoV-2 sequences would be included inadvertently. Output was reviewed manually. Animal-derived sequences, and sequences resulting from cell passage intended to generate genetic diversity, were removed.  A complete list of accession numbers used may be found in Table Genes and subgenomic regions for analysis were extracted by nucleotide reference in the alignment, taking into account the 28 and back-translated to nucleotide sequences.Alignments of extracted regions were further curated by removing sequences containing ambiguous nucleotides, and by removing sequences without stop codons in genes being analysed. Amino acid sequences were aligned using MUSCLECodon counts, pairwise distance calculations, analyses for significant regions and review for biological significance was undertaken as described for SARS-CoV-2 above, save that all sequences (rather than one example of each possible sequence observed) were used to produce RNAalifold output.Graphical output from this analysis not included in the main text may be found in Figs. Supplementary Information.


Sequence alignments are the foundations of life science research, but most innovation so far focuses on optimal alignments, while information derived from suboptimal solutions is ignored. We argue that one optimal alignment per pairwise sequence comparison is a reasonable approximation when dealing with very similar sequences but is insufficient when exploring the biodiversity of the protein universe at tree-of-life scale. To overcome this limitation, we introduce pairwise alignment-safety to uncover the amino acid positions robustly shared across all suboptimal solutions. We implement EMERALD, a software library for alignment-safety inference, and apply it to 400k sequences from the SwissProt database.The online version contains supplementary material available at 10.1186/s13059-023-03008-6. When exploring the diversity of life, we tend to either reduce observations according to similar principles and patterns shared across lineages (comparative method) or aim to deduce the individual mechanistic function with a cause-and-effect-revealing experimental design . In genomics, such attempts translate into comparing genetic sequences according to the similarity of their DNA or protein composition (comparative genomics) or mechanistic analysis of three-dimensional structural conformations of proteins . Recent breakthroughs in protein structure prediction from primary sequence alone , 2 uncovTo compare two biological sequences according to a predefined scoring-scheme, pairwise alignment methodologies have proven useful for various practical applications , 4. Whenalignment-safe intervals), novel insights with greater biological relevance can be unveiled and quantified with particular relevance for protein structure evolution at tree-of-life scale.It seems therefore surprising that the experimental community has grown accustomed to interpret algorithmically derived optimal alignment solutions as biologically most relevant configuration of pairing similar proteins, although theory clearly states that such approximation may only be reasonable when comparing very similar sequences  and not reliable regions, defined in terms of a robustness measure of individual aligned amino acids can identify conserved and functionally relevant regions among two protein sequences. They demonstrate this functional relevance by validating that these conserved regions also correspond to aligned regions of their respective tertiary structures. In detail, Chao KM et al.  where i defines the lower identity boundary and j the upper identity boundary. Figure We represent the sequence identity ranges as intervals of real numbers with notation  and B[y]. If we assign the scores of the substitution matrix as well as the gap score to the corresponding edges as weights, then finding an optimal alignment corresponds to finding a maximum-weight path from s to t (s-tpath) in G. We define such score maximizing paths as optimal. We are then interested in discovering those safe partial alignments that are common to all optimal alignments.In sequence bioinformatics, it is established that such optimal global alignments between gramming . A commoWe can further generalize the notion of safety by also considering a parameter A and B be two strings, and let G be the global alignment DAG connecting A and B. We denote that a path P in G issafe, if P is a subpath of all optimal s-t paths of G;safe, if P is a subpath of at least an s-t paths of G.maximallysafe, if it is not a subpath of a longer We define the set of all maximal safety windows. We will omit Let G that connects A and B, we define G to include all optimal s-t paths in G  and G can be done by taking any in-coming edges of any node  that is part of an optimal path. Due to the bijection property of s-t paths, since these are bijectively linked with the optimal alignments between A and B. We note that s-t path of G are exactly the edges that when removed from bridges of the undirected graph underlying Given the alignment DAG }G0 .s-t paths in v, let d(v) be the number of paths from v to t. We can calculate these numbers with the following recurrence:s-t paths in d(s). Analogously, we can also compute the number s-u paths for any s-t paths of e is part of. We can also understand p(e) as the probability of e appearing in an arbitrary s-t path of s-t paths that P is part of is given byHere, we propose a refined approach to compute P is Thus, s-t path s-t path in A and B, and thus all safety windows can be reported as intervals of this alignment.The following lemma shows that if A and B be two strings based on an amino acid alphabet s-t path G.Let e let v, where v.As defined above, for an edge s-t path exists. Since by definition of s. Finally, since each pair of We assume the opposite, meaning that there are two Next, we give an approach on how to find such a path Let T be a topological order of all nodes in V and let A be sorted topologically by the tails of the edges. Assume we have a path from s to an edge x contained in I and visit every node at most once. If A is left, we just connect the path to t.Let p(e) for all R (right pointer), and we use a second left pointer L with L as small as possible, to maintain the safety-windows left maximal, while moving L up until the interval  of In  overall can be calculated in linear time , then the number of paths will be equal to the exponentially growing Delannoy numbers  for string T. In other words, the tuple indices of the nodes are between the string characters. This coincides with the fact that the node set is the product We designed EMERALD to efficiently implement our theoretical methodology to explore the suboptimal alignment space by inferring alignment-safe intervals when performing pairwise protein sequence comparisons. In detail, EMERALD accepts a protein sequence cluster in FASTA format of mentclass2pt{minimAdditional file 1: Figure S1. Safety coverage restricted on each structural type as assigned by STRIDE  / ).Additional file 2: Figure S2. Stable structure retention compared to safety coverage for various EMERALD parameter configurations and several identity ranges.Additional file 3: Figure S3. Stable structure retention compared to safety coverage for α = 0.75, Δ = 0,2,4,6,8,10,15 and several identity ranges.Additional file 4: Figure S4. Stable structure retention compared to safety coverage for α = 0.51, Δ = 0,2,4,6,8,10,15 and several identity ranges.Additional file 5: Table S1. Summary statistics of pairwise sequence assessments in regard to their parameter-specific safety-window length construction.Additional file 6: Figure S5. Stable structure overlap for each pair of α = 0.51, 0.75, 1 and Δ = 0, 2, 4, 6, 8, 10, 15 on the full dataset covering all 396k SwissProt sequences.Additional file 7: Figure S6. F1-score for α = 0.75, Δ = 8, for sequences in clusters of varying identity ranges.Additional file 8: Figure S7. Direct comparison of sequence logos between multiple sequence alignments (MSAs) and one-vs-all (cluster members against cluster representative) EMERALD alignments derived from one DIAMOND DeepClust clusters with various identity ranges .Additional file 9: Algorithm 1. Pseudocode denoting the algorithmic procedure underlying EMERALD for inferring alignment-safety windows from pairwise protein sequence alignments.Additional file 10. Review history.


As the carrier of genetic information, RNA carries the information from genes to proteins. Transcriptome sequencing technology is an important way to obtain transcriptome sequences, and it is also the basis for transcriptome research. With the development of third-generation sequencing, long reads can cover full-length transcripts and reflect the composition of different isoforms. However, the high error rate of third-generation sequencing affects the accuracy of long reads and downstream analysis. The current error correction methods seldom consider the existence of different isoforms in RNA, which makes the diversity of isoforms a serious loss. Here, we introduce LCAT , a wrapper algorithm of MECAT, to reduce the loss of isoform diversity while keeping MECAT’s error correction performance. The experimental results show that LCAT can not only improve the quality of transcriptome sequencing long reads but also retain the diversity of isoforms. Ribonucleic acid (RNA) is responsible for transferring genetic information from DNA to proteins. The genetic information contained in RNA plays an important role in the encoding, decoding, expression, and regulation of many biological functions. Unlike the double-stranded form of DNA, RNA is usually present in cells and some viruses in a single-stranded form as a carrier of genetic information. RNA splicing occurs during the conversion of pre-RNA to mRNA. RNA can combine exons in various ways through alternative splicing events at different developmental stages or in different tissues of the same organism. Transcripts formed by alternative splicing are called isoforms. Alternative splicing widely exists in non-prokaryotes. It has been shown that alternative splicing is present in more than 95% of multiple exon genes in the human genome . AlternaIn recent years, third-generation sequencing technologies represented by PacBio  and NanoAt present, there have been many studies that perform isoform annotation based on full-length transcripts obtained by third-generation sequencing. For example, Error correction of third-generation sequencing reads is fundamental for improving the quality of transcriptome. At present, there are three categories of methods for long-read error correction, namely, biological error correction, hybrid error correction, and self-error correction. Circular consensus sequencing (CCS) is a biological error correction technology that can reduce the error rate of PacBio reads . In 2019k-mers during the alignment to reduce the effect of repeating regions, and uses FALCON-sense to find consensus sequences. This method simply neglects the high repetition of the k-mers, which may lead to the loss of correct overlapping information and reduce the accuracy of alignment. Due to the repetitive feature of the gene, the number of matched k-mers does not correspond to the length of the overlap and thus cannot be used directly as selection criteria for higher quality, more reliable matches. Local alignment is still required to screen many candidate matches, which also significantly increases the computational cost of error correction for the third generation of reads.Although the existing self-error correction methods are all designed for DNA sequencing data, these tools can also achieve error correction effects on RNA sequencing data. For example, FALCON , Canu K, and MECk-mer, which employs a term frequency–inverse document frequency (tf–idf)   algorithk-mers in two steps. The score of the matched k-mer is determined by DDF, which can represent the matching and distance relationship between k-mers, thereby determining the alignment score between reads. After filtering through the DDF score, the candidate reads are reduced by 50%–70%, of which the quality is high. MECAT combines FALCON-sense and DAGCon in the consensus phase. For simple areas, MECAT uses a list voting method to find consensus while using a construct graph method to find paths with the largest weight as the consensus sequence for complex areas. Compared with other error correction methods, DDF scores filtering, and alignment is 2–3 times faster. Therefore, MECAT is also the fastest error correction tool available.MECAT finds well-matched reads and best-matched base positions through local alignment and uses a pseudo-linear alignment scoring algorithm to filter out excessive alignment sequences, which uses a distance difference factor (DDF) to score matching FLAS  is a selSome studies have applied DNA self-correction methods to RNA sequencing reads, and the following conclusions were obtained : first, LCAT is designed to preserve the structural characteristics of transcriptome isoforms based on MECAT. Reads aligned using MECAT assumes the same form of composition, but transcripts under the same gene can be composed in multiple ways. LCAT adopts the sliding window strategy to filter the read areas with low similarity after the alignment step to ensure that the areas aligned in the consensus stage come from the same exons. LCAT consists of the following steps: read alignment, base alignment, sliding window strategy, determining base alignment type, read partitioning, and consensus. The flow chart of LCAT is shown in '-' to cross the base, which is called the insertion or deletion error. Next, LCAT normalizes the results of the base alignment by splitting the mismatch errors into insertion errors and deletion errors. In this way, an accurate alignment result between the template read and each candidate read can be obtained. ‘A' stands for the base, and “tstr” and “qstr” stand for the results of the base alignment of the template and candidate reads, respectively.After the template read is obtained and the candidate reads have been mapped to the template read, LCAT will traverse template read and candidate reads from the starting base. If the current traversed bases are the same, the two bases at this point are aligned. If the current position of the candidate read is different from the template read and the sequence of the next position is the same, a mismatch error occurs at that base. Otherwise, LCAT uses qstr” of the candidate reads is first copied to a new sequence “newqstr.” Each position of the template reads is traversed, as well as the candidate reads in the alignment result, and the identity of the current position is calculated. The formula for calculating the identity is shown in match_base_num” represents the number of matched bases in the sliding window and “window_length” indicates the length of the sliding window. When the identity is less than the identity threshold, this position in ‘newqstr’ is replaced with the character “N,” which is a potential anomaly. In the LCAT tool, the user can manually set the length of the sliding window and identity threshold. In the sliding window strategy step, the alignment sequence “tstr” and one of its candidate read “qstr.” According to the alignment, the current match type at each position, whether the four numbers  need to be increased, and the base of this position are determined.During the process of constructing the consensus table, LCAT adds new statistics to the number of skips and improves the construction process of the consensus table. According to the base alignment result between each candidate read and the template read, a sequence consensus table of each template read is obtained. normal” consensus table construction process is performed based on the template read “tstr” and the candidate read “qstr” to obtain a consensus table. According to the template read “tstr” and the new candidate read “newqstr” processed by the sliding window strategy, the construction process of the “modify” consensus table is determined, and the consensus table “new_table” is obtained.match” represents the number of matched bases, “insert” represents the number of inserted bases, “skip” indicates the number of skipped bases, and “min_coverage” indicates the minimum coverage. Unlike the boundary filtering condition of MECAT, LCAT increases the statistics of the skip number and regards the sum of insertion, match, and skip numbers at a position as the coverage number of that position. Only when the number of base coverage is not less than the minimum coverage, consensus error correction can be taken for this base. The results of determining the left and right boundaries are shown in After traversing all candidate reads to obtain complete consensus tables of template reads, LCAT calculates the left and right boundaries of each template read. LCAT obtains the left and right boundaries by filtering the area where the coverage of the position is lower than the minimum coverage threshold. The filtering condition is shown in N” to be replaced in the sliding window strategy should be retained. LCAT judges whether the regions with a non-zero amount of skip in the consensus table are regions with different structures. Here, LCAT uses the coverage to determine whether to retain “N.” If the number of skips at this position is greater than the total coverage * scov, then this position is a region where the structure appears different, i.e., the alignment regions are different exons. For such areas, LCAT uses “new_table” generated by “newqstr” in the step of constructing the consensus table to determine the base alignment type of this position, as shown in Case 1 in table” generated by “qstr” in the step of constructing the consensus table to determine the base alignment type of this position, as shown in Case 2 in scov is a coefficient used to judge whether different structures appear in the area, and the user can set it in LCAT. Then, LCAT determines the base alignment type of each position.When determining the base alignment type at each position of the template read, LCAT first judges whether the character “M” represents that different regions of the structure appear, while “N” represents that no different regions of the structure appear. The specific judgment conditions are shown in scov takes the default value of 0.1.There are four types of base alignment: match (MAT), insert (INS), delete (DEL), and undefined (UNDEFINE). In the match-type prefix, “After obtaining the base alignment type of the template read, LCAT divides the read into the simple and complex areas according to the distribution of the alignment type. The simple area is the area in which the alignment type is MAT. If the alignment type is DEL between the two MAT types, this interval is also a simple area. If there is a non-MAT and non-DEL types between the two MAT types, the interval is a complex area. The read area classification process is shown in LCAT uses FALCON-sense algorithm to get consensus for simple area reads. The position of the alignment-type MAT is still the base of the position after error correction. If the position with the alignment-type DEL is in a non-complex area, LCAT will delete the base of this position, as shown in N” appears in the base alignment sequence. If it appears, there are different exon structures in the region. LCAT deletes the edge containing “N” and calculates consensus based on the constructing graph. On the contrary, if the character “N” does not appear in the base alignment sequence, LCAT uses the graph method to get consensus directly.When correcting errors in a complex area, LCAT first judges whether the area is a structural change area. The judgment is based on whether the character “LCAT adopts DAGCon to get consensus, as shown in LCAT combines the consensus results of the simple and complex areas to obtain the final error correction result of the template read.https://github.com/Xingyu-Liao/LCAT.LCAT software is implemented in C++ for the Linux platform. The input of LCAT is the initial long reads, and the output is the error correction results. LCAT is freely accessible at Mouse, Zebra finch, Calypte anna, and Human. In addition, we compared and analyzed the performance of LCAT and MECAT from two perspectives: basic read properties and transcriptome properties.To evaluate the error correction performance of LCAT on third-generation sequencing reads of the transcriptome, we ran LCAT and MECAT on four datasets of long reads from species: Mouse, Zebra finch, Calypte anna, and Human were used in our experiments. The mouse and human data are sequenced by Nanopore technology, while zebra finch and Calypte anna are sequenced by PacBio technology. Datasets can be downloaded from the NCBI SRA database (https://www.ncbi.nlm.nih.gov/sra/), GitHub (https://github.com/nanopore-wgs-consortium/NA12878/blob/master), and PacBio sequencing platform. https://www.ncbi.nlm.nih.gov/) and Ensembl websites (ftp://ftp.ensembl.org/pub/). The version number of genomes and the annotation files are shown in The long reads of We aligned the corrected long reads and raw reads to the corresponding reference genomes to assess their quality. The aligner Minimap2 was used for these alignments because it is a typical aligner for transcriptome sequences with fast speed and relatively high sensitivity.#read is the number of corrected reads, and %read is the number of reads over the total number of raw long reads. #base is the number of corrected bases, and %bases is the number of bases over the total number of raw long bases; 2) max size is the maximum read size, min size is the minimum read size, and the mean size is the average size of reads; 3) #umr is the number of unmapped reads, and %umr is the number of unmapped reads over the total number of outputted reads. #umb is the number of unmapped bases, and %umb is the number of unmapped bases over the total number of outputted bases; 4) error rate is the number of non-matches bases over the number of corrected bases, and mismatch rate, delete rate, and insert rate are the number of mismatch bases, delete bases, and insert bases over the total number of outputted bases, respectively.We made a comparative analysis from two perspectives of basic read properties and transcriptome properties using the LR_EC_analyser . Basic rTranscriptome properties include the following measurements: 1) we measured the number of genes with reduced, unchanged, and increased number of isoforms to assess the ability of the correction tool to retain isoforms. There are multiple isoforms under the same gene. The smaller the number of genes whose isoform type decreases, the greater the number of genes that remain unchanged and increase after error correction, indicating that the error correction tool has a strong ability to retain isoforms; 2) we counted the loss of transcripts with different relative coverages in the raw reads after error correction to reflect the ability of the error correction tool to retain the isoforms and explained that the error correction tool is biased toward transcripts of different expression levels. A detailed instruction for using the LCAT, as well as the tools, and corresponding commands used during the evaluation is found in The throughput information after correcting four species is listed in relative_coverage” represents the value of relative coverage, “isform_num” represents the number of isoforms, and “transcript_num” indicates the number of transcripts. The low relative coverage rate indicates that the expression level of the transcript in the gene is low and vice versa. We used evaluation tools such as AlignQC  and LR_EThis study introduces LCAT, a wrapper long-read error correction algorithm for transcriptome sequencing data, to reduce the loss of isoform diversity while keeping MECAT’s error correction performance. LCAT uses the sliding window strategy to filter low identity rate regions with a certain coverage in the alignment step. According to the different categories of the candidate-read areas, the consensus reads are obtained. As a result, LCAT not only improves the quality of reads but also retains the diversity of isoforms, which is more suitable for the error correction of RNA sequencing data. In the future, we will expand this work in the following two directions: 1) the sliding window strategy is combined with other self-correcting algorithms to improve the throughput and accuracy of reads after error correction; 2) the error correction and assembly algorithms are combined to increase the read length and construct more full-length transcripts.


Tertiary structure alignment is one of the main challenges in the computer-aided comparative study of molecular structures. Its aim is to optimally overlay the 3D shapes of two or more molecules in space to find the correspondence between their nucleotides. Alignment is the starting point for most algorithms that assess structural similarity or find common substructures. Thus, it has applications in solving a variety of bioinformatics problems, e.g. in the search for structural patterns, structure clustering, identifying structural redundancy, and evaluating the prediction accuracy of 3D models. To date, several tools have been developed to align 3D structures of RNA. However, most of them are not applicable to arbitrarily large structures and do not allow users to parameterize the optimization algorithm.We present two customizable heuristics for flexible alignment of 3D RNA structures, geometric search (GEOS), and genetic algorithm (GENS). They work in sequence-dependent/independent mode and find the suboptimal alignment of expected quality (below a predefined RMSD threshold). We compare their performance with those of state-of-the-art methods for aligning RNA structures. We show the results of quantitative and qualitative tests run for all of these algorithms on benchmark sets of RNA structures.https://github.com/RNApolis/rnahugs.Source codes for both heuristics are hosted at  Comparing the 3D structures of RNA molecules is one of the important problems in computational biology and bioinformatics. Comparative analysis of polymer folds is based primarily on structural alignment, and followed by hunting for similarities between data objects given as clouds of atoms. It applies to establish homology between molecules following their 3D conformations , discoveTo date, several algorithms have challenged the problem of aligning 3D RNA structures. They include ARTS , SARA C, LaJollaIn this work, we introduce geometric search (GEOS) and genetic algorithm (GENS), two novel algorithms to solve the flexible alignment problem of 3D RNA structures. GEOS is a dedicated geometry-oriented heuristics; GENS applies a genetic search approach. Both algorithms work in two modes, sequence-dependent and sequence-independent. They are complementary in applications. GENS performs better for similar structures and, therefore, is more useful in the alignment of distant homologs or various models of the same structure. GEOS is better for structures that differ significantly, so we recommend it for the problem of finding maximal common substructures. GEOS returns one solution; GENS can find multiple alignments of similar quality if they exist. Both allow users to define the maximum RMSD of the alignment to be found. The effectiveness of GEOS and GENS was confirmed in tests on a set of more than 1000 RNA structures. In this article, we show the results of these computational experiments and compare our algorithms with other available methods that address the problem of aligning RNA tertiary structures.M denote the 3D RNA model to align with the target structure T with an RMSD that does not exceed the threshold value U. Both GEOS and GENS operate on a coarse-grained representation of the tertiary structure of RNA. Therefore, their first step is data preprocessing, which involves the transformation of M and T from a full atom to a 3-bead coarse-grained model. In the latter case, each nucleotide is represented by three pseudoatoms: one for the phosphate group, one for the ribose group, and one for the nitrogenous base. The spatial coordinates of the pseudoatom determine the geometric center in the set of corresponding atoms.Let U. If more alignments of the same length satisfy the threshold, the one with the lowest actual RMSD is returned.Both methods return the longest alignment found within the given RMSD threshold U = 3.5 Å but users can select a different value between 0 and 20Å and specify it as input parameter. The default value has been chosen based on the experiences of CASP and RNA-Puzzles where structures with RMSDThe Geometric Search algorithm follows a three-step procedure. In the first step, it finds promising alignment kernels; next, it expands kernel-based alignments and compares them to select the best cf. . The bes similar .Identification of kernels: Kernel K should be made up of three pairs of well-aligned nucleotides, K=K) T and its partner to the model M; T. Then, any two nucleotides, M and optimally aligned with M, it discards the third target nucleotide from the kernel, takes the other random T, and starts drawing its partner from the model again. Following this scheme, GEOS creates many independent kernels, A single kernel is searched as follows. Two nucleotides, Building kernel-based alignments: The search for alignment proceeds independently for each kernel found in the previous step. Kernel T and the model M. The procedure is as follows. The M aims to minimize RMSD only between the nucleotides that make up the kernel. Next, Li). As long as rmsd(Li)Genetic algorithms (GA) are randomized optimization techniques guided by the principles of evolution, with the ability to implicitly parallelize . They opChromosome: An individual is represented as a vector V of length n, where n is the number of nucleotides in the target structure T. If the j-th nucleotide of model M has been aligned with the i-th nucleotide of T, then V[i] = j; otherwise V[i] = 0.Initial population: The population consists of k = 1.c. Next, each vector is randomly filled with the indices of the unassigned nucleotides of M . The continuity of the chain is preserved; adjacent indexes—except those of unaligned nucleotides—form a unique and monotonic sequence of consecutive numbers; in this sense, the vector Fitness function: When evaluating individuals , the fitness function takes into account three criteria that describe the quality and length of the alignment. The algorithm seeks to minimize the root mean square deviation, maximize the number of aligned nucleotides, and minimize the number of incorrectly aligned nucleotides.Selection: Fifteen percent of the fittest individuals in the current population are selected as the most promising seed for a new generation. They are subject to mutations (with probability P = .74), crossovers (with P = .25), and random seeding (with P = .01) to populate the new generation.Crossover: Crossover is a probabilistic process that generates offspring chromosomes by exchanging information between parents. Two random individuals, x, y; Mutation: Randomly selected individuals are subjected to single-point mutations (with 65% chance), double-point mutations (with 15% chance), triple-point or quadruple-point mutations (both with 10% chance). The following mutation types can be applied (with the same probability): (i) unassign previously assigned nucleotide of T; (ii) assign any available nucleotide of M to the unassigned nucleotide of T; (iii) assign any available nucleotide of M to the already assigned nucleotide of T; and (iv) swap assignments between two randomly selected nucleotides of T. Simple diagrams showing four mutation variants are presented in s); (iii) GENS only: the best current alignment has not been improved or refined for at least Both algorithms stop if one of the following criteria is satisfied: (i) all target residues have been aligned with a given RMSD threshold; (ii) processing time has reached the upper bound The size of the time buffer https://github.com/RNApolis/rnahugs). GEOS and GENS are single command-line applications. They are run with input data; the mandatory ones are two files in PDB/mmCIF format with 3D RNA structures to be aligned. Both algorithms were implemented in Java using the Maven package and tested with Java 11 and Maven 3.6.3.GEOS and GENS are multi-threaded algorithms. By default, they compute by making use of all available CPU cores. The number of cores involved can be limited by the user, who can set the appropriate parameter value in the configuration file. The performance of both algorithms depends on a number of parameters. Some of them are input parameters; the others can be set via the configuration file. All parameters are described in the readme file available on GitHub , we ran standalone apps in the sequence-independent mode for a benchmark set from RNA-Puzzles. In the second set of experiments (Section 3.2), we applied all the methods for selected 3D structures in sequence-dependent and sequence-independent modes. In the above experiments, we looked at the length of the alignments, their quality, the variety of solutions, and the ability of the algorithms to process structures of various sizes. Finally, we conducted experiments focusing exclusively on GEOS and GENS. We computed their execution times depending on the instance size and checked the repeatability of the results of both heuristics (Section 3.3).S (https://github.com/RNA-Puzzles/standardized_dataset) available within the RNA-Puzzles resources  to align it with the crystal structure of the target T (84 nts). We ran RMalign—the best according to quantitative analysis  and three models predicted per each targeted sequence . We searched for alignment for each model-target pair with the default RMSD threshold (3.5 Å). Each heuristic participated in 18 experiments—9 sequence-dependent alignments and 9 sequence-independent ones. Each experiment was repeated 125 times. We compared the results from all 125 runs for a given instance to compute the minimum and maximum lengths of alignment, the average, and the standard deviation. These results are presented in in silico. Separately, we analyzed the execution times of GEOS and GENS as a function of the instance size. First, we computed the times for all instances in the set of RNA-Puzzles containing 22 target structures and 1006 RNA 3D models predicted In this article, we address the flexible alignment of 3D RNA structures. The problem is computationally hard, as demonstrated for its protein version . This meWe introduced two heuristics, that applied concurrency processing, to flexibly align 3D RNA structures, geometric search (GEOS), and genetic search (GENS). We compared them with existing methods that addressed the same problem. To ensure fairness of the comparison, we applied the actual RMSDs of the solutions obtained from competitive methods to constrain our algorithms and ranked all alignments according to their lengths. High-throughput tests on the RNA-Puzzles benchmark set showed that GEOS and GENS outperformed other methods on this criterion.GEOS and GENS are available in the GitHub repository of the RNApolis group , ready tbtad315_Supplementary_DataClick here for additional data file.


Advances in genomics and sequencing technologies demand faster and more scalable analysis methods that can process longer sequences with higher accuracy. However, classical pairwise alignment methods, based on dynamic programming (DP), impose impractical computational requirements to align long and noisy sequences like those produced by PacBio and Nanopore technologies. The recently proposed wavefront alignment (WFA) algorithm paves the way for more efficient alignment tools, improving time and memory complexity over previous methods. However, high-performance computing (HPC) platforms require efficient parallel algorithms and tools to exploit the computing resources available on modern accelerator-based architectures.This paper presents WFA-GPU, a GPU (graphics processing unit)-accelerated tool to compute exact gap-affine alignments based on the WFA algorithm. We present the algorithmic adaptations and performance optimizations that allow exploiting the massively parallel capabilities of modern GPU devices to accelerate the alignment computations. In particular, we propose a CPU–GPU co-design capable of performing inter-sequence and intra-sequence parallel sequence alignment, combining a succinct WFA-data representation with an efficient GPU implementation. As a result, we demonstrate that our implementation outperforms the original multi-threaded WFA implementation by up to 4.3× and up to 18.2× when using heuristic methods on long and noisy sequences. Compared to other state-of-the-art tools and libraries, the WFA-GPU is up to 29× faster than other GPU implementations and up to four orders of magnitude faster than other CPU implementations. Furthermore, WFA-GPU is the only GPU solution capable of correctly aligning long reads using a commodity GPU.https://github.com/quim0/WFA-GPU.WFA-GPU code and documentation are publicly available at  The WFA algorithm takes advantage of homologous regions between sequences to accelerate the alignment process. As a result, the WFA algorithm largely outperforms other state-of-the-art methods, requiring n is the length of the sequence and s is the optimal alignment score).Recently, the wavefront alignment (WFA) algorithm . Also, let x is the mismatch cost and the gap cost is expressed as the linear function l is the length of the gap).Let the query s reaches coordinate s and retrieve the optimal alignment by tracing back the alignment operations  is the length of the longest common prefix between two strings v and w]. Note that the wavefront component Let s, it first increases each wavefront offset k (i.e. computing k). Then, the algorithm computes the next wavefronts with score s and the alignment operations can be retrieved by tracing back the wavefronts that originated the farthest reaching point Starting with s wavefronts of increasing length . Each SM can host over a thousand concurrent threads, and each clock cycle, using aggressive fine-grained multithreading techniques, can start executing hundreds of instructions on multiple SIMD cores. A CPU–GPU co-design involves determining a computationally intensive function or region of a program (i.e. computation kernel) to be offloaded to the GPU. To exploit GPU parallel computing capabilities, applications must launch tens of thousands of threads, grouped in thread blocks, across all available SMs. Threads within a block can cooperate  to solve a given computational kernel. To maximize performance, GPUs rely on exploiting high degrees of parallelism, much higher than those of regular CPU multi-cores.Each SM has fast on-chip memories with a relatively small capacity. They are distributed among compiler-managed register memory (up to 256 KB), processor-managed L1 cache, and programmer-managed shared memory . The SMs get their data from an off-chip RAM memory of several GBs capable of delivering bandwidths of over 600 GB/s. An L2 cache holds several MBs of the RAM memory contents and offers 3–5 times higher bandwidth.The peak computational throughput of GPUs is much higher than its peak memory bandwidth. Therefore, doing very few memory accesses per arithmetic operation is paramount to achieving good GPU utilization. The use of fast on-chip memories  can alleviate this problem. Still, there is a critical compromise between the number of concurrent threads hosted by each SM and the amount of data each thread can store in fast memories. Allocating too many threads per SM results in more threads competing for the relatively small fast memories, increasing the number of data accesses to slow memory, and performance may suffer. Reducing the number of threads per SM can improve memory performance, but at the price of reducing parallelism and the ability to hide long execution and memory latencies, potentially decreasing performance.In this section, we present the parallel WFA-GPU algorithm, the main performance challenges, and effective solutions to mitigate these problems. This way, Section 2.3.1 presents an overview of the parallel algorithm and its mapping to the GPU computing architecture. Afterwards, we discuss the principal performance limitations of its implementation on GPU.First, we show that the memory requirements grow quadratically as the alignment error increases, limiting the scalability of the implementation when aligning tens of thousands of sequences in parallel. To alleviate this problem, in Sections 2.3.2 and 2.3.3, we present an efficient GPU memory management strategy and an algorithmic technique to reduce the overall memory used by the WFA on GPU.LCP computation and, in Section 2.3.5, we propose a GPU-aware heuristic extension to reduce the volume of computations performed on the GPU.Second, we argue that the number of operations to compute successive wavefronts becomes a limiting factor when aligning large and noisy sequences. In Section 2.3.4, we present a strategy to accelerate the Finally, in Section 2.3.6, we present a CPU–GPU co-design, which allows overlapping the execution of GPU kernels, CPU tasks, and data transfers (between the memories of the two devices) to improve the overall performance of the implementation.Algorithm 1. WFA-GPU parallel algorithm.Some parallel solutions to the sequence alignment problem are based on exploiting inter-sequence parallelism . However, as parallelism increases, aligning a large number of sequences simultaneously requires unfeasible amounts of memory. Moreover, differences in the workload  cause variations in the execution flow of each alignment, generating thread divergence. Alternatively, it is feasible to exploit parallelism within a single alignment task . However, a single alignment rarely allows exploiting the massive amounts of parallel resources available on modern GPUs. Our proposal is to combine both parallel strategies  to compute multiple alignments on concurrent thread blocks, each using several threads cooperatively to calculate a single alignment.s using multiple GPU threads, exploiting intra-sequence parallelism . At the same time, other alignments can be computed by different thread blocks on the GPU using inter-sequence parallelism .The WFA algorithm depicts a simple computational pattern to calculate each sequence alignment. s and diagonal k, each GPU thread in the block computes LCP function. Notably, as the algorithm progresses, wavefronts become increasingly larger and the potential parallelism of the problem grows. For large and noisy sequences, the problem becomes embarrassingly parallel, allowing to perform up to Each GPU thread concurrently undertakes the computation of the data item of a different diagonal offset, applying A simple and naive implementation would spawn a thread block per each WFA alignment offloaded to the GPU. However, each WFA alignment kernel requires GPU memory to store all the intermediate wavefronts. It is not feasible to reserve GPU memory for every alignment in advance when processing tens of thousands of sequence alignments. However, it is possible to request an upper-bound of the total WFA memory required for a number of alignments that can be processed in parallel in the GPU at the same time.Thus, our implementation creates a pool of outstanding WFA aligners and allocates memory for as many alignment blocks as can be processed simultaneously on the GPU. Then, an alignment scheduler assigns WFA alignments to thread blocks. Whenever a thread block finishes an alignment, it requests another from the alignment pool until all alignments offloaded to the GPU have been completed. We guarantee the correct synchronization of the different aligners by using atomic operations and a global counter.Nevertheless, having to allocate GPU memory beforehand forces to estimate the maximum memory required by each WFA alignment in advance. For that, our method establishes a configurable upper-bound on the required memory based on a conservative estimation of the maximum error rate (i.e. 10% of sequence length by default on our example tool). Nonetheless, some alignments may over-ride initial estimations and require more memory. For those cases, the WFA-GPU implements a rescue mechanism that returns the alignment to the CPU to be computed using the original WFA algorithm. In practice, when aligning long and noisy sequences (like those produced by PacBio or Nanopore Technologies), the amount of rescued alignments is below 0.2%. Furthermore, the computation of the rescued alignments can be performed in the host CPU; meanwhile, the GPU is computing other alignments, as described in Section 2.3.6.Although modern GPUs are equipped with large DRAM memories, accesses to global memory are relatively slow and can potentially reduce the performance of GPU applications. To take advantage of fast on-chip memories and minimize the latency of global memory accesses in the GPU, our implementation allocates the most frequently accessed wavefront diagonals  of wavefronts in the shared memory. This way, the WFA-GPU benefits from fast on-chip memory access to the elements of the central diagonals.s, the WFA algorithm requires storing all the intermediate wavefronts up to For an alignment with optimal score X, I, and D) to the wavefronts as they are being computed. Using only two bits, each backtrace operation is encoded in a bitmap stored for every diagonal of the wavefront. Therefore, for a given score s and diagonal k, our method stores a bitmap with the alignment operations required to reach To reduce the memory consumption, our method piggybacks the backtrace operations . Once a BT-block of a diagonal is full and cannot encode more backtrace operations ❶ on , it is oX, I, and D) is piggybacked to each source wavefront offset  and not the matches in between. To retrieve the complete alignment CIGAR, the algorithm needs to compute any missing matches between backtrace operations. Nonetheless, this is a remarkably simple operation. Using the same LCP function presented earlier, the algorithm computes matches until a mismatch is found. Then, it adds the following backtrace operation and proceeds again to compute the LCP. This process halts when all the backtrace operations from the chain of BT-blocks have been processed.Note that BT-blocks only contain edit operations . Compared to storing the raw wavefront offsets as the original WFA does (i.e. 4 bytes per entry), this strategy represents an 8× reduction.LCP function  forces idle threads to wait until all threads have finished iterating.WFA’s execution time is dominated by the computation of the function . A naive001, C = 1000011, G = 1000111, T = 1010100). This process is also well suited for GPU execution, as each character can be computed in parallel. Sequence packing is done at runtime, just before the WFA-GPU alignment kernel starts. Using a bit-packed representation, our implementation compares blocks of 16 bases at once using 32-bit operations. This strategy reduces execution divergence and, most importantly, the total number of instructions executed, which translates into faster execution times.To alleviate this problem, we propose a bit-packed encoding of DNA sequences using 2 bits per base. The encoding turns out to be remarkably simple, as the ASCII representation of each base has two unique bits on position 1 and 2  and CudaAligner (https://github.com/clara-parabricks/GenomeWorks) from Clara Parabricks Genomeworks]. Unfortunately, we were unable to include the GPU aligners Logan (https://github.com/smarco/WFA2-lib), commit 931181d] in the comparison. Note that Edlib and CudaAligner can only compute the edit-distance alignment . Regardless, we include them in the comparison as an interesting point of reference. In an attempt to evaluate the recall of these tools using gap-affine scores, we re-scored the reported CIGAR using gap-affine penalties and compared it with the optimal score. ADEPT computes the local alignment of two sequences, as we compute global alignment, ADEPT cannot be compared with WFA-GPU in terms of accuracy. The tables indicate this as ‘not-comparable’ (n/c).To compare the performance of the WFA-GPU, we select other sequence alignment libraries and tools representative of the state-of-the-art on both CPU and GPU devices. For the GPU tools comparison, we select the library GASAL2  processor equipped with 126 GB of memory and an NVIDIA GeForce 3080 with 10 GB of memory. Moreover, all CPU executions are performed in parallel using the 10 physical cores available in the platform. All GPU execution times include CPU–GPU data transfer, alignment, backtrace, and CIGAR generation time.Considering the alignment of short sequences (i.e. ∼150 bps), NVBio outperforms all other tools at the expense of a significant loss in alignment accuracy as the alignment error increases. WFA-GPU is between 1.2 and 2.9 times faster than the best CPU time obtained. GASAL2 shows good performance . Because dynamic-programming approaches are error-independent, GASAL2 outperforms our implementation when the error is high. The other GPU aligners, ADEPT and CudaAligner, are one order of magnitude slower than WFA-GPU and GASAL2. For these short-sequence datasets, using the WFA-GPU approximated alignment does not provide any significant benefit because the error is very small.For medium-length sequences (∼1 Kbps), GPU implementations either fail due to execution errors (like NVBio and ADEPT) or obtain a recall below 10%. Only GASAL2 remains competitive when the error increases but at a significantly low accuracy (52.4%). Compared to CPU implementations, WFA-GPU executes 2.5–3.3× faster than the original WFA and up to 5500× faster than other libraries. Using WFA-GPU approximated alignment, we obtain an additional speedup of up to 3× when computing the optimal alignment path (backtrace).Experiments aligning long simulated sequences (i.e. ∼10 Kbps) turn out to be the most challenging for most GPU tools. All other GPU implementations either fail (i.e. ADEPT and NVBio), give incorrect results (i.e. CudaAligner), or have significantly low recall (i.e. GASAL2 with less than 50% accuracy). WFA-GPU is the only GPU implementation that can scale to long sequences reporting the optimal alignment result. When compared to the original WFA, WFA-GPU executes 3.1–3.8× faster. Using the approximate WFA-GPU alignment, the speed increase is even greater, at 14.2–61.9×, while maintaining 100% accuracy.When executing WFA-GPU without calculating the alignment path , the process is 1.8–4.7× faster than the baseline WFA-GPU. This results in a speed increase of up to 16.8× compared to the CPU WFA implementation. In addition, we implement an approximated distance-only kernel, which gives a speedup of up to 133.0× compared to the multi-threaded CPU WFA implementation.For the case of aligning high-quality short sequences, like those produced by Illumina sequencers, NVBio delivers the fastest results at the expense of scoring low in recall . GASAL2 delivers similar performance to WFA-GPU when aligning the Illumina 150 dataset and is 1.7× slower when aligning Illumina 250 (which has slightly longer sequences). Compared to the original WFA, which achieves the best execution time among all CPU libraries, WFA-GPU is 1.2× slower when aligning the Illumina 150 dataset, and 1.3× faster when aligning the Illumina 250 dataset. Compared to other CPU libraries, WFA-GPU obtains remarkable speedups (up to 1264× compared with Parasail). On these datasets , using WFA-GPU approximate alignment has little effect, providing an additional speed increase of only 1.3×. Computing only the alignment distance (distance-only kernel) is 1.4–2× faster than computing the whole alignment, giving an overall speedup of 1.7× compared with the multi-threaded CPU WFA implementation.Using PacBio sequences, WFA-GPU achieves a speedup of 2.5× (on PacBio CSS) and 3× (on PacBio HiFi) compared to the multi-threaded CPU version of the WFA. The speedup raises up to 4.8× if we don’t compute the alignment path (distance-only version). Our implementation outperforms by up to four orders of magnitude other CPU tools and libraries. The only GPU implementation able to finish is CudaAligner, even though it obtains a significantly low recall (less than 50%) while being between 19.5 and 26.7× slower than our solution. When using WFA-GPU approximate alignment, we obtain an overall speedup of 2.7× and 4.8× for the CSS and HiFi datasets, respectively. Combining the approximated approach and the distance-only kernel, the speedup goes up to 7.1×.Regarding the Nanopore dataset, which consists of large sequences with a high error rate, WFA-GPU is 4.3× faster than the CPU implementation of WFA and 17.5× faster when using the distance-only version. In comparison, CudaAligner is 3× faster for this execution, but it generates incorrect results . When compared to other CPU libraries, WFA-GPU is up to 19.7× faster. However, this speedup is not as high as on previous datasets because alignments with a high nominal error represent the worst-case scenario for the WFA algorithm. Despite this, a high error rate presents a good opportunity for approximated methods to improve execution times. In particular, the WFA-GPU approximated approach obtains a speed increase of 18.2× compared with the multi-threaded WFA CPU version. Only computing the alignment distance while using approximate WFA-GPU results in a speedup of 33.3×.In general, other GPU implementations either fail to scale with increasing sequence lengths, drop enormously in the recall, or simply fail to execute. Although CudaAligner delivers good performance results, it is bounded to produce edit-distance alignments that fail to capture the biological insights that gap-affine models do. While traditional DP-based algorithms fail to scale with sequence length, WFA-based implementations demonstrate to scale with increasing error rates and lengths. In practice, DP-based implementations require impractical execution times. As opposed, our WFA-GPU implementation delivers good performance results, even when aligning long and noisy sequences. Additionally, our approximate alignment method for WFA can provide additional speedups with little accuracy compromise .Future advances in sequencing technologies and genomics present critical challenges to current bioinformatics methods and tools. This situation calls for improved methods and tools that can scale with increasing production yields and sequence lengths. Current HPC computing relies on GPUs as successful hardware accelerators for computing-intensive applications in many areas of research. This work presents the first GPU-based tool for sequence alignment based on the efficient WFA algorithm. We proposed algorithmic adaptations and optimizations of the WFA to effectively parallelize the alignment task, exploiting the high-performance capabilities of modern GPU cards.We demonstrate the benefits of WFA-GPU compared to other state-of-the-art CPU and GPU tools and libraries. Our WFA-GPU implementation performs up to 29× faster than other GPU tools, and up to four orders of magnitude faster than DP-based CPU libraries. Compared to the WFA CPU implementation (fastest CPU library to date), we obtain speedups up to 4.3× on real datasets, without any accuracy loss. When computing only the distance, we get an extra speedup up to 4×. Using our WFA-GPU approximated alignment strategy to align long and noisy sequences, our method reaches a maximum speedup of 18.2× compared to the original WFA CPU, retaining a 98.6% accuracy. To the best of our knowledge, WFA-GPU is the only GPU-based pairwise aligner capable of producing exact gap-affine alignments for long-sequencing datasets, like PacBio HiFi or Oxford Nanopore, in reasonable time using commodity GPU devices. Using GPUs in conjunction with WFA-GPU not only offers speed gains but also provides a cost-effective approach for building systems dedicated to pairwise alignment. In our experiments, the CPU employed has a recommended customer price (RCP) of 1440 USD, whereas the GPU utilized has an RCP of 799 USD. As a result, a system equipped with two CPUs would cost 2880 USD, whereas a system incorporating one CPU and one GPU totals 2239 USD. Even when considering an ideal CPU scalability, opting for the GPU-enhanced system yields a performance-to-cost ratio of 1.2–3.7× higher than the dual-CPU configuration.Moreover, WFA-GPU consumes between 1.6 and 2.5× less energy in comparison to WFA CPU-based alignment. For an analysis of energy consumption, refer to With the advent of improved sequencing technologies and more sophisticated genomic studies, WFA-GPU offers an accurate, fast, and scalable sequence alignment solution that effectively exploits the massive computing capabilities of modern GPU devices. Therefore, we hope that WFA-GPU will become a valuable and practical addition to the bioinformatics toolkit that supports efficient research in future genome analysis.btad701_Supplementary_DataClick here for additional data file.