A scalable, self-contained method to build pangenome graphs without such limitations would be a key step in pangenome construction and manipulation pipelines.Pangenome variation graphs model the mutual alignment of collections of DNA sequences. A set of pairwise alignments implies a variation graph, but there are no scalable methods to generate such a graph from these alignments. Existing related approaches depend on a single reference, a specific ordering of genomes or a seqwish algorithm, which builds a variation graph from a set of sequences and alignments between them. We first transform the alignment set into an implicit interval tree. To build up the variation graph, we query this tree-based representation of the alignments to reduce transitive matches into single DNA segments in a sequence graph. By recording the mapping from input sequence to output graph, we can trace the original paths through this graph, yielding a pangenome variation graph. We present an implementation that operates in external memory, using disk-backed data structures and lock-free parallel methods to drive the core graph induction step. We demonstrate that our method scales to very large graph induction problems by applying it to build pangenome graphs for several species.We design the seqwish is published as free software under the MIT open source license. Source code and documentation are available at https://github.com/ekg/seqwish. seqwish can be installed via Bioconda https://bioconda.github.io/recipes/seqwish/README.html or GNU Guix https://github.com/ekg/guix-genomics/blob/master/seqwish.scm. However, the graph may also contain new implied pairwise relationships that arise due to transitive match relationships, as shown in The set of alignments represented by a variation graph may be strictly larger than the set of alignments used to induce it. The graph must contain at least the set of alignments given in input. In other words, by definition of m+. If A is sorted, we can find the matches of a given character in Q using binary search, which allows us to compute m+ for each character. We do so non-redundantly by marking each used character in Q in an auxiliary data structure Z, which, like A, consists of match pairs, but rather than mapping A, we can sort Z to obtain random access via binary search. Finally, we derive elements in Q and looking up their mapping in Z using binary search. The edge set For the sake of time and space complexity analysis, we consider a simple algorithm to implement the induction process. The induction depends on our ability to compute transitive closures of matches Q, in practice, we only store S, as N sequences in A as input, and that all sequences are approximately identical, so that the induced variation graph has Q into the graph Q during graph induction, which requires The inductive proof of Theorem 2.2 demonstrates how to build a variation graph from sequences and their pairwise alignments. However, a naïve algorithm based on this model would require a very large amount of space. Although our identifier space N = 100 and 15 identifiers to store the full model. Such a design is almost infeasible for inputs larger than a handful of genomes. For instance, we would need approximately Assuming that we want to build a graph of 100 haploid human genomes of S to walks through Z in Considering the time complexity of induction, we anticipate N grows, both time and space complexity are dominated by the number of alignments, which in the case of our example is A without disrupting the induced graph. We leave these to later work.Due to our dependence on sorting, and the logarithmic-time cost of queries, growth in range-matches over pairs of ranges of characters in Q. For highly similar sequences, our expectation is that exact matches will occur in long runs. If the average pairwise diversity of sequences in our input is k characters long. By encoding matches as pairs of ranges of characters, k-fold compression of A, yielding the range-match array As the bounds analysis shows, space requirements make it impractical to apply a trivial version of Theorem 2.2 to generate a large pangenome graph. Therefore, we need a compression approach that exploits redundancy in the input genomes to reduce the costs of the algorithm. When working with large numbers of genomes, alignments dominate the computational costs. A simple technique is to generalize matches implicit interval tree (m+), we query Q, computing the character-level transitive relationships from the relative offsets of the ranges in k without affecting our time complexity bounds.If sorted, val tree , which aZ, yielding Q and k, due to the interruption of the graph by variation between genomes, this still allows us to reduce the size of Z using runs of matches between Q and The same encoding can be used to replace the sequence-to-graph mapping Algorithm 1:seqwish graph induction algorithm. For the sake of simplicity, we omit the details of several query algorithms that interact with the input alignments, the transitive match closure, implicit interval tree construction and query, node generation and bitvector rank queries used in node compaction. Similarly, we omit the details of the input partitioning that we use to reduce maximum resident memory requirements.The input: sequences S and their alignment Aoutput: variation graph MakeMatchIITree(A)//alignmentmatchesvector containing the set of nodesBitVector//seencharactersofSfor each character in the input//fortodothis character is not yet in //ifthen characters inSmatched toi  //GetTransitiveMatches  AddNode//newnodein  the node id or rank in  fordo  /markseencharacter   ExtendRanges//querygraph   ExtendRanges//graphquery   end  end endset up ourmappings//MakeIITree; MakeIITreecompact nodes inyielding//BitVectorfortodoOverlaps ifthen /recordanodeboundary  AddNode  /recordlastnodeboundary  end our last set of matching ranges  end/pathsandedgesfor each sequence in the inputfortoN do do   //extend our path with the next stepFirstOverlap  NodeMatching)  /extendthepath  increment offset inS  /addtoouredgeset  /recordlaststep  while increment our pointer inS endreturnFor simplicity, we have thus far presented a character-level model of variation graph induction. However, range (or run) compression can also reduce the representation size of the graph. Rather than recording an identifier for each character in a sequence graph, it is useful to compact characters that form trivial linear components in the graph into single nodes. Broadly, the size of nodes will be bounded by the average distance between variants, which, for pangenomes built from ∼100 individuals of the same species, often provides a great reduction in the total number of nodes (and thus identifiers) required for Q, finding each entry in To compact k improvement in memory bounds for key data structures used in the induction, the approach we present in Section 2.4 requires working memory in the order of the set of transitive match closures in the graph. A simple approach to reduce this bound is to divide the induction problem into smaller pieces. We do so by computing the graph induction for a collection of initial characters in Q. In each partition, we apply a lock-free parallel union-find algorithm to derive the match closures .Our implementation reads standard data formats, FASTA or FASTQ for the input sequences, and PAF  for pairQ. Rather, each record lists the name of the aligned pair of query and target sequences and offsets in each. To efficiently process the input PAF, we thus need to build a sequence index that allows us to generate seqidx, and provide auxiliary supporting data structures that allow us to map between our input and the abstract concatenation of all input sequences and their reverse complements (Q). We often build graphs from very large collections of sequences, such as raw sequencing reads or contigs from many thousands of samples. This seqidx avoids the overheads associated with a hash table on string names of input sequences. To enable highly efficient random access, we cache the input sequences in a disk-backed version of Q, into which our queries of sequence name and offset point. This trades time that might be spent accessing a compressed representation of the input for space in external memory.In PAF, the input set of alignments is not directly expressed in terms of matches between specific characters in ix array  over seqS as paths seqidx, we walk through the offsets in S contained in the sequence and look up their mapping into S is covered by only one range in For output in GFA, we iterate over nodes in https://github.com/ekg/mmmulti). Indexing the implicit interval tree requires a sorting step which dominates the runtime of our algorithm. We adapt the current best-performing in-place parallel sorting algorithm, In-place Parallel Super Scalar Samplesort (IPS4o), to work on a disk-backed, memory-mapped array . In a pangenomic context, underalignment caused by We mitigate this issue with a simple filter, seqwish through application to four pangenomes collected from Arabidopsis thaliana, Homo sapiens, Heliobacter pylori and Zea mays. This limited survey is intended to demonstrate basic scaling properties of the method, and its practicality when applied to real pangenomes. We also consider the effect of the minimum match length filter described in Section 3.3. Experiments were conducted on compute nodes with 386 GB of RAM and AMD EPYC 7402P processors with 48 vCPUs.We evaluate wfmash (https://github.com/waveygang/wfmash), a DNA sequence aligner designed specifically for high performance all-to-all alignment of fully assembled genomes. wfmash combines an algorithm for generating whole-genome homology maps (MashMap2)  does not allow us to complete the graph induction for P = 95 and k = 0 for the H.sapiens set, nor for Z.mays with Although we use disk-backed data structures to represent the graph, the maximum memory requirements of seqwish to be applied as part of a larger process to build and refine a pangenome graph  alignments.To focus on these questions, we examine the case of a single chromosome (chrV) of semblies  of theseminimap2  or wfmasTwoPaCo provides a graph in a form that is similar to seqwish’s. However, it is based on a de Bruijn graph that must have a relatively low k-mer length, leading to complex topologies that in our experience cannot be resolved easily by increasing k. Furthermore, the overlaps between nodes are incompatible with the variation graph model, and must be reduced or ‘bluntified’ with additional processing steps to be usable as input to variation graph tools  of input genomes, and it progressively builds the graph by adding new variation from each genome in order. We do expect it to be order and reference (first input) biased, although the degree of bias requires experimentation to establish.In contrast, seqwish itself is by definition unbiased with respect to input order. But, if the alignments are affected by changes in order, the resulting graph will also change.Finally, We use ODGI to compute the size, node count and edge count of the resulting graphs (minigraph indeed generates a distribution of graph lengths with clusters corresponding to permutations beginning with the same genome. This suggests that most of the variation in minigraph’s graph derives from the first genome which is picked. The graphs are thus biased toward the chosen base reference. However, this is not the case for the seqwish builds based on minimap2 and wfmash, which appear to have almost exactly the same length across all permutations.As we observe in minigraph’s output depends markedly on input genome order. We also find that the minimap2+seqwish configuration is not order-independent because minimap2 can produce slightly different outputs when the reference and query sequences are ordered differently. This demonstrates that seqwish is only ‘unbiased’ insofar as its input mappings are. For TwoPaCo and wfmash+seqwish, we observe no variation in length. The length of TwoPaCo graphs is significantly larger due to the repetition in node sequences, which overlap by k−1 base pairs.In Although this particular study focuses on only a single small eukaryotic chromosome, it reveals that our basic understanding of reference bias in these graph construction methods is correct. By design, progressive pangenome graph construction methods will be affected by input genome order. But, other symmetric methods avoid order bias.match compression, which reduces the expected computational complexity by a factor proportional to the diversity of input sequences. Our experimental results demonstrate that we can apply our method to various collections of sequences and alignments. It easily scales to some of the largest species pangenome construction problems possible using publicly available, high-quality genome assemblies. seqwish is a generic sequence graph inducer of potentially many uses. We envision that it can serve as a component in diverse sequence analysis and assembly pipelines, and hope that our thorough description of its core algorithm and functionality will enable its reuse by other researchers.We have presented a straightforward algorithm to generate a pangenome graph from a collection of genomes and alignments between them. By exploiting a simple model of this algorithm, we provide computational bounds that give insight into the complexity of the problem. We then make this approach practical by applying the concept of seqwish is unbiased in that as it directly and uniformly represents sequence relationships given on input in the resulting graph. Our comparison with related pangenome graph-building methods demonstrates that these effects can be significant. minigraph’s output varies substantially, with k. This prevents high-level structuring of patterns of homology and orthology in the resulting graph, and they furthermore cannot be guided by a specific alignment set.It is also a potentially novel approach. Despite the existence of many methods for pangenome building, we are not aware of any comparable method which can losslessly convert an all-to-all alignment to a variation graph. This direct relationship allows users to adjust the shape of the resulting graph by modifying alignment parameters, allowing the design of custom graph construction processes based on domain-specific knowledge and potentially manual curation of assembly alignments. In contrast to existing methods, which depend on particular structuring of their input (pangenome graph building, which include both the initial alignment step and downstream processing of the resulting graph (seqwish perfectly represents its input alignments, the problem of generating and filtering an alignment set remains critical, as it determines the structure of the built graph. And this lossless property does not guarantee that the resulting graph is easy to work with or navigate; in practice, downstream processing is usually required to normalize the graph for many applications. We expect to cover these topics in future work, some of which are ongoing (Our presentation is necessarily limited, in order to focus on and describe the unique problem of variation graph induction. Thus, in this manuscript and our experiments, we have not explored the full problem of seqwish presents provides key advantages over progressive approaches. Although a complete all-versus-all alignment of a set of genomes is costly, it is trivial to run in parallel. This feature is unavailable to progressive construction methods, which necessarily involve a serial introduction of new information into the graph. Although the total costs of a symmetric alignment and pangenome graph construction modality are high, they are in some sense more manageable. The modular, independent nature of the hardest part of the computation—the derivation of the alignments—can be scaled out to large compute clusters as well as cached for incremental construction and update of large pangenomes.Despite its apparently high costs, the symmetric pangenome construction modality that seqwish to measure at what level of mapping sparsification we observe changes in the induced graph. Although this may be infeasible for very large problems, it will allow us to develop an empirical understanding of how to reduce the complexity of the initial alignment step without affecting the resulting pangenome graph.We furthermore expect that local giant components will tend to arise in the alignment graph without requiring a complete pairwise alignment, suggesting that lessons from graph theory may help to guide a justified sparsification, or downsampling, of the input (


The construction of a high-quality multiple sequence alignment (MSA) from copies of a transposable element (TE) is a critical step in the characterization of a new TE family. Most studies of MSA accuracy have been conducted on protein or RNA sequence families, where structural features and strong signals of selection may assist with alignment. Less attention has been given to the quality of sequence alignments involving neutrally evolving DNA sequences such as those resulting from TE replication. Transposable element sequences are challenging to align due to their wide divergence ranges, fragmentation, and predominantly-neutral mutation patterns. To gain insight into the effects of these properties on MSA accuracy, we developed a simulator of TE sequence evolution, and used it to generate a benchmark with which we evaluated the MSA predictions produced by several popular aligners, along with Refiner, a method we developed in the context of our RepeatModeler software. We find that MAFFT and Refiner generally outperform other aligners for low to medium divergence simulated sequences, while Refiner is uniquely effective when tasked with aligning high-divergent and fragmented instances of a family. The ongoing explosion in the number of sequenced organisms highlights the need for reliable and thorough automated genome annotation pipelines. Most of the vertebrate genome finds its ultimate origin in transposable elements (TEs) , which hComputational MSA approaches seek to optimize one of several scoring models, and an optimal solution of commonplace models is computationally intractable . Over thTEs are prodigious generators of repetitive sequences in most genomes; their relationships can be difficult to recover due to rapid lineage bursts, complex recombination histories, and high rates of neutral mutation. The generation of an MSA from copies of a TE family is an important step in reconstructing the ancestral state of the TE and generating sequence models for genome annotation . TE sequprogressive alignment approach, whereby a guide tree is estimated from the unaligned sequences and used to control the order in which sequences are merged into an increasingly complete MSA  ,54, ColuTo the best of our knowledge, no formal evaluation of MSA tools has been previously conducted in the context of TE sequence families. To study this, we developed a new sequence simulator (TEForwardEvolve), and used it to generate a benchmark of simulated MSAs. Using this benchmark, supplemented with a small collection of ancient mammalian DNA Transposon families, we evaluated: MUSCLE, MAFFT, Dialign-TX, Kalign, FSA, Clustal Omega, ProbCons and T-Coffee, along with our Refiner approach. We demonstrate that MAFFT generally outperforms other generic alignment tools, and that our Refiner method produces comparable results for low-divergence sequences, and superior alignments when confronted with high levels of sequence fragmentation and sequence divergence.A custom-made tool (genRandomTETrees.pl) was used to simulate phylogenetic trees for DNA Transposon and LINE TE families. For DNA Transposons, which exhibit a star-like phylogeny Figure , the treTo simulate master-gene model phylogenies such as seen in LINE families Figure , the treWhile there are many sequence evolution simulators currently available, none provide all the features necessary for realistic TE sequence simulation in one package: nucleotide simulation, indel simulation, context dependent (trinucleotide) substitution matrices, and fragmentation simulation. Inspired by the release of TRevolver , which sFor each class of TE, the simulator is provided a prototypical TE sequence (in this study: Tigger1/Charlie1 for DNA transposons and L2/CR1 for LINEs), a simulated phylogenetic tree, a context-dependent substitution rate matrix, indel parameters, the number of generations represented in the tree, and fragmentation parameters. The substitution rate matrix consists of all triplet pairs where the center base is allowed to change and the edge bases provide 1bp of flanking context (64 × 64 matrix); rates were derived from a study of 160 000 non-coding sites in a set of mammalian genomes . Indel lTo study the impact of sequence substitution level, TEFowardEvolve was run with increasing values for the generations-per-unit-time (GPUT) simulation parameter (100–6000). This translates to an average Kimura divergence range of 1–52% for Tigger1 and 1–44% for L2 simulations. To study the impact of fragmentation, TEForwardEvolve was run with increasing levels of fragmentation  at two substitution levels . For each parameterization, 10 replicate simulations were run.For each sequence evolution simulation, TEForwardEvolve provides a reference MSA for comparison to the MSAs predicted by the alignment tools. The qscore  tool wasp be the consensus sequence derived from the predicted MSA, and Cr the consensus sequence produced from the reference MSA  = score(Cr ∼ Cr). An inaccurate predicted MSA will cause score(Cp ∼ Cr) < score(Cr ∼ Cr). CSL quantifies this by calculating the fraction of the ideal score that is lost with the predicted alignment: (score(Cr ∼ Cr) - score(Cp ∼ Cr)) / score(Cr ∼ Cr) In the case of an extremely poor predicted MSA, the predicted consensus may lead to a negative global alignment score(Cp ∼ Cr), so that >100% of the score is lost. For the analysis presented here, alignment was performed with a custom scoring matrix and gap parameterization described in the supplemental materials.We also define a new score metric ‘consensus score loss’ (CSL), which assesses the quality of the predicted MSA by comparing  the consensus derived from it to the consensus derived from the reference MSA. If the predicted MSA is accurate, its induced consensus will be highly similar to the consensus from the reference MSA, and an alignment of the two consensus sequences will produce a high score, whereas an inaccurate predicted MSA will produce a low score; CSL characterizes MSA quality by computing the amount of the optimal consensus alignment score that is lost by using a predicted MSA. Specifically: let CA Figure . To measlignment  Cp ∼ Cr,https://msa.sbc.su.se/cgi-bin/msa.cgi). For MAFFT, the linsi algorithm was chosen based on the guidance on the software website .The MSA tools covered in this evaluation are shown in Table Our Refiner method works by establishing a single template sequence, aligning all sequences to that template, then producing an MSA based on the way that those sequences align to the template . In the first pass, the template is chosen from the input sequences by picking the sequence with the best cumulative pairwise alignment score to all other sequences or roughly the centroid of the set. The resulting MSA is used to produce a consensus, which is used as the template for iterative rounds of transitive alignment, in the form of Expectation Maximization. The tool currently supports either RMBlast  or ABBlaIn this local-alignment strategy, characters that do not align to the template sequence are either arbitrarily aligned to each other  or not included in the alignment at all. This is not a problem in the context of RepeatModeler, since these are not part of high occupancy columns, so not part of the final consensus. For the purpose of MSA SPS evaluation, all characters must be present in the final alignment, so we simply add all such characters to the MSA such that they are not aligned to any other character.The consensus caller used by Refiner employs two stages. The caller initially identifies the highest scoring character  for each column from the subset of sequences aligning over it. The first step uses a matrix that reflects observed neutral DNA substitution patterns and is similar to matrices developed for RepeatMasker. For organisms with CpG methylation, which causes high conversion of CG to CA and TG, a second pass evaluates all dinucleotides in the initial consensus sequence for reassignment to ‘CG’ by registering the frequency of the most common products of CpG mutation, aligned CA and TG dinucleotides .We chose two TE classes to simulate, the Long Interspersed Nuclear Element (LINE), and the DNA transposon, to determine if their starkly different phylogenies lead to differences in the relative performance of MSA tools. The relationship of DNA transposon copies Figure  is typicDNA transposon star phylogenies may be contrasted with those of LINEs Figure , in whicSequences were simulated along these trees using a forward evolution sequence simulator seeded with a class-specific TE consensus sequence . The DNA transposon sequence simulation was seeded with the Tigger1 family consensus , and theP-value = 2.49e–22) and the LINE simulations . Furthes H test  see SuppConsensus sequences can be derived from MSAs by choosing the most likely ancestral base at each position in the MSA (considering only positions with high occupancy) ; this haP-value ≤ 1.1e–11), with MAFFT, Dialign and FSA outperforming the rest. We also explored the effect of fragmentation on the accuracy of MSA-derived consensus sequences, as in the previous section  and hign Figure . At highn Figure .e-value <0.001 were plotted  is an established and generally informative measure of global MSA reconstruction; however, it doesn’t appear to fully reflect the performance of MSA tools in the context of consensus sequence prediction. This can be seen most clearly in the performance of Refiner at high sequence divergences, where it is outcompeted by MAFFT’s SPS score while simultaneously producing superior accuracy of the MSA-derived consensus sequence. Local alignment appears to be key to explaining the difference. The consensus is negatively influenced by the tendency of many MSA tools to force mismatched sequence regions together in the MSA ,79; locaOur results suggest that even low levels of fragmentation, when combined with higher sequence divergence, poses a significant challenge to MSA tools. Faced with fragmentary input, Refiner produced MSAs that were significantly more accurate than other tools, highlighting the value of its iterative transitive alignment approach for this challenging form of input. For this study, fragmentation is simulated as a random process, whereas fragmentation processes exhibit biases for many TE classes . We plan to extend our simulator, TEFowardEvolve, to explore the effect of these fragmentation architectures on MSA prediction as well as additionally consider SINE and LTR TE classes.Finally, simulation results were validated with an evaluation using manually curated protein sequences, known homologs, and instances of the TE family sequences that once encoded them. Only one tool (Refiner) was consistently successful in computing an MSA-based consensus that matched the corresponding proteins in a blastx search. The classification of a TE family is greatly facilitated by comparing to existing TE protein databases, underscoring the importance of an accurate MSA reconstruction. This analysis was restricted to DNA transposons due to the limited availability of ancient TE protein reconstructions. Natural sequences present the most compelling benchmark; however, it is difficult to obtain large enough samples for a complete parametric analysis. We plan to further extend this aspect of the benchmark as a complement to the simulated datasets.https://github.com/Dfam-consortium/TEForwardEvolve, release tag ‘1.0-paper’. MSA tool results, graphs and alignment visualizations may be downloaded from: https://www.dfam.org/web_download/Publications/MSABench2021.TEForwardEvolve, genRandomTETrees, analysis scripts, Nextflow  job manalqac040_Supplemental_FilesClick here for additional data file.


For the Nb test set, NanoNet achieves 3.16Å average RMSD for the most variable CDR3 loops and 2.65Å, 1.73Å for the CDR1, CDR2 loops, respectively. The accuracy for antibody VH domains is even higher: 2.38Å RMSD for CDR3 and 0.89Å, 0.96Å for the CDR1, CDR2 loops, respectively. NanoNet run times allow generation of ∼1M nanobody structures in less than 4 hours on a standard CPU computer enabling high-throughput structure modeling. NanoNet is available at GitHub: https://github.com/dina-lab3D/NanoNetAntibodies are a rapidly growing class of therapeutics. Recently, single domain camelid VHH antibodies, and their recognition nanobody domain (Nb) appeared as a cost-effective highly stable alternative to full-length antibodies. There is a growing need for high-throughput epitope mapping based on accurate structural modeling of the variable domains that share a common fold and differ in the Complementarity Determining Regions (CDRs). We develop a deep learning end-to-end model, NanoNet, that given a sequence directly produces the 3D coordinates of the backbone and C The large and diverse repertoire of the immune receptors, including antibodies and T cell receptors (TCRs) is behind the specific antigen recognition mechanism . Next geEpitope characterization is an important part of therapeutic antibody (mAb or Nb) discovery. It is critical to select epitope specific sequences from a large pool of candidates. However, high-throughput experimental structural characterization of hundreds or thousands of antibody-antigen complexes remains challenging. Computational methods for modeling antibody-antigen structures from individual components frequently suffer from high false positive rate, rarely resulting in a unique solution. There are two main bottlenecks: low accuracy of antibody CDR loop modeling and antibody-antigen scoring functions.ab initio techniques. The CDR3 loop which is highly variable and long presents a mini folding problem. While there are existing tools for mAb and TCR modeling, including RosettaAntibody and Rosetta TCRmodel  as an input and produces coordinates of the backbone and Cβ atoms. NanoNet improves upon existing models using direct end-to-end learning that enables the network to learn the full 3D structure without dividing the modeling problem into framework and CDRs modeling.Here we use deep learning for accurate end-to-end prediction of Nb structures. While our main goal is accurate Nb modeling, NanoNet can also accurately model VH domains of the antibodies and Vβ domains) and the output is the backbone and Cβ coordinates for the input sequence. The network was trained on a dataset of ∼ 2,000 heavy chains of mAbs and Nb structures. The framework region of the antibodies is highly conserved with Cα RMSD under 1Å between aligned structures. Therefore, we achieved transformational invariance for predicting 3D coordinates by aligning all the structures of the training set on a randomly selected reference structure. The VH domain structures were aligned using MultiProt algorithm with order-dependence and distance threshold of 1.4Å  is 1.02Å and the median is 0.94Å S1. The R3 loops , 27 whicWe compare our results to the results of RosettaAntibody % sequence identity to the Nbs from the training set published prior to July 2019. The run time of AlphaFold2 structure prediction for a single Nb sequence was ∼15 minutes. AlphaFold2 achieved slightly lower mean frame region RMSD (0.93Å) and mean CDR3 RMSD (2.84Å) compared to 1.02Å and 3.16Å for NanoNet (Publication of the highly accurate structure prediction model  prompted NanoNet Table 1. NanoNet  or due tWe test the method on VH modeling using the mAb test set (Methods). Overall, due to shorter average loop length and a larger number of mAbs in the training set, we obtain highly accurate models with frame region RMSD of 0.64Å overall RMSD (median 0.58Å). The CDR1, CDR2, CDR3 loops are also highly accurate with mean RMSDs of 0.88Å, 0.95Å, 2.38Å , respectively S2. Agaiβ turn in the CDR3 loop consisting of 14 residues , splitting the input structures into train and test sets needs to be done carefully to prevent overfitting. To obtain the most optimal split cut-off, we compare the performance of NanoNet for each test set case as a function of maximal sequence identity (MSI) in the training set. We find that for the mAb test there is a significant negative correlation of RMSD with the training set MSI (The PDB contains only 200 non-redundant TCR structures (using 99% sequence identity cut-off), a number that is too low for training a deep network. Because the TCRs are structurally similar to the antibodies Table S3To further test the performance of NanoNet in the context of epitope prediction, we docked the modeled Nbs from the test set to the antigens with known antigen-Nb structures using PatchDock antibody-antigen protocol , 30. AntWhen analyzing large antibody repertoires the main challenge is to group the sequences into clusters based on the antigen and the specific epitope the antibody binds to. While sequence similarity indicates structural similarity and similarity in the epitope, structural similarity is an additional indicator of functional similarity . In the β atoms for the whole Nb sequence without separate modeling of frame and CDR regions. Because NanoNet was trained on antibody VH domain structures (as well as Nbs), it has high accuracy in VH modeling. The accuracy of the method is significantly higher than standard loop modeling methods and comparable to deep learning based approaches, including AlphaFold2 .We have developed a high-throughput accurate end-to-end deep learning-based method for 3D Nb modeling. Compared to previous antibody modeling approaches, such as RosettaAntibody or DeepAb, the method directly predicts the 3D coordinates of the backbone and CphaFold2 Figure 3phaFold2 . IgFold The high modeling speed of NanoNet (a few milliseconds per Nb), enables accurate modeling of entire antibody repertoires from NGS experiments. This modeling can further enable analysis of the serum repertoire according to antigen specificity . We applβ coordinates. Representation of side chains (for example using center of mass) in the NanoNet, as well as refinement using GNN-based deep-learning approaches can further improve prediction accuracy . The tensor is padded with insertion values for all sequences shorter than 140. The network consists of two 1D ResNets  Figure. We use th keras .The training was performed using ADAM optimizer  with a lβ coordinates and the experimental coordinates after alignment to a reference structure, this is equivalent to the RMSD. The second term is a loss that optimizes the distance between consecutive Cα atoms to 3.8Å and defined as (for a sequence of length N):We used a loss function comprised of two terms: the first term is a MSE loss between the predicted backbone and CiCα are the 3D coordinates of the Cα atom in the i amino acid of the predicted structure, and d is Euclidean distance. The total loss was defined as the sum of two terms: Where β coordinates based on the trained network is straightforward and takes about 6 milliseconds on a GPU or about 20 milliseconds on a CPU. The full atom model is obtained using Modeller  calculated on the whole VH structure, as well as the RMSD of the frame and the three CDR loops. The RMSD of the loops was calculated based on the superposition of the frame regions that minimizes the backbone RMSD  within a short distance ( < 1Å). Note that NanoNet predicts aligned Nb structures, therefore the number of aligned Cα atoms is a measure of structural similarity. We define a structural distance as follows:Structural similarity between a pair of Nb structures was defined by counting the number of pairs of CWe quantify the structural similarity for all pairs of Nbs and produce a distance matrix. We used the pairwise distance matrix to cluster the structures by K-Medoids algorithm  with k=1https://github.com/dina-lab3D/NanoNet.The source code, the trained model and a Colaboratory notebook for running NanoNet are available at GitHub: DS-D conceived the research and supervised the study, TC developed and benchmarked the method, MH assisted with deep learning architectures. TC MH and DS-D drafted and edited the manuscript. All authors contributed to the article and approved the submitted version.The reasearch was supported by ISF (1466/18) and Minerva StiftungThe authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.


The seed finding step is crucial to curb the runtime as potential alignments are restricted to and anchored at the sequence position pairs that constitute the seed. To identify seeds, it is good practice to use sets of spaced seed patterns, a method that locally compares two sequences and requires exact matches at certain positions only.An important initial phase of arguably most homology search and alignment methods such as required for genome alignments is geometric hashing. Geometric hashing achieves a high specificity by combining non-local information from different seeds using a simple hash function that only requires a constant and small amount of additional time per spaced seed. Geometric hashing was tested on the task of finding homologous positions in the coding regions of human and mouse genome sequences. Thereby, the number of false positives was decreased about million-fold over sets of spaced seeds while maintaining a very high sensitivity.We introduce a new method for filtering alignment seeds that we call An additional geometric hashing filtering phase could improve the run-time, accuracy or both of programs for various homology-search-and-align tasks.The online version contains supplementary material available at 10.1186/s12859-022-04745-4. The alignment of whole-genomes is instrumental to comparative genomics and comparative genome annotation in particular . This was done to prevent a potential bias from assuming relative gene boundaries.We selected a subset of 705 pairs of human and mouse gene regions, each containing one orthologous gene pair. The average sequence lengths were 88 kbp and 80 kbp for human and mouse, respectively. The total length of human and mouse genic regions in the test set were approximately 62 Mbp and 56 Mbp, respectively.k as equally specific  of sequence at least one supporting seed and defineWe say a seed an indel .j in mouse is homolog. One reason for this choice is that the accuracy measure would otherwise depend on the completeness and correctness of some reference alignment and would also presuppose that a matching splice form is annotated and identified. The sensitivity would then have an unknown upper limit Note that we did not require that the corresponding position k and other parameters most relevant when the sensitivity is at least 0.9.Note that this sensitivity measure still cannot quite be expected to achieve 100% because not all human exons have a homologous region in the mouse genome. In order to raise upper limit to the practically achievable sensitivity to 100%, we ignore a small number of human exons which we expect cannot be anchored, e.g. because the gene sequences at the respective annotated coordinates are masked or there is no annotated alignment for the exon inside the ortholog mouse sequences . NeverthTo measure and compare the prediction of wrong seeds we applied all approaches also to the set of random sequences described in “N. However, through appropriately large k’s or thresholds, seed-finding can reduce the number of hits that are further examined to something that is linear in the genome size(s) N. An effort that is linear in N is unavoidable and acceptable.The rationale behind this measure is as follows. The alignment space—more particular, the set of all admissible In this section five methods M1–5 for seed finding are described in order of increasing accuracy and sophistication. M1 searches for contiguous matches, M2 and M3 use a single and multiple spaced seed patterns, respectively. Methods M4 and M5 use seed candidates found by M3 and apply additional filtering steps to reduce k-mers. Firstly, we do not consider sequence positions that fall in a repeat-masked part of the genome. Secondly, we apply a simple filter to reduce this noise for all methods. If a k-mer leads to more than ten seed candidates, we only compute a random subsample of size 10 of all possible seed candidates. The filter value (10) can be adjusted to be more or less strict. Ignoring seeds of patterns with many matches is in accordance with filtering techniques used in other genome aligners, e.g. DIAMOND [Matches found by M1-M3 are small similar region pairs, thus we extract the respective midpoints as seed candidates. Repeats in the sequences could lead to many seed candidates originating from the same  DIAMOND .S and sequence positions S from position a up to and including position b. Exclusion of the end position is denoted with round parentheses, e.g. For a string k, we say that two sequences a, b) if and only ifseed, i.e. the center from the two identical substrings of length k.This simplest method serves as a baseline. For a given weight match positions and the 0’s are don’t care or wildcard positions. The length span and the number of match positions is its weightk, with k-mer p to a sequence S at some position i, concatenating only the characters from S that pair with a match position. More formally, lets-th 1 in p. The k-mer contiguous pattern induced by spaced seed pattern p at position i in S.A spaced seed pattern is a binary pattern k-mers induced by a spaced seed pattern p of weight k at positions p at position pair  iff pattern. In this article, we call a seed a pair of sequence positions . Applying this filter, an isolated match that could be random and non-homologous does not necessarily result in a false hit. This method is similar to the one described by Noé and Kucherov [After all matches have been identified, locally the number of consistent matches are counted and a hit is only reported if the number of neighbouring matches reaches a threshold Kucherov .D. Suppose candidate seed from method M3. This position pair is reported as hit only if the total number of seeds of some positions  with pseudocode and provide a runtime analysis. The algorithm for M4 (Neighbouring Matches) is detailed in the Additional file H. Inserting and querying elements from such a data structure can be done in O(1) expected time. The key of the hash table is a tile, and the value is an unordered set of seed candidates that fit into the tile. Inserting a seed candidate into an unordered set also takes O(1) time. Computing the score in line 6 is linear in the number of seed candidates in the tile.Our implementation in C++ uses a hash table for the data structure k and the number of spaced seed patterns (for M3) is varied. M5 was run as described in “k leads to larger sensitivities but the number of false positives grows exponentially. With a weight k could quickly render seed finding or seed extensions computationally infeasible or have prohibitive memory usage.Figure On our test data set of unrelated sequences, geometric hashing completely removed all false positive seeds for all Consider the comparison of the red and the brown points labeled k, seed finding with geometric hashing can simultaneously be more sensitive and much more specific than sets of spaced seeds. To see this, compare geometric hashing (M5) for When using a smaller mentclass2pt{minimM4 (neighbouring matches) is able to achieve zero false positives as well, however at lower sensitivity. Among the baseline methods M1-M3, contiguous seeds have the worst trade-off between sensitivity and k of the seeds. We determined optimal weights minimizing at least 0.9. Figure The key parameter for seed finding is the weight entclass1pt{minimageometric hashing in comparison to other state of the art seed filtering programs, we ran the YASS alignment software on our dataset. YASS uses the “group criterion” [Geometric hashing results were evaluated as before. Using the two-step approach  spaced seed patterns. The later method itself constitutes an improvement of 3–4 orders of magnitude over the naive method of using contiguous Geometric hashing can be used as a filter on any other seed finding method and may potentially be ’inserted’ into the internal pipeline of existing alignment programs between seed finding and seed extension. A large speed-up may be possible in such aligners if significant parts of the runtime are spent downstream of seed finding. Note that seed extension, followed by scoring and filtering, is also an algorithmic step to achieve a higher specificity. However, it requires running an algorithm for local alignment scoring over a variable-length region. In contrast, geometric hashing only requires a constant number of simple integer arithmetic functions  and does not require any sequence comparisons. A seed extension phase would still follow but needs to be executed on a much smaller set of seeds.k. Due to the effective filtering of geometric hashing, this need not come at the computational cost of a large number of false positives. The seed finding with geometric hashing can then simultaneously be somewhat more sensitive and much more specific than sets of spaced seeds. Even small improvements in sensitivity may result in finding orthologies with lower sequence similarity [Moreover, a higher sensitivity can be achieved by lowering milarity .With our results we confirmed the well established advantage of spaced seeds  over contiguous seeds (M1) and that additional filtering steps  can improve seed performance even further. The focus of this work was to show that considering even distant exons in filtering, as done in geometric hashing, works and is superior to only considering local neighbourhoods of seeds candidates as done in M4. Due to its ability to filter out FP efficiently, we expect a large runtime improvement from geometric hashing when applied in pairwise whole-genome alignments, as much fewer wrong seeds have to be considered in the more time consuming seed extension phase. Since geometric hashing is also easily generalizable to process seeds from an arbitrary number of input sequences in a truly simultaneous fashion, we think it is a promising novel tool in multiple genome alignment tasks.Geometric hashing aggregates non-local similarities and, accordingly, we tested it here on input sequences that span at least a whole vertebrate gene. It can be expected that the relative advantage is lost, when only short similarities are sought, e.g. from small genome rearrangements or horizontal transfer of DNA fragments. However, we think that the geometric hashing idea is not limited to genome alignments. It could be adapted for protein sequences as well and with some adjustments also for protein to mRNA alignments, or it could be used to speed up tBLASTX , which fk-mers and for the secondary geometric hashing of tiles. Further, the overall memory footprint can be decreased when the genomes are processed in chunks rather than all at once.The methods for seed filtering can be seen as proofs of concept with much potential for improvements as we did not aim to write a fully optimized software. For example, it has been reported that sorting matches by keys rather than hashing can improve runtime due to better data locality . Such angeometric hashing, that uses non-local neighbourhood information to find orthologous genes with high precision. It outperforms local neighbourhood filtering while only slightly affecting the sensitivity of unfiltered seeds. Geometric hashing is a simple yet powerful idea and generalizes well to other alignment problems and higher dimensional data and could be a strong tool in future (multiple) genome alignment approaches.We presented a novel seed filtering approach, Additional file 1. The supplementary material includes additional tables and figures.


Many distantly related structure pairs exhibit structural similarities that can only be fully captured by a non-sequential alignment program. We present US-align2, a unified protocol for both sequential and non-sequential alignment of proteins and nucleic acids. On manually curated reference alignments for protein structural pairs with non-sequential relations, US-align2 achieves ≥13% higher agreement with reference alignments than existing sequential and non-sequential alignment methods. Non-sequential alignments also enabled US-align2 to have higher sensitivities in detecting RNA pairs from the same family with sequence identities <40%, obtaining ≥9% higher area under the receiver operating characteristic curve than third-party programs. The unique ability of US-align2 to parse both proteins and nucleic acids allows the method to detect protein-RNA and protein-DNA mimicries. Additionally, US-align2 performs full and semi-non-sequential alignments with at least 48% and 14% faster speed than existing programs for the same tasks, making it particularly useful for large-scale structural similarity detection.  •US-align2 performs sequential and non-sequential (NS) tertiary structure alignment•It achieves 13% higher NS protein alignment accuracy than other methods•US-align2 allows more sensitive detection of RNAs from the same Rfam family•US-align2 validates existing protein-RNA and protein-DNA mimicries Biological sciences; Molecular biology; Molecular Structure; Some of the commonly used structure alignment methods include DALI , CE Shi, SPalignWhile this sequentiality condition allows for efficient implementation by dynamic programming, it also makes the resulting alignment less relevant for pairs of molecules with a 3D architectural similarity that can only be described by a non-sequential relationship. In fact, it was previously estimated that rearrangement of fragments that can only be identified through non-sequential (NS) alignment is present in at least 17.4% of all structurally similar protein pairs . The mosThere are two main types of algorithms for NS alignment. The first is a semi-non-sequential (sNS) alignment, which preserves the sequential order within aligned fragment pairs, usually being secondary structure elements, while regions connecting these fragments pairs are aligned non-sequentially. Typical methods in this category include GANGSTA+ , MASS D, and FleDespite previous advances in NS alignment of protein structures, many challenges remain. First, there is no NS algorithm for full-length alignment of RNAs or DNAs. Second, there is no available NS algorithm for the alignment of different biomolecular types. For example, protein and nucleic acid molecules cannot be aligned for quantitative molecular mimicry detection. Third, due to much larger search space, an NS alignment program is typically at least twice if not several times slower than a SQ alignment program that uses a similar scoring function. This makes large-scale NS alignment computationally prohibitory.To address these challenges, we present US-align2, which performs SQ, sNS, and fNS structure alignment for both proteins and nucleic acids using a unified scoring function, i.e., the TM-score , which iUS-align2 and eight existing programs for NS and SQ alignments were first tested on the RIPC dataset  of pairwLali), root mean square deviation (RMSD) of aligned residues, running time, and structure overlap (SO), which is defined as the percentage of residues aligned within 3.5Å to corresponding residues in the other structure:As per the previous study , performLA and LB are the sequence length of the two proteins, di is the distance of the i-th aligned residue pair, and I is the Iverson bracket, which equals to 1 if di<3.5 and 0 otherwise. Since SO considers both the alignment coverage and deviation at the aligned region, it is a more useful reference-independent metric than Lali and RMSD, which often conflict with each other. For example, the alignment program with the lowest RMSD (1.76 Å) was MASS, which also had the smallest Lali (116)  among all programs and the highest RMSD (18.35 Å). Neither program had the best SO. The two programs with the worst SO values (CE and DALI) both performed SQ alignment, while the three programs with the highest SO values were all fNS methods   . At the d CLICK) A. This iSO alignment is not necessary biologically relevant. For example, although the fNS program SAMO had a reasonable SO (55.06%), which was higher than any of the four SQ alignment programs in this benchmark, its alignment had the worst agreement (23.76%) with the reference alignments manually curated according to evolutionary and functional insights , which is ∼13% higher than the second (GANGSTA+) and third place (MASS) programs. These data suggest that US-align2 sNS alignments may have higher biological relevance than US-align2 fNS alignments, even though the latter had better apparent structural overlaps.Nonetheless, a high insights B. In facIn terms of speed, NS alignment is generally slower than SQ alignment using a similar objective function. For example, SPalignNS, which extended the original SQ alignment method SPalign for NS alignment, was almost three times slower than SPalign . This isTo further evaluate the ability of different structure alignment program to differentiate protein pairs from the same versus different folds, we collect a large dataset of 954 protein domains from the ASTRAL40 database version 2.08, which is a non-redundant subset of the Structural Classification of Proteins–extended (SCOPe) database with pairwise sequence identity <40%. To collect this dataset, we first only kept the structure with the best resolution in each protein superfamily in the ASTRAL40 set. We then removed proteins from all SCOPe folds with less than two superfamilies, resulting in 954 proteins, each from a different superfamily, that belong to 146 SCOPe folds.c was quantified by the true positive rate (TPR) and false positive rate (FPR):TP(c) and false positive FP(c) were the number of positive and negative pairs with alignment score ≥c (or ≤c in the case of SAMO), respectively, while P and N were the total number of positive and negative RNA pairs. The receiver operating characteristic (ROC) curve could then be drawn for TPR versus FPR at all possible alignment score cutoffs , except for SAMO alignments, which were sorted in ascending order of the alignment score because a lower  SAMO score indicates a higher structural similarity. Each pair was labeled positive or negative depending on whether the pair shared the same SCOPe fold or not. Any self-hit  was not considered. The performance of Rfam family detection at an alignment score cutoff  cutoffs A. The arThis benchmark shows that SQ alignment methods are usually more capable than NS methods to detect protein pairs from the same fold A. Among Despite having a lower precision, NS alignment can sometimes detect structural similarity that SQ alignment is not sensitive enough to identify. For example, both the cellobiose dehydrogenase and the chitin monooxygenase  share the same immunoglobulin-like beta-sandwich fold with complicated topology. US-align2 SQ is only able to align 3 out of the 7 β-strands of d4a02a_ with a poor TM-score of 0.303 C. On theIn this section, NS and SQ alignment modes of US-align2 were further benchmarked for homologous RNA detection on the Rfam dataset. To construct this dataset, sequences of all 7668 RNA PDB chains with at least one Rfam family match in Rfam database version 14.8  were extAs shown in To evaluate the abilities of different programs to compare distant homologs that are difficult to align, the same benchmark is repeated for the subset of 21813 RNA pairs with <40% sequence identities B. More pLeishmania . Although both rRNAs belong to the same Rfam family and perform the same function, US-align2 SQ alignment only reports a very low TM-score  from baker’s yeast and e 0.182, C. RMalige 0.182, . The cone 0.182,  while thribosome . Despiteribosome D which iThese data, however, do not suggest that NS alignment should always be preferred over SQ alignment for RNAs. Although both modes of NS alignments by US-align2 had higher TPRs than SQ programs at the high FPR region (FPR≥0.1), their TPRs were below US-align2 SQ in the low FPR region (FPR<0.1) . This imEven though RMalign and ARTS both performed SQ alignment rather than the more computationally expensive NS alignment, they still required 0.74 and 0.32 second per alignment, respectively. This was at least 8.0 and 3.6 times slower than US-align2 under sNS and fNS modes, which takes 0.04 and 0.09 second per alignment, respectively. Although not as fast as US-align2 SQ at 0.02 second per alignment, US-align2 sNS and fNS were still among the fastest alignment programs for RNA tertiary structures.The ability of US-align2 to handle both proteins and nucleic acids makes it an ideal program for identifying protein-RNA molecular mimicry. Such mimicry between a protein and a nucleic acid molecule usually implies similarity in overall shape but not consistency in sequence order. Therefore, NS alignment would be more relevant than SQ alignment for detecting such cases.For example, the ribosome recycling factor (RRF) protein and the tRNA is a pair of known molecular mimicry . Both moMolecular mimicry also occurs for DNA aptamers, which are DNA oligonucleotides that fold into unusual tertiary structures to recognize protein epitopes in a similar fashion as antibody-epitope binding . Such prIn this work, we present the US-align2 algorithm for both SQ and NS alignment. The NS alignment modes enable accurate identification of non-sequential residue correspondence between protein structure pairs and the sensitive detection of remote RNA homologs. Such sensitivities are achieved at a speed several times faster than existing programs. The unique ability of US-align2 to align proteins with nucleic acids under a unified scoring function (TM-score) enables it to quantitatively capture a protein-RNA mimicry.At present, US-align2 does not consider conformational variations between a pair of related structures. Future development of US-align2 will focus on the extension to flexible alignment.anna.pyle@yale.edu).Further information and requests for resources should be directed to and will be fulfilled by the Lead Contact, Anna Marie Pyle , Lali is the number of aligned residues, and L is the length, i.e., the total number of residues in the structure. Since the two structures in an alignment may have two different lengths, each pairwise alignment can have two different TM-scores depending on which length is used for TM-score normalization. The normalization factor d0 ensures that the TM-score is independent of protein length, and is calculated as:Here, d0 is slightly different:For nucleic acids, Statistics obtained on inter- and intra-family pairwise alignment show that TM-score≥0.5  or ≥0.45Lali, Lali/2, Lali/4, … , 4. A superimposition is performed for each pair of fragments using the Kabsch algorithm  that maximize the TM-score. Therefore, the TM-score superimposition given the alignment  is solved numerically by extracting all continuous fragment pairs with length lgorithm  to minimi, we calculate d13, d14, d15, d24, d25 and d35, which correspond to the Cα distances between residues i-2 and i, i-2 and i+1, i-2 and i+2, i-1 and i+1, i-1 and i+2, and i and i+2, respectively. Residue i is assigned as part of a helix if US-align2 has built-in subroutines to assign secondary structures, which is then used to guide initial structure alignments. For proteins, US-align2 assigns one of the four secondary structure states  to each amino acid based on the inter-atomic distances among five neighboring Cα atoms . Specifii-1 and j+1, nor nucleotide pair i+1 and j-1 satisfy the above two criteria, nucleotide i and j are not considered paired either. Based on these three criteria, a nucleotide can be assigned to one of the three secondary structure state: unpaired, paired with an upstream base, or paired with a downstream base.For RNAs, the secondary structure, i.e., base pairing, is assigned by US-align2 as in our previous work . For twoL/2 and L/3, and superimposition of small fragments with length 4. For each initial alignment, a set of heuristic superimposition-alignment iterations are performed until convergency. In each iteration, a TM-score superimposition is performed based on the alignment obtained from the previous iteration. The new superimposition is used to derive a new alignment using Needleman-Wunsch (NW) global alignment  algorithm  as TM-align  and RNA-For all benchmark studies, error bars indicating standard error of mean (SEM) are indicated as error bars on bar plots.


Detection of structural variants (SV) from the alignment of sample DNA reads to the reference genome is an important problem in understanding human diseases. Long reads that can span repeat regions, along with an accurate alignment of these long reads play an important role in identifying novel SVs. Long read sequencers such as nanopore sequencing can address this problem by providing very long reads but with high error rates, making accurate alignment challenging. Many errors induced by nanopore sequencing have a bias because of the physics of the sequencing process and proper utilization of these error characteristics can play an important role in designing a robust aligner for SV detection problems. In this paper, we design and evaluate HQAlign, an aligner for SV detection using nanopore sequenced reads. The key ideas of HQAlign include (i) using basecalled nanopore reads along with the nanopore physics to improve alignments for SVs (ii) incorporating SV specific changes to the alignment pipeline (iii) adapting these into existing state-of-the-art long read aligner pipeline, minimap2 (v2.24), for efficient alignments.We show that HQAlign captures about 4 – 6% complementary SVs across different datasets which are missed by minimap2 alignments while having a standalone performance at par with minimap2 for real nanopore reads data. For the common SV calls between HQAlign and minimap2, HQAlign improves the start and the end breakpoint accuracy for about 10 – 50% of SVs across different datasets. Moreover, HQAlign improves the alignment rate to 89.35% from minimap2 85.64% for nanopore reads alignment to recent telomere-to-telomere CHM13 assembly, and it improves to 86.65% from 83.48% for nanopore reads alignment to GRCh37 human genome.https://github.com/joshidhaivat/HQAlign.git The stuLong read sequencing technologies have addressed this problem by producing reads that are longer than the repeat regions, therefore, enabling the detection of variants in the repeat regions at the cost of higher error rates than short read sequencing technologies. This high error rates in the long reads lead to non-contiguous alignment which poses a challenge in variant detection problem, especially, in the repeat regions.Q-mer (a set of Q consecutive nucleotide bases which influence the measurement in the nanopore) [Q-mers that have similar current levels. This similarity in the median current levels for different Q-mers is captured by the Q-mer map as shown in Q-mer map represents the median current level for different Q-mers (Q = 6) for nanopore flow cell. It is evident from this figure that there is a significant overlap between the current levels observed for different Q-mers migrating the nanopore. We propose a new alignment method, HQAlign  , 11, 12.n QAlign ), which Q-mer map into account to perform accurate alignment with modifications specifically for discovery of SVs. Q-mer map space. It is important to note that no additional soft information is used to establish this identity such as raw nanopore current values for the nanopore reads. Instead, the nucleotide sequences that have indistinguishable current levels from the lens of the Q-mer map are mapped to a common quantized sequence. A nucleotide sequence is converted to a quantized sequence by first converting the nucleotide sequence to a sequence of current levels using the Q-mer map and then converting the sequence of (continuous) current levels to a (finite level) quantized sequence by hard thresholding the current levels  for the alignment of ONT reads from HG002 sample to GRCh37 human genome. The metric improves to 89.35% from 85.64% for HG002 reads alignment to T2T CHM13 assembly [We show that HQAlign gives significant performance improvements in quality of read alignment across real and simulated data. The well-aligned reads  improves to 86.65% with assembly , and impIn terms of SV detection, HQAlign has F1 score at par with minimap2 (v2.24) with Sniffles2  as the v2x to a target sequence t using Minimap2. This primitive step identifies the region of interests on the target sequence where x aligns. (2) the hybrid step is re-aligning the query x only to the region of interest determined in the first step using a modified pipeline for QAlign method. QAlign method converts the nucleotide sequences in both query x and target region t to quantized (three levels) sequence, and then aligns these quantized sequences using any state-of-the-art aligner. We have modified the minimap2 (v2.24) pipeline for the alignment of the quantized sequences in the second step so that it enables detection of the inversion variants in alignment using the quantized sequences. This is explained in detail in e.g. three levels) in QAlign. This strategy is explained in The HQAlign strategy consists of two steps: (1) the initial alignment of the standard basecalled query sequence 2.1x is aligned to a nucleotide target sequence t using minimap2. This is similar to aligning a read to a genome with one chromosome. Here we consider only one chromosome in target t for simplicity but the method generalizes to multiple chromosomes in t such as t =  n is an appended extension of the region of interest on target, fi = (ei − si)/n is the fraction of read aligned in initial step, and n is the length of the query x. The nucleotide query x and the nucleotide extended target xq and quantized extended target Q-mer map (in e.g. three) levels to get the quantized (HQ3) reads (refer HQ3) quantization.In this step, the query r map in  and thenWe define several metrics that are used for the performance evaluation of HQAlign against minimap2 (these metrics are used from the earlier QAlign method ).well-aligned: Consider in Read 1 aligns at location i1 through j1 on the genome determined using nucleotide alignment. We say that the read is well-aligned, if at-least 90% of the read is aligned onto the genome )), and has high mapping quality (greater than 20). This metric quantifies the reads that are mapped almost entirely to the reference.normalized edit distance: In order to compare the quality of the alignments at fine-grained level, we further define normalized edit distance. The normalized edit distance for nucleotide alignment is defined asi1, j1 are the start and end location of alignment on genome in nucleotide space and r is the entire read and G is the genome as shown in i.e.  and normalized alignment length: Another metric at the fine-grained level is normalized alignment length, which is the ratio of the length of the section on genome where a read aligns to the length of the read. It is2.3bam format are used to detect structural variants using Sniffles2. These calls are benchmarked against a truth set using Truvari [P) is defined as the fraction of SVs detected by the algorithm in the truth set among the total SVs detected by the algorithm. Recall (R) is the fraction of SVs detected by the algorithm in the truth set among the total SVs in the truth set. F1 score is the harmonic mean of precision and recall HQ3 that are missed by the other method. Therefore, we have defined a union model which takes a union of the SV calls from both minimap2 and HQ3. The precision, recall, and F1 score of the union model are also computed and reported in The alignments from HQAlign and minimap2 in sorted  Truvari . We havebreakpoint accuracy: Breakpoint accuracy is measured by taking an average of the difference in the in the start and end breakpoint of the SV w.r.t. the SV in truth set. For instance, as shown in i1 and j1 are the start and the end point on genome of SV in the truth set, and HQ3), then breakpoint score is calculated asSV length similarity: SV length similarity is measured as the ratio of minimum SV length in truth set and from algorithm to the maximum of two values. Mathematically, it isFurther, the quality of the SVs for the common calls in minimap2 and HQAlign is evaluated by comparing the following metrics w.r.t. the SVs in truth set3In this section, we demonstrate the results for (1) comparison of alignments from HQ3 and minimap2 on real as well as simulated data, and (2) comparison of SV calls from HQ3 and minimap2 alignments using Sniffles2 as the variant caller on real and simulated data.3.13.1.1We have used the publicly available R9.4.1 ONT PromethION reads dataset from HG002 sample . These r3.1.2HQ3 alignments shows an improvement over minimap2 alignments in terms of contiguity measured by normalized alignment length and alignment quality measured by normalized edit distance.The alignment of DNA reads to the genome is a primitive step in structural variant calling pipelines . HQ3 aliThe results are illustrated in the both minimap2 alignment and quantized alignment (HQ3). In case of HQ3, the information of the location of the alignment on the genome is leveraged from the quantized read and the quantized genome alignment, and the edit distance is computed between the corresponding nucleotide read and the aligned region on the nucleotide genome  calls that are made in HQ3 only, 358 are captured by minimap2 at a lower SV length similarity threshold and 681 are unique calls, whereas out of 890 (5.8%) calls that are made by minimap2 only, 461 are captured by HQ3 at a lower SV length similarity threshold and 429 are unique  are made only in HQ3 with SV length similarity to the truth set greater than 0.7 (default parameter in Truvari). However, 376/703 calls that are captured by minimap2 with SV length similarity less than 0.7 and 327/703 calls that are uniquely made by HQ3. Likewise, out of 16620 true positive calls in minimap2, 861 (5.18%) are made only in minimap2 with SV length similarity greater than 0.7. However, 524/861 are captured by HQ3 with SV length similarity less than 0.7 and 337/861 are uniquely made by minimap2. A fine-grain analysis of the common true positive calls by minimap2 and HQ3 in HQ3, and minimap2 has marginally better performance in terms of lower difference in breakpoint of SVs for difference in breakpoint below 50. Whereas, for a large difference in the SV breakpoint (greater than 50), HQ3 is better in terms of the breakpoint accuracy of the SV calls . Therefore, HQ3 improves the SV breakpoint for the rest 18.15% calls that have high difference in breakpoints. Further, HQ3 has better SV length similarity when the length similarity is below 0.95 which corresponds to 21.82% calls.For SV calls from HG002 reads alignment to GRCh37 and benchmarking them against truth set generated by comparing HG002 haplotype-resolved assembly to GRCh37 build, minimap2 has precision 0.78, recall 0.76, and F1 score 0.77 while 4HQAlign method is an alignment method designed for the detection of structural variants for nanopore sequencing reads. HQAlign provides alignment that outperforms the recent minimap2 aligner in terms of the accuracy and quality of the alignments. The SV calling from HQAlign is also at par with minimap2 in terms of F1 score and it outperforms minimap2 SV calls in terms of the quality of SVs measured in breakpoint accuracy and SV length similarity. Moreover, there are many complementary SVs captured by HQAlign that are missed by minimap2 alignments.Q-mer map, which could be one of the major causes of the high error rates in nanopore sequencing, and also it focuses on a narrow region of the genome  for alignment with quantized sequences. Further, this pipeline is adapted specifically for the detection of SVs. We demonstrated how HQAlign utilizes the bias of Q-mer map without accessing the raw current signal of nanopore sequencer by translating the basecalled nucleotide sequences to quantized current level  sequences. This improvement help in detecting several SVs that are missed by minimap2 due to high error rates in the nanopore reads. Further, the recall rate for SV detection can be improved by combining the complementary calls from both HQ3 and minimap2 in the union model at the same F1 score.The reason for this improvement in the performance of alignment and SV calling with HQAlign is that it takes into account the underlying physics of nanopore sequencer through the 1


Sequence alignment is an essential component of bioinformatics, for identifying regions of similarity that may indicate functional, structural, or evolutionary relationships between the sequences. Genome-based diagnostics relying on DNA sequencing have benefited hugely from the boom in computing power in recent decades, particularly due to cloud-computing and the rise of graphics processing units (GPUs) and other advanced computing platforms for running advanced algorithms. Translating the success of such breakthroughs in diagnostics to affordable solutions for low-cost healthcare requires development of algorithms that can operate on the edge instead of in the cloud, using low-cost and low-power electronic systems such as microcontrollers and field programmable gate arrays (FPGAs). In this work, we present EdgeAlign, a deep reinforcement learning based method for performing pairwise DNA sequence alignment on stand-alone edge devices. EdgeAlign uses deep reinforcement learning to train a deep Q-network (DQN) agent for performing sequence alignment on fixed length sub-sequences, using a sliding window that is scanned over the length of the entire sequence. The hardware resource-consumption for implementing this scheme is thus independent of the lengths of the sequences to be aligned, and is further optimized using a novel AutoML based method for neural network model size reduction. Unlike other algorithms for sequence alignment reported in literature, the model demonstrated in this work is highly compact and deployed on two edge devices  for demonstration of alignment for sequences from the publicly available Influenza sequences at the National Center for Biotechnology Information (NCBI) Virus Data Hub. Genetics will be crucial not just in determining the cause of a disease, but also in determining how a person responds to various treatments. Nanopore sequencing is a unique, scalable technology that enables direct, real-time analysis of long DNA or RNA fragments. Oxford Nanopore Technologies MinION2 is one such portable nanopore sequencing device that can be easily operated in the field with features including monitoring of run progress and selective sequencing. Data collected through such devices are typically stored and analysed on the cloud, or desktop-grade servers in well-equipped laboratories. To truly harness the potential of genome-based diagnostics for affordable healthcare solutions, that do not rely on expensive cloud storage and connectivity (e.g. for resource-constrained communities in low and middle income countries), it is necessary to develop efficient methods for analysing the data and delivering insights with automated and easy-to-implement workflows integrated with portable edge-devices. One such data analysis requirement is DNA sequence alignment, an essential component of bioinformatics and computational genomics for comparing two or more sequences, in order to identify regions of similarity that may be a consequence of functional, structural or evolutionary relationships between the sequences.Genomic medicine has the potential to make disease detection more efficient and cost-effective3 is one of the earliest and most commonly used method for pairwise sequence alignment. However, the computational complexity of such a dynamic programming-based alignment approach is proportional to the product of the lengths of the two DNA sequences, and is therefore challenging to be implemented on hardware devices with limited memory and computation blocks. In a multiple sequence alignment (MSA) problem, several sequences are aligned simultaneously. Clustal W4 is a well-known tool for MSA. It uses the progressive alignment method and determines the best alignment by matching sequences that are most similar first, then moving on to sequences that are least similar. Several implementations have also been proposed for improving this sequence alignment method including a few multi-thread based implementations on graphics processing units (GPUs)7 for improving the throughput. Pairwise alignment is commonly performed using various tools such as banded alignment, BLAST, MUMmer10 etc. along with various cloud processing solutions11. BLAST12 is the most commonly used tool, which is also available to be downloaded and run on a local computer, or an edge-computing platform running an operating system such as NVIDIA Jetson Nano. BLAST is also often used as part of other algorithms that require approximate sequence matching. The algorithm emphasises more on speed and in most cases, it cannot guarantee optimal alignment of the query and base sequences. Moreover, regions with low-complexity sequences can create problems in sequence similarity searching by causing artificial hits, and are not appropriate for analysing with BLAST. Such sequences are usually determined and masked out in BLAST using DustMasker13 and separately analysed visually.Several heuristic methods and algorithms have been proposed for the sequence alignment problem, of which the Needleman–Wunsch (NW) algorithm14 presented one of the first RL implementations for solving the DNA sequence alignment using Markov decision process (MDP). Jafari et al.15 introduced deep Q-Network (DQN) and an actor-critic algorithm in their work. The DQN model architecture was based on long short-term memory (LSTM) network which involves sequential computation to process the DNA sequence as a 1D data series. Song et al.16 provided a comprehensive deep RL based solution for pairwise sequence alignment, employing various pre-processing techniques such as Clustal, MUMmer, etc. to improve the alignment results, and highlighted the influence of various system parameters such as learning rate, window size, etc. on the model accuracy. Ramakrishnan et al.17 utilised asynchronous advantage actor critic (A3C) framework for MSA. They used a convolutional neural network (CNN) based architecture for their actor-critic model. However, this model is too complex to be applied to practical datasets with dozens of sequences and hundreds of molecules. Joeres et al.18 offered a comprehensive analysis of the performance of different RL algorithms for MSA, and observed that RL algorithms are typically much slower as compared to traditional solutions. However, all of these RL implementations either used very large models, which are challenging to implement on resource-constrained hardware, or or employed neural networks such as LSTMs, that are slower and currently not supported by machine learning frameworks for microcontrollers such as TensorFlow Lite19. In this work, we present EdgeAlign, a compact deep RL model for pairwise sequence alignment deployed on embedded edge device platforms such as the NVIDIA Jetson Nano Developer Kit and Digilent Arty A7-100T, containing Xilinx XC7A35T Artix-7 FPGA. The RL agent is modelled as a dueling DQN architecture, the number of parameters in which are optimised using a technique presented in this work for neural network model size reduction using AutoML20 for deep RL applications. The results are benchmarked on sequences from the publicly available Influenza sequences at the National Center for Biotechnology Information (NCBI) Virus Data Hub. EdgeAlign implementation source code is freely available on GitHub21.To overcome limitations of conventional alignment methods, a few reinforcement learning (RL) based techniques have recently been proposed in literature. Mircea et al.22. Unlike supervised learning, where the feedback provided to an agent (model) is correct set of actions for performing a task (classification), RL employs an agent to learn in an interactive environment by trial and error, using feedback from its own actions and experiences in form of rewards and punishments as signals for positive and negative behaviour, respectively. RL also differs from unsupervised learning in terms of the goals of the model. The goal of an RL model is to devise a suitable action model that maximises the cumulative reward of the agent for a wide range of test cases, while the goal in unsupervised learning is to find similarities and differences  between data points. Most conventional RL algorithms are based on a tabular approach for choosing the best actions by observing the current environment or states. However, in many practical decision-making scenarios, the states are high-dimensional and often difficult to be modelled by traditional RL algorithms. On the other hand, deep neural networks are known to be excellent function approximators23, and therefore more suitable for modelling complex systems.Deep RL is a very popular topic among machine learning enthusiasts and researchers, with varied range of applications such as robotics, autonomous driving, navigation, human-like behavior in AI, system modeling, etc.24. The two streams are combined via a special aggregating layer to produce an estimate of the state (s)-action (a) value function Q. The key motivation behind this architecture is that it is not necessary to know the value of each action at every step; only the most advantageous action needs to be determined. The DNA sequences to be aligned were represented as 3D images, which were processed by the network. Each type of nucleotide  was converted to a For the pairwise sequence alignment problem addressed in this paper, we have employed a deep Q-network (DQN) agent to estimate the scoring strategy for taking appropriate action in a given state. The DQN architecture explicitly separates the representation of state values and state-dependent action advantages via two separate streams. We have also used a dueling neural network architecture which consists of two streams that represent the value and advantage functions, while sharing a common convolutional feature-learning moduleW) starts from a prescribed starting point of both sequences, and the window is slid till it reaches the end of either of the sequences. x and y represent the current nucleotide indices for the first (Seq1) and second (Seq2) sequence, respectively. Figure i, iii, vii) or a mis-match e.g. (iv), however, the agent simply decided to go forward. In case of insertion, the agent inserts a gap in the second sequence e.g. (ii) and shifts the window to the right by one position for the first sequence, thus corresponding to insertion of an extra nucleotide in the first sequence and a gap in the second sequence. Similarly, in case of deletion, the agent inserts a gap in the first sequence e.g. (v) and shifts the window to the right by one position for the second sequence. These 3 actions will correspond to 3 different Q-values at the output of the deep Q-network.Figure first Seq and secofirst Seq and seco25 use a reward of i, iii, vii), 1 mis-match (iv), 2 gap openings  and 1 gap extension (vi). Thus, the total alignment score is the cumulative sum of the individual rewards, which in this case comes out to be EdgeAlign aligns two given sequences in such a way that we obtain maximum number of matches between the sequences. However, alignments with too many gaps or mismatches are not desirable. A commonly used metric to characterise the quality of the alignment is the BLAST alignment score. This rule-based metric assigns a numerical score to any alignment, with a higher score indicating better alignment. This alignment score is computed by assigning a value to each aligned pair of nucleotides and then adding these values over the length of the sequence. For nucleotide alignments, the default BLAST optionsmentclass2pt{minim16. EdgeAlign uses this technique to find the longest substring which is common to both sequences. Using this longest-common substring (LCS) as the starting point, the alignment task is split into two sub-alignment jobs. For all sub-sequences to the left of LCS, the alignment task is performed in the backward direction. On the other hand, for all sub-sequences to the right of LCS, the alignment task is performed in the forward direction. The aligned sub-sequences from both sub-alignment jobs are stitched back to the LCS, to obtain the overall alignment solution. Figure m and n respectively, is O(mn). Thus, it may not be feasible to use this method when working with very large sequences (e.g. human genomes). In such cases, it may be advisable to bypass this preprocessing step and only proceed with the forward alignment.EdgeAlign utilises a sliding window-based approach to employ RL for performing sequence alignment, and is therefore a sequential method wherein any decision or action once implemented for the sub-sequences in a window, cannot be modified or undone as the window slides forward. Thus, the quality of the solution  is greatly dependent on the starting position in each sequence, because the alignment procedure is performed only in one direction. We can remove such variability by applying pre-processing techniques used in conventional alignment methods , such as the longest-common substring (LCS)The DQN agent was modelled using a CNN with a dueling network architecture. By representing the sequences as images, the task of determining reward and action for sub-alignment within a window is posed as an image classification problem. CNN is the most widely used network architecture for image classification tasks due to advantages it affords in terms of dimensionality reduction, feature sharing, and pattern finding. Using the dueling method, the RL agent learns the scores of the states  and actions separately, thus helping improve the stability and convergence of the learning process. Figure 26, and Zipfian distribution-based InDel length model for generating InDels27. This functionality was implemented using Python as this allowed us to easily integrate the sequence generator with our RL environment. We used Keras-RL28 as the RL framework for training the dueling DQN agent, implemented using Dueling DQNAgent from the Keras-RL framework with a Greedy policy for determining suitable actions. Figure The nature of the pairwise sequence alignment problem makes it easy to generate artificial DNA sequence data with controllably introduced mutations for training the RL agent. These sequences must be generated using a definite rule and should be able to mimic various mutations such as SNP (single nucleotide polymorphism), insertions and deletions (InDels). For this purpose, we generated various random sequences, and their corresponding paired sequence through introducing mutations using JC69 model to create SNP mutations30. However, it is often cumbersome to evaluate the importance of each neuron in the network for pruning, and usually requires manual fine-tuning. Another method for model compression is knowledge distillation31, wherein a pre-defined smaller network is trained using a fully-trained larger network as ground truth. This approach is similar to transfer learning, and requires setting up a fully-trained network. Quantisation is a well-known approach for compressing a model, by representing the model parameters using 8-bit integers instead of floating point numbers. This provides large savings in memory footprint for storing the model parameters, albeit with deteriorated model performance due to reduction of numeric precision and resolution. In pairwise sequence alignment, this is undesirable, because the alignment is performed in a sequential and unidirectional manner, and therefore errors in each alignment task for sub-sequences accumulate and degrade the overall model performance.It is important that the model size for pairwise sequence alignment using EdgeAlign be minimal, so that the trained model could be implemented on an edge device. For a window size of 50, the implementation described in the previous section Table  comprise32, is a suitable technique for automating the design of neural network architectures within a desired set of constraints e.g. maximum allowed model size, number of operations, latency etc. NAS only requires the search-space constraints to be specified, and a labelled dataset to be provided to the NAS tool for generating an optimal model that provides best performance under the user-specified constraints on that dataset. In this paper, we have utilised the power of NAS using AutoKeras, an open-source tool for performing the model size reduction. AutoKeras is an open-source AutoML system based on the Keras framework33. It provides a simple and effective approach for automatically finding top-performing models for a wide range of predictive modelling tasks, including tabular or structured classification and regression datasets.For a given labelled dataset, neural architecture search (NAS)s represents the input states, and f and The technique of AutoML is best suited for supervised learning applications with comprehensive, labelled datasets. On the other hand, RL frameworks rely on learning underlying rules in a training environment and do not require a labelled dataset. Moreover in the sequence alignment problem, the next pair of sub-sequences to be analysed (once the window is slid) will be decided by the current action predicted by the partially-trained model. Hence, the data is also influenced by the model, and it is therefore difficult to incorporate conventional NAS techniques for model size reduction in EdgeAlign. However, using the conventional deep-Q network presented in the previous section (e.g. model with window size of 50 and approximately 1.36 M parameters), it is possible to replicate the performance of this RL agent with a smaller model generated with AutoKeras. This is achieved by running the sequence alignment model on any given pair of input sequences and saving the intermediate states (window of sub-sequences) separately. Further, the pre-trained network is used to generate a labelled dataset, which consists of predicted actions corresponding to each of these input states. Next, we can feed this generated dataset to the AutoKeras framework for finding an optimal (i.e. reduced size) model architecture with far lesser number of parameters. In theory, this optimal model should be able to replicate the performance of the pre-trained network. This process can be summarised using the following equations:34. The NCBI online tool also provides the BLAST alignment result for a chosen pair of sequences. The objective is to compare the alignment score obtained by the NCBI online tool and EdgeAlign. For fair benchmarking, we analysed the following error metric (E) for a given pair of input sequences:R denotes the alignment score obtained using EdgeAlign, and G denotes the alignment score obtained using the NCBI online tool (ground truth). We evaluate the mean error for the target dataset (N pair of sequences): We evaluated the performance of EdgeAlign on publicly available Influenza sequences at the National Center for Biotechnology Information (NCBI) Virus Data Hubentclass1pt{minima19. During run-time, we first read both sequences from a host computer using an UART port. Next, we invoke the TesorFlow Lite model and perform sequence alignment on the edge device. Finally, we send the list of actions computed by the model back to the host computer via the same UART port. A pySerial  link was setup on the host computer interface to navigate this communication. Presently, TensorFlow Lite for Microcontrollers does not support fixed-point precision. Using 8-bit integer representation resulted in a model of size approximately 100 kB for window size 50. However, as expected the reduction of numeric precision resulted in large errors, with approximately 70% reduction in number of matches found as compared to the pre-trained DQN network. Therefore, it is necessary to use floating-point precision for representing the model, and hence a microcontroller device cannot be used as the edge platform.The reduced size model generated with AutoKeras is suitable for edge deployment. We deployed and evaluated performance of the model with window size of 50 on some representative edge platforms. To evaluate performance on a low-cost embedded platform with very limited resources, we chose the 32F746GDISCOVERY Discovery kit containing the STMicroelectronics Arm Cortex-M7-core-based STM32F746NG microcontroller with 1 MB of Flash memory and 340 kB of RAM. The AutoKeras generated model was exported as a TensorFlow Lite model (.tflite), and converted to a header file (.h) that can be processed by TensorFlow Lite for Microcontrollers framework35, which is an energy-efficient reconfigurable accelerator for deep convolutional neural networks. Such a design allows us to maximise parallelism and data reuse in the convolution operation. This IP was designed and implemented using the Xilinx Vivado HLS tool (version 2021.2), and was integrated with the on-chip MicroBlaze (32-bit RISC soft processor) core using the Xilinx Vivado tool. The reference code and detailed documentation for porting TensorFlow Lite model to MicroBlaze core is available on GitHub36. The corresponding TFLite kernels were also modified to invoke the custom IPs. This resulted in a speed-up factor of 2 X, and inference time of 1 s for 100 MHz clock. While this is considerably slower than the low-cost GPU (NVIDIA Jetson Nano Developer Kit), the ability to deploy sequence alignment algorithms on embedded systems such as microcontrollers and FPGAs presented in this work enables the use of such platforms for low-cost bioinformatics applications. Table 37.We then evaluated the model performance on a more capable embedded system, namely a field programmable gate array (FPGA) device. For this purpose, we chose the Digilent Arty A7-100T, containing Xilinx XC7A35T Artix-7 FPGA. The program instructions and model data are stored in the onboard DDR3 memory, and the block RAM (BRAM) is reserved for implementing custom hardware accelerator IPs. We observed the inference time for predicting a single action with the AutoKeras model of window size 50 to be 2.05 s for 100 MHz clock. The mean error on the FPGA remains same as before since all the computations were performed in floating-precision. To improve the performance, we implemented a CNN-layer accelerator to perform the convolution operation based on the row-stationary approach, inspired by the Eyeriss architecture18, is that none of them are deployed on edge devices, and therefore relevant performance metrics such as inference time (per action) are not reported. The implementation reported by Jafari et al. uses a model with > 33 K parameters15, and Ramchalam et al. reported a model with > 0.19 M parameters17. Model size was not reported for the implementation shown by Joeres et al.18. All these implementations were based on multiple sequence alignment and used SP score (sum-of-pairs) as the alignment scoring metric. The pairwise sequence alignment implementation by Song et al.16 used a model with > 1.38 M parameters, with a simulation based inference timing of 14 ms. The alignment score was evaluated using Exact Matches metric. The EdgeAlign model uses BLAST score as the alignment score, and the model size of approximately 98 k parameters and inference time of 2.32 ms per action  are better than the implementation reported by Song et al.16.A common feature of deep reinforcement learning-based implementations for sequence alignment reported in literatureIn summary, this work presents a method to develop compact deep RL models using AutoML for performing pairwise DNA sequence alignment on embedded edge devices. We has demonstrated a novel method based on AutoML for reducing model size for deep reinforcement learning, while preserving floating-point precision for greater accuracy. The models thus produced have an order of magnitude lesser number of trainable parameters compared to deep RL models designed using conventional DQN architecture, and the use of Keras-RL library further streamlines the design and training process and enables easy debugging of the code. EdgeAlign, the RL-based sequence alignment tool presented in this work, is capable of processing sequences of arbitrary lengths with fixed resource utilisation, albeit with a trade-off in inference time for longer sequences. The performance results for EdgeAlign are benchmarked using the publicly available NCBI Virus Data Hub dataset to evaluate the trade-off between accuracy and throughput. Additional improvements may focus on further optimisation of the reward system and model architecture, to improve inference time and reduce resource utilisation. The window size could also be made adaptable to account for diversity in the input DNA sequences i.e., if the input sequences are less diverse, we could use a shorter window size. This parameter can be adjusted during run-time, based on live performance of the model. The AutoML based model size reduction technique can also be used in various other applications where inference time is a critical specification, such as visual applications including drone navigation, simultaneous localisation and mapping (SLAM), beamforming, etc.