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.Nanopore sequencing , 5 is a 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 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 ).(i)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.Consider in (ii)i1, 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.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 as(iii)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 haveFurther, 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 set(i)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 asBreakpoint 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 (ii)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 is3In 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 Supplement 1


Global alignment of complex pseudotime trajectories between different single-cell RNA-seq datasets is challenging, as existing tools mainly focus on linear alignment of single-cell trajectories. Here we present CAPITAL , a method for comparing single-cell trajectories with tree alignment whereby branching trajectories can be automatically compared. Computational tests on synthetic datasets and authentic bone marrow cells datasets indicate that CAPITAL has achieved accurate and robust alignments of trajectory trees, revealing various gene expression dynamics including gene–gene correlation conservation between different species. Global alignment of complex cell state trajectories between single-cell datasets remains challenging. Here, the authors present a computational method called CAPITAL to compare branching trajectories, and demonstrate that this method achieves accurate and robust alignments. Since tracing a gene expression level of the same cell over some period of time is infeasible, cell-state transition trajectory or a pseudotime trajectory5. The predictable topology of trajectories depends on the method of choice, ranging from a simple linear structure to a tree with branches, and even a complex cycle6. A comprehensive comparison among existing trajectory inference tools was also provided to make an exhaustive investigation into their performance7.To model dynamic developmental processes for a given scRNA-seq dataset, various computational tools were developed to predict a Comparison of pseudotime trajectories will provide a key to unveiling regulators that determine cell fates. For instance, trajectory comparison is used to investigate differences in gene expression dynamics between species (e.g. human vs. mouse), which will unravel evolutionary conservation and difference in the determination of cell fates such as regulation timing for an orthologous gene.9. They aim to align two single lineages across datasets with dynamic time warping10, which is an analogy to a classical problem of pairwise sequence alignment, but differs in that multiple cells in one dataset may be matched with one cell in the counterpart at a time point. It remains, however, an unsettled question how one should select a pair of single lineages to be compared if the pseudotime trajectories include branches in each dataset, as the above methods based on dynamic time warping can deal only with linear trajectories for comparison. Furthermore, selecting a pair of trajectories to be compared requires accurate downstream analysis of a single-cell dataset and prior knowledge of a developmental pathway. Although one can consider inferring a common trajectory after integrating different scRNA-seq datasets13, trajectory inference in this case could yield unexpected results since there is a possibility of merging cells that are not closely related.Recently, computational methods for aligning pseudotime trajectories across different datasets have been proposedIn this work, we present a computational method for comparative analysis of pseudotime trajectory inference with tree alignment (CAPITAL). The aim of this work is to provide a method for aligning different scRNA-seq datasets even if their pseudotime trajectories include branches, so that one does not need to select linear paths in the trajectories to be compared beforehand. In the proposed algorithm, when a pair of different but related scRNA-seq datasets is given, CAPITAL seeks to infer a pseudotime trajectory that can include multiple branches for each dataset, and then to compute an optimal alignment between the two trajectories. Thorough computational tests on CAPITAL with synthetic scRNA-seq datasets in comparison with several state-of-the-art methods for data integration indicate that CAPITAL has achieved accurate and robust alignments of trajectory trees. Next, a test with public scRNA-seq datasets of human bone marrow cells shows that CAPITAL was able to detect correct linear trajectories to be compared without manual selection. A further test with human and mouse bone marrow cells datasets tells us that CAPITAL was able to reveal not only similar expression patterns that seemed to be conserved but different molecular patterns between human and mouse, which would provide a key to unraveling novel regulators that determine cell fates.14, and the representative cell in each cluster is defined as a virtual cell with the median measured in the reduced dimensional space, which is called a centroid. Respective trajectories are computed by finding the minimum spanning trees in the centroid-based graphs. Tree alignment of the centroids across different datasets is performed by a dynamic programming algorithm (“Methods”).Taking a pair of expression count matrices from two different scRNA-seq datasets as input, these matrices are preprocessed to construct their respective nearest neighbor graphs by using principal components derived from highly variable genes Fig. a. The ne2. Linear alignment of these single cells is then performed by a dynamic time warping algorithm for a set of genes of interest.Choosing a pair of aligned single lineages comprising the centroids according to the resulting tree alignment, the centroids in each dataset are decomposed into their original single cells. Next, each of the starting single cells in the aligned root cluster :CAPITAL has an assumption that it can deal with a pair of single-cell trajectories with any number of branches (i.e. trees), but not cycles and disconnected graphs. Note that any pair of input trajectory trees can be accepted regardless of how similar they are in theory, but the comparison of datasets from completely different cell populations that are expected to have trajectories with different shapes is not relevant in practice.15 with the backbone as a binary tree with three branches, which consist of 68 datasets of single-cell expression counts to be extended to more datasets for benchmarking alignments (“Methods”). In the first test to show the effect of global topological similarity between two datasets, the algorithm worked from the viewpoint of the normalized alignment distance (“Methods”) even when minor changes were made to one of the trajectory trees to be aligned   the topology of the trajectories to be compared; (ii) the difference in the number of clusters across two datasets; and (iii) the total number of clusters in two datasets. The synthetic datasets used in these tests were generated by dyngentc) Fig. a. In contc) Fig. b. The thtc) Fig. c. Note tSecond, we tested the robustness of CAPITAL measured by alignment accuracy on the synthetic datasets with increasing data noise (“Methods”). More precisely, we evaluated the alignment accuracy from two measures: (i) the normalized alignment distance for assessing the performance of cluster–cluster alignment; and (ii) the average trajectory conservation (ATC) score at the single-cell level (“Methods”). The rate of change in the normalized alignment distance was higher for the noise level of at least 2.0 than at most 1.5 Fig. a, and th12, scVI11, and Seurat13 on the combinations of the synthetic datasets to merge two respective datasets and perform common trajectory inference on that merged dataset. Note that pseudotime was computed for a trajectory tree of aligned and integrated datasets in CAPITAL and the other tools, respectively. We will show the superiority of one method over its competitors from two viewpoints: biological variance conservation and batch removal before and after alignment/integration16. First, the results measured by the ATC score as a metric of biological variance conservation indicate that CAPITAL was statistically significantly better than the data integration approaches   Fig. c. For va2, and computed the matchings between cells along the orderings with dynamic time warping  and end with respective leaves with cell-type annotations from the aligned trajectory tree Fig. c, we recing Fig. d. Of noting Fig. , which i19. We selected this pair of the datasets because the number of cells compared with the counterpart was more balanced than the pair with Setty et al.’s human data  that are computed from input datasets. Indeed, complex trajectories beyond tree such as cycle and disconnected graph will appear in transdifferentiation. Hence, a predictive model that can deal with a graph beyond tree23 along with graph alignment24 will be required to further develop techniques for complex comparative pseudotime analysis.We acknowledge that there are a few limitations in our study. First, part of the CAPITAL algorithm for computing a trajectory as a minimum spanning tree may not be the best method. However, we remind that the core part of CAPITAL is to align cell-state transition trajectory trees. In this sense, trajectory trees predicted by any method can readily be incorporated into CAPITAL, meaning that it can employ a state-of-the-art or even a future tool with higher predictive performance. Second, alignment accuracy of CAPITAL for datasets with different global topological structure degraded in our benchmarking test. To resolve this issue, designing an algorithm based on local tree alignment or tree inclusionCAPITAL’s framework can be applied to not only pseudotemporal data but also spatial and epigenetic data. Given that scRNA-seq techniques have prevailed in current research in cell biology, and increasing attention has been paid to the comparative analysis of cellular processes with different conditions or species, we envision that CAPITAL will contribute to the advancement of comparative single-cell omics.m genes across n cells, where j ≤ n) is the logarithm of a normalized count vector of cell j with respect to genes 1, …, m. Note that log transform is performed with one pseudocount, and the genes are often assumed to be highly variable in expression over all cells. To reduce the dimensionality of the data, principal component analysis (PCA) is performed on X, resulting in p( ≪ m) is the number of principal components that contribute to the total variance in the data. A weighted graph is constructed in a way that each vertex represents a cell, and each edge connecting two cells i and j has a weight calculated by the Euclidian distance ∣∣zi − zj∣∣ between the two cells. From this graph, a k-nearest neighbor (k-NN) graph can be built on the basis of the distance assigned to each edge, as it can better capture phenotypic relatedness25. Clustering vertices in the k-NN graph is then performed by a community detection method such as the Leiden algorithm14.Let k-NN graph structure simple, a cluster centroid is defined as the virtual cell with the medians of p principal components derived from those of the cells belonging to that cluster. A minimum spanning tree in this centroid graph is then computed with Kruskal’s algorithm. If one chooses one of the centroids as the root of the tree, the resulting rooted minimum spanning tree can be regarded as a pseudotime trajectory of the clusters. Of note, actual pseudotime of each single cell along a path in the tree will be estimated later.To make the T =  be an unordered labeled rooted tree, where V and E  and E(T)) are a set of nodes (vertices) and that of edges of the tree, respectively, and the children of each node are regarded as a set. The number of nodes in tree T is represented as ∣T∣. Let θ be the empty tree, and let T(i) be the subtree of T induced by node i and all of its descendants. If node i has children i1, …, iμ, i.e. the degree of node i is μ, we define F(i) = F as the forest comprising subtrees T(i1), …, T(iμ).Let w as a child of node v ∈ V(T) makes w be the parent of a consecutive subset of the children of node v. An alignment of unordered labeled trees T1 and T2 is obtained by inserting nodes labeled with spaces# into T1 and/or T2 so that the two trees are isomorphic if the labels are ignored, and then by overlaying the resulting trees. This means that # is regarded as the empty node. Let # = Σ ∪ {#}. We often extend this notation to nodes so that γ means i, j ∈ V(T). For scRNA-seq data analysis, we define the cost function asxi, xj) returns Spearman’s rank correlation coefficient between expression levels xi and xj of cells i and j, respectively, and δ is some constant. In all computational tests in this study, we set δ = 1.Inserting node optimal alignment of T1 and T2 is an alignment with the minimum cost, which is called the optimal alignment distance between T1 and T2, denoted by D. This notion can be extended to two forests F1 and F2, denoted by D.The cost of the alignment is defined as the sum of the costs of all paired labels in the alignment. An 26. However, aligning unordered trees with “bounded” degrees can be solved in polynomial time. In what follows, we will summarize the dynamic programming (DP) algorithm for calculating the optimal alignment distance between unordered trees with bounded degrees presented in the literature26.The problem of computing an optimal alignment distance between general unordered trees is MAX SNP-hardμ and ν are degrees of nodes i ∈ V(T1) and j ∈ V(T2), respectively.The initial settings for handling the empty tree during the DP calculation are defined as follows:i, j) is in the alignment; (ii)  and  for some child of node i are in the alignment; and (iii)  and  for some child of node j are in the alignment  and T2(j) need to be considered, we define subsets of the forests denoted by p ≤ μ and 1 ≤ q ≤ ν . The pseudocode for running the tree alignment algorithm is described in Supplementary Note Finally, we focus on how to compute an optimal alignment distance Equation . Since aentclass1pt{minima2.Having been obtained from a trajectory alignment between two datasets, a pair of aligned paths is arbitrarily chosen, and all single cells in the clusters are to be processed in each dataset. Note that the starting cell in the first cluster on the aligned path has to be determined for the subsequent pseudotime ordering in a way that it has the longest distance to a cell among all other cells in the corresponding dataset in the expression space. A diffusion pseudotime in each dataset is then calculated by taking into consideration an accumulated transition matrix for all cells with respect to the path based on a random walk on the nearest neighbor graph10.Dynamic time warping is an algorithm for measuring similarity between temporal sequences. Briefly, given two time series, the algorithm aims to find the best matching between the two sequences by stretching or compressing elements of the sequences. For optimization, the distance between two elements across the sequences measured on the basis of time warping functions is summed over all elements, which is then to be minimized by dynamic programming. Details of the algorithm can be found in the literatureM and U be the number of matched cluster pairs and that of unmatched cluster pairs, respectively, in an aligned trajectory tree. The optimal alignment distance D for trajectory trees T1 and T2 can be decomposed into the sum of the distances for the matched cluster pairs and that for the unmatched cluster pairs, i.e. D = dM + dU. The normalized alignment distance is then defined byα(0 < α < 1) is a balancing parameter between the contribution of the matched clusters and that of the unmatched ones. Note that weight α for the per-node distance of the matched cluster pairs should be higher than 1−α for that of the unmatched cluster pairs because 0 < dM/(M + 1) ≤ dU/(U + 1) < dU/U = U/U = 1 holds asymptotically when cost γ is determined by comparing matching cost 1 − corr with gap penalty δ = 1 as defined above. Namely, the latter penalty term in the normalized alignment distance needs to be smaller than the former essential term of the alignment distance for the matched clusters. We set α = 0.9 in the tests in feasibility and robustness of CAPITAL , and thus the mean of the two respective correlation coefficients between the series of simulation times and either series of pseudotimes should be taken. Each Spearman’s rank correlation coefficient ρ computed above is scaled to the range  by (ρ + 1)/2, which we call a trajectory conservation score of a single lineage. Finally, the ATC score of the aligned trajectory tree is defined as the mean of the trajectory conservation scores of all single lineages. A high ATC score is considered to be an accurate alignment in trajectory conservation.We define a parameter-free metric on an aligned trajectory tree of two scRNA-seq datasets to evaluate biological variation conservation before and after alignment, which is called an average trajectory conservation (ATC) score. Trajectory conservation was originally defined in the literature15. In this step, 36 transcription factors were generated, and 250 target genes and 250 housekeeping genes were sampled. Second, simulating kinetics, a gold standard, and cells 120 times resulted in 120 different datasets of single-cell expression count matrices. Finally, these 120 datasets were filtered in such a way that the number of leaves in a minimum spanning tree based on the clustering results is exactly four, as expected in the simulation, which leads to 68 synthetic datasets of expression count matrices. For benchmarking CAPITAL’s performance, each dataset was randomly split into two disjoint count matrices 100 times, resulting in 68 × 100 = 6800 pairs of count matrices to be tested.First, a gene regulatory network with the backbone as a binary tree with three branches for 1000 cells was generated by dyngen 1.0.3Gaussian noise was independently added 100 times to each of the 6800 pairs of the log transformed count matrices obtained above, where the parameters of the distribution were set to zero mean and increasing standard deviation from 0 to 5.0 by step size 0.5, followed by adding a larger step size to reach 50.0 standard deviation. Note that the alignments of the 6800 pairs without noise (i.e. zero mean and zero standard deviation) can be regarded as the true alignments, and thus comparison between the true alignment and the predicted alignment on the data with noise makes sense. To summarize, 6800 × 14 = 95,200 pairs were used in the test for robustness Fig. .12 and scVI 0.16.011 as wrapper functions of single-cell integration benchmark (scib 1.0.3)16, and Seurat 4.1.113 to infer a common trajectory of each of all 2278 pairs of the 68 synthetic datasets described above. Of note, we used synthetic datasets for the comparison, as real datasets do not have shared ground truth to validate trajectory alignments. All pairs of the datasets in the form of either raw counts or preprocessed counts were integrated by the respective algorithms. A common trajectory was then estimated by finding a minimum spanning tree whose nodes were centroids as defined in the CAPITAL algorithm, which was considered as an aligned trajectory tree. Note that the same methods and the parameters as in CAPITAL were used to compute neighborhood graphs, Leiden clustering, and diffusion pseudotime.To compare the performance of other methods for integrating scRNA-seq datasets, we used Scanorama 1.7.027. In what follows, we will describe how to adapt all datasets to the subsequent trajectory comparison.Before aligning different scRNA-seq datasets, each may need to be preprocessed due to noise such as outlier cells included in the original data. All real datasets used in this work were filtered in advance by keeping cells with at least 200 genes expressed and genes that were expressed in at least three cells, which were performed with Scanpy 1.9.1In each synthetic dataset, the top 200 highly variable genes were used to obtain 50 principal components, from which a 10-NN graph was built for cell clustering and trajectory inference. Note that these settings were common to the tests on all tools.https://github.com/dpeerlab/Palantir. More precisely, the Scanpy AnnData object27 of replicate 1 with 5780 cells, which was generated in the existing study17, was used to preprocess in our downstream analysis. MAGIC28 for denoising and imputation was applied to the logarithmic normalized counts. From the resulting count matrix, 50 principal components derived from the top 2000 highly variable genes were used to construct a 40-NN graph, leading to clusters and a trajectory tree . Note that these data were normalized with posterior odds ratio18 and included negative values due to its definition. After the common filtering of outlier cells and genes described above, cells were further removed as they still had too many genes or too many total counts. Specifically, cells with m genes and c total normalized counts were retained such that 4600 < m < 5750 and −2000 < c < 1500, leading to 915 cells. MAGIC was applied to the resulting count matrix, min-max scaling was performed so that each element in the matrix was non-negative, and the elements were log transformed with one pseudocount. The top 250 highly variable genes were used to derive 50 principal components, which was used to build a 6-NN graph. Community detection and trajectory inference on this graph yielded the results shown in Fig. A normalized filtered single-cell count dataset of 1034 human bone marrow cells  was downloaded from Gene Expression Omnibus (GSE75478 [19 was obtained from one of the datasets accessible when running Scanpy27. This dataset was first preprocessed according to Scanpy’s tutorial with Zheng et al.’s preprocessing recipe29. It is to be noted that this preprocessing contained dimensionality reduction with diffusion map. A coarse-grained PAGA graph5 derived from the Louvain clustering of the preprocessed data had two disconnected outlier clusters, which were removed to have 2671 cells in our demonstration so that CAPITAL can deal with them. To perform further denoising, MAGIC was used on the above count matrix with each element normalized and log transformed. 50 principal components computed from the top 500 highly variable genes were used to construct a 10-NN graph, on which clustering with annotation and trajectory inference were carried out (Fig. 19.A single-cell dataset of mouse bone marrow cellsout Fig. b. Some oout Fig. a. Cluste27, which was set to 1.0 in this study. It should be noted that those genes were independently selected per branch in the aligned tree. Second, similarity scores for the kinetics of the respective genes in the linear alignments were computed via dynamic time warping. The genes were then split into three groups by considering their inclination of linear regression lines so that both kinetics curves sloped up, one curve sloped up but the other down, and vice versa. Finally, the genes in each group were filtered by set difference to identify potential cell type-specific genes (Supplementary Figs. First, in the aligned tree for Velten et al.’s data and Paul et al.’s data Fig. b, highlyNo statistical method was used to predetermine sample size. Some outlier cells in isolated clusters in the original public data were excluded according to pre-established criteria. The experiments were not randomized. The Investigators were not blinded to allocation during experiments and outcome assessment.Further information on research design is available in the Supplementary InformationPeer Review FileReporting Summary


Advances in the next-generation sequencing technology have led to a dramatic decrease in read-generation cost and an increase in read output. Reconstruction of short DNA sequence reads generated by next-generation sequencing requires a read alignment method that reconstructs a reference genome. In addition, it is essential to analyze the results of read alignments for a biologically meaningful inference. However, read alignment from vast amounts of genomic data from various organisms is challenging in that it involves repeated automatic and manual analysis steps. We, here, devised cPlot software for read alignment of nucleotide sequences, with automated read alignment and position analysis, which allows visual assessment of the analysis results by the user. cPlot compares sequence similarity of reads by performing multiple read alignments, with FASTA format files as the input. This application provides a web-based interface for the user for facile implementation, without the need for a dedicated computing environment. cPlot identifies the location and order of the sequencing reads by comparing the sequence to a genetically close reference sequence in a way that is effective for visualizing the assembly of short reads generated by NGS and rapid gene map construction. With the advances in next-generation sequencing (NGS) technology, biologists have laid a quantitative framework for conducting genome research by accumulating vast amounts of genomic data from various organisms in text form. However, the assembly of sequences generated by NGS requires a large computation effort focused on comparing very short DNA sequences. Further, performing read alignment using traditional dynamic programming-based read alignment algorithms is difficult. Thus, various read alignment methods based on seed extension, hash, and suffix trees have been proposed.k-mer-sized sequence from a reference sequence [k-mer in the query sequence. Of note, the existing short-read alignment methods involve a tedious manual comparison [Examples of the currently used alignment programs include MAQ , Stampy sequence . Thereinsequence  and MHAPsequence  were promparison  of resulmparison .https://datalab.dongguk.edu/cPlot, accessed on 18 August 2022.Most short-read alignment studies ,8,9 of vThe performance of cPlot was verified to ensure accurate read alignment of a single reference sequence and multiple query sequences, and to check optimal alignment of small, scattered read fragments. To achieve this, first, the query sequences  and the original reference sequence were aligned. This enabled verification of whether an accurate alignment of sequences that are almost identical is possible in cPlot. Next, the reads of the aligned small fragments were optimally aligned to determine whether they could be reassembled into the same sequence as the reference sequence. Finally, the results were compared with those obtained using another algorithm. Details of the analysis are presented below.k-mer size is required for improved alignment results from contig plotting. With a dataset where the reference sequence is almost identical to the query sequence, similar alignments can be obtained regardless of the k-mer value, and the higher the k-mer value, the shorter the alignment time. By contrast, in a dataset in which the reference sequence and the query sequence are dissimilar, an optimal k-mer size should be determined to achieve a relatively short alignment time and high-similarity alignment. In general, it is difficult to determine the degree of similarity between a reference sequence and a query sequence. For the analyzed dataset  to be printed in contig plotting. The value must be greater than or equal to the k-mer value; a greater value removes the generated default reads.The following input configurations are accounted for in cPlot: the input file, parameter, output file type, and display. cPlot uses FASTA format files  that include multiple reads to compare sequence similarity. The user must upload one reference sequence file and at least one multiple-query sequence file as the “input file” in a system configured within a web environment. “Options” directly affects contig plotting. The options include k-mer size that can be combined into longer reads are merged, and the final aligned reads of k-mer size are displayed on the screen. To obtain all sortable reads in the two sequence directions (5′ → 3′ and 3′ → 5′), cPlot performs read alignment by generating a general query sequence in the 5′ → 3′ direction and a reverse complemented query sequence in the 3′ → 5′ direction, based on the single/multiple query sequence input. In After specifying the input sequence file and user-defined options , cPlot ik-mer size, including specific nucleotide sequences, such as repetitive sequences. We expect that cPlot will enable biologists to facilitate studies that require short sequence readouts and alignment to novel genomes.Identification of the location and order of the sequencing reads by comparing the sequence to a reference sequence is an effective approach for the assembly of short reads generated by NGS and rapid gene map construction. Many alignment algorithms have been developed, but most of them focus on sequence region matching or alignment. cPlot, the software developed in the current study, is a visual tool for read sequence alignment that allows efficient evaluation of repeat analyses by performing index-based read alignment. Further, cPlot provides a web-based environment for basic read alignment that reflects the optimal region and query sequence rearrangements for all reads of a specified


By benchmarking exhaustive experiments on both simulated and real-life SMS datasets to assess the performance of kngMap with ten other popular SMS mapping tools , we demonstrated that kngMap has higher sensitivity that can align more reads and bases to the reference genome; meanwhile, kngMap can produce consecutive alignments for the whole read and span different categories of SVs in the reads. kngMap is implemented in C++ and supports multi-threading; the source code of kngMap can be downloaded for free at: https://github.com/zhang134/kngMap for academic usage.With the rapid development of single molecular sequencing (SMS) technologies such as PacBio single-molecule real-time and Oxford Nanopore sequencing, the output read length is continuously increasing, which has dramatical potentials on cutting-edge genomic applications. Mapping these reads to a reference genome is often the most fundamental and computing-intensive step for downstream analysis. However, these long reads contain higher sequencing errors and could more frequently span the breakpoints of structural variants (SVs) than those of shorter reads, leading to many unaligned reads or reads that are partially aligned for most state-of-the-art mappers. As a result, these methods usually focus on producing local mapping results for the query read rather than obtaining the whole end-to-end alignment. We introduce kngMap, a novel  Compareanalysis .Read mapping is to find the possible genomic origins of reads by aligning them against a reference genome. It has become one of the most basic and computing-intensive step in downstream pipelines for SMS dataset analysis . Howeverk-mers  of query reads to the reference genome; then, the candidate regions  for aligning in the query read and the reference genome are chosen based on the seeds. Finally, the local subsequences surrounding the seeds are base-to-base aligned to compose the final read alignment with the seeds. Based on the index technique of seed searching, SMS mappers can be categorized into three groups: Burrows–Wheeler Transform full-text minute-space (BWT-FM) index-based , a novel long-read mapping algorithm which is specifically designed to improve mapping sensitivity and deal with SV events. Overall, kngMap works in four main stages. It initially constructs a searching index for the reference genome to quickly find matched k-mers for query reads. Such matches are then used to construct a k-mer d-neighborhood graph where matched k-mers are viewed as vertices and each pair of matched k-mers is connected by a direct edge. Third, a high quality of alignment skeleton is identified by designing a chaining approach. At the end, each unaligned gap in the alignment skeleton is classified into several categories of SV events and filled with a specific alignment method according to its category. The whole read alignment is accomplished by integrating the skeletons and the alignments of the gaps. We benchmarked kngMap on simulated dataset reads with different types of SVs and real-life datasets generated from PacBio SMRT and Oxford Nanopore platforms. The experimental results demonstrated that kngMap has superior ability in terms of base-level sensitivity and end-to-end alignment, which can produce consecutive alignments for the whole read; meanwhile, it can deal with different categories of SVs in the reads.To address the aforementioned issues, in this study, we propose a k-mers for a query read k-mer d-neighborhood graph where matched k-mers are viewed as vertices and each pair of matched k-mers is connected by a direct edge based on the positions in genome and the query read k-mers in the alignment skeleton into several categories of SV events and handling each of them with a specific alignment method according to its category The main motivation of kngMap is to efficiently improve mapping sensitivity and simultaneously have a superior ability of dealing with SVs for long reads generated by SMS sequencing technologies. The underlying design principle is to effectively find one high-quality alignment skeleton in the reference genome for each read, even though the read contains SVs and more sequencing errors, before the costly procedure of base-to-base alignment to the reference genome. An overview of the kngMap algorithm is depicted in k-mer (subsequence with length of k) in the reference genome, a lookup index for the reference genome is usually needed to be built. Currently, two superior index techniques, BWT-FM index . In other words, x − k + 1, x] on the reference matches the interval  on the query exactly.KngMap extracts all ferences ] of the d-neighborhood anchor graph is formed according to the list of anchors ordered by their positions on the reference genome and then on the read. In this graph, each anchor is viewed as nodes; two nodes (Vi → Vj) are connected with a direct edge if the pair of vertices meets the following condition:i in the reference genome, j in the query read, and d is a constraint parameter which is applied to model the maximum distance between two anchors in the alignment for a read. The edge direct (from Vi to Vj) denotes that Vi is the ancestor  node of Vj. The setting of parameter d is motivated by the fact that, given a certain error rate, the distance between two anchors on the read can be modeled by a geometric distribution  with the highest score among all nodes is regarded as the ending node. As a result, the path from Vend to a starting node (Vstart backtracking from Vend to a node without precursor) formulates the initial alignment skeleton.KngMap finds the optimal path connecting from From l is the constraint length parameter ), which guarantees that the increased score is calculated in a fixed window length in the path. This setting is motivated by observing that the anchors of a read alignment are fallen in the region with a length of l, which is found by the statistics based on the alignment results  partitions the read and the reference into eight paired segments. Each pair of unaligned segments, that is, , i = 1, 2, 3, 4, 5, 6, 7, will be categorized into one of the following conditions, which carefully take the SV into consideration according to the length of segments.With the refined skeleton of alignment, the numbers of pairs of unaligned segments can be directly partitioned by the anchors, which is shown in 1) Match case: 2) Deletion case: 3) Insertion case: SRi and SGi are the paired partitioned subsequence in the read and genome, respectively, SRi, SGi, and Here, atistics . A schemSRj) and the reference genome segment (SGj) to fill the gap; an example of dealing with this match case is also provided in SRj; moreover, we do not know if the SV position exists. In order to effectively deal with such cases, a semi-global alignment is performed, which is beneficial for handling multiple breakpoints within SGj. For the example in SRj; the semi-global alignment can effectively recognize them since it can find the most similar regions in SGj for SRj. In the implementation of the semi-global alignment, the genome segment (SGj) was chosen to be the target sequence and read segment (SRj) to be the query sequence as the alignment gaps at the query start and end are not penalized. Similarly, for an insertion case  was chosen to be the target sequence and genome segment (SGj) to be the query sequence in the implementation of the semi-global alignment.KngMap then fills the paired segments within the skeletons to solve the breakpoints of SVs and generate valid alignments for the whole read. Each of the gaps is filled by one of the following strategies according to its category. For the match case, as shown in ion case , there ik-mers. For the outer boundaries of the refined skeleton, that is, the two pairs of unsigned segments at the starts and ends of the skeletons as shown in SRend as the query sequence and the SGend (with two times length than SRend) as the target sequence. Then, the modified global alignment  is performed for SRend and SGend; the modified global alignment can find out how well SRend fits at the beginning of SGend. A toy example of it is illustrated in All the operations mentioned previously fill the inner gaps of the skeleton, which are anchored by two matched Algorithm 1kngMap Algorithm.The performance of kngMap was evaluated against 10 state-of-the-art long read aligners: BLASR (v) , minimapIt is to be noted that with the rapid development of SMS sequencing technology, more than 99% of the raw sequencing data produced by the SMS sequencing platform has a read length of 1,000 bp or longer . Herein,H. sapiens (CHM1) genome sequences were downloaded from NCBI (assembly accession: GCA_000306695.2) and fed into PBSIM2 software using default error parameters . As a result, 100,000 simulated sequences with an average read length of 10,157 bp were generated by PBSIM2. The detailed running commands of PBSIM2 and some statistics of simulated datasets can be found in We first adopted the simulated sequence datasets without structural variations (SVs) to evaluate the performance of kngMap algorithm against the aforementioned mapping methods. The simulated datasets were generated by PBSIM2 , a new sr is called CMR if this read is aligned to the derived genome with the correct strand, and the overlap between the aligned subsequence on the reference and the true mapping subsequence has at least p bases (p = 0.9 × len(r), where len(r) is the read length of r). A base is called CMB if it is located within T bp (here T = 5) of the corresponding truth position on the genome. We further compared the aligned coverage  to assess the alignment for different methods. A method with higher aligned coverage means that it can align more bases to the reference genome for a read. In addition, base-level sensitivity and precision  and correctly mapped bases (CMBs) were applied to investigate the overall quality of the alignments. A read recision  are usedBased on the aforementioned metric definition, Importantly, kngMap achieved 100% aligned coverage, demonstrating that all mapped reads by kngMap are completely aligned, while the alignment by other aligners cannot cover the whole sequence, which means that these methods always output local mapping results and cannot obtain the end-to-end alignment for the whole read. After checking the details of the alignments, soft clipping at the starting or ending of sequences is usually produced by other methods. These results in aligned coverage explain that kngMap has a higher base-level sensitivity. This 100 percent coverage achieved by kngMap is beneficial for SMRT data analysis since higher aligned coverage is a key requirement for mapping tools and downstream mapping-based applications .S9_46798.txt) reports the alignment result for one simulated read with a length of 6,692 bp; the mapped alignment identity obtained by kngMap is 90.74%, while the simulated identity generated by PBSIM2 is 87.50%, which is lower than the similarity produced by kngMap. Therefore, this further indicates that kngMap can find the most similar mapped region in the reference sequence for each query read.In addition, we inspected the reads of the simulated human dataset which were incorrectly aligned by kngMap and found that 255 (88.29%) of the reads have a higher similarity than the original similarity simulated by the PBSIM2. To give an example, For assessing the ability of handling SVs for different methods, a simulated sequence dataset with different types of SVs was generated. Specifically, 16 SVs  with different sizes were first added into the reference chr1 (chromosome 1 of CHM1) genome by the RSVSim  simulatoHere, we provide the number of mapped reads that span SVs (#SVs) to evaluate the performance of different mapping tools. For one mapped read, if the start and end alignment coordinates in the genome cover the actual simulated breakpoints, we consider this read spanning SVs. Specifically, each of the breakpoints described by the ground truth in the genome can be denoted as a tuple: With the ground truth breakpoints and the mapped coordinates obtained by a mapping tool, we can assess the number of ground truth breakpoints being recovered. For a certain read, a ground truth breakpoint, Finally, the number of ground truth breakpoints being recovered from our kngMap and other seven mapping programs is listed in A. thaliana, E. coli UTI89, and H. sapiens (CHM1) were used to benchmark kngMap against other methods on real sequencing data. Among these datasets, A. thaliana and H. sapiens (CHM1) were generated from the PacBio SMRT platform, and E. coli UTI89 was generated from the Oxford Nanopore MinION sequencer. The availability of these datasets and their reference genomes are provided in In this experiment, three datasets (generating from PacBio SMRT and Oxford Nanopore platforms) of A. thaliana dataset. Obviously, it can be seen that kngMap mapped the most reads and aligned the most bases, that is, kngMap mapped 21,182 reads and 185,924,663 bases, improving sensitivity by 3.5% and 4.3% over the closest competitor (lordFAST) in terms of mapped reads and mapped bases, respectively, and even more compared with other tools. For the matched bases and alignment score, kngMap still performed the best; more precisely, kngMap reports a 6.02 million higher number of matched bases and 4.32 million higher alignment score compared to the best runner-up . These results indicate that kngMap can not only provide more sensitive alignments in read-level and base-level sensitivity than other mappers but also achieved the best quality of the alignments. Similar results (E. coli UTI89 and H. sapiens) as well.First, the number of mapped reads, the number of mapped bases, the number of matched bases, and the alignment score are used to evaluate the performance of different mapping methods. The number of mapped reads (read-level) and bases (base-level) are two important metrics to evaluate mapping sensitivity for long read alignment since it could still be lack of information for downstream analysis if reads are unmapped or only partially aligned . The num results  were repci  proportion of the whole read. If one alignment covers more than ci of the read, the alignment is defined as the consecutive alignment at threshold ci. E. coli and H. sapiens. The consecutive results in Next, we investigated the consecutive alignments, which can reflect the details of the alignments . To compx1 and x2 are two alignment results obtained by two mapping methods for a query read, we define that x1 has an agreement with x2 if and only if the mapped region on the reference genome covered by x1 overlaps with at least 90% of the mapped region on the reference genome covered by x2. A. thaliana dataset are shown in E. coli and H. sapiens datasets, respectively. We can see that the mapping results of kngMap have a high coverage of the alignments obtained by other mapping methods.Furthermore, the agreement between different methods based on their alignment results was measured. Supposing that alignments E. coli and H. sapiens reads is provided in Finally, we compared the performance of the tools on reads for which their alignments do not agree. The number of disagreeing alignments and average identity difference between the two methods for the inconsistent alignments are listed in k-mers are found as seeds in one read and in the reference sequence. Then, a group of seeds that are colinear or close to each other is chained as the candidate alignment skeleton. Finally, the non-seed fragments within the alignment skeleton are being extended to generate the base-level alignment. In the stage of generating the alignment skeleton, these methods are usually difficult to capture the matches with long distance, especially for the read parts with SVs and high sequencing errors since that there are few or no matched k-mers in the parts. Thus, most methods failed to generate the alignment skeleton of the query read or just build an alignment skeleton that covers a small part of the read. As a result, these methods cannot obtain the alignment result or just report a local mapping result for the query read, other than obtaining the whole end-to-end alignment, leading to low mapping sensitivity and aligned coverage.For SMS read mapping, the seed-chain-align procedure , as is uTo address the aforementioned challenge, here, we developed kngMap to increase the mapping sensitivity and with 100% aligned coverage for long noisy alignment. kngMap is also a seed-chain-align method using the hashing index technique, compared with other methods. There are three main key features of kngMap: 1) kngMap proposes a scoring strategy in the chaining procedure to choose a group of anchors to form the initial alignment skeleton for each read, even in the situation that the read contains SVs or some regions that matched seeds are dispersedly distributed caused by high sequencing errors; 2) defining an increased credibility function to refine the alignment skeleton, and then a high quality of alignment skeleton is subsequently obtained; and 3) for each of the gaps within the skeleton, kngMap classifies it into one of three categories and implements a specific alignment strategy to fill the corresponding gaps. The scoring strategy and increased credibility function ensures that kngMap can effectively find the alignment skeleton for every query read, even in the situation that the matched seeds are dispersedly distributed in the reference genome. Thus, kngMap can obtain higher mapping sensitivity, that is, align more reads and bases. The last feature can guarantee that the whole end-to-end alignment is obtained, not local alignment achieved by other methods. Therefore, the aligned coverage of kngMap is higher than that of other methods. In addition, in order to further evaluate the performance of the kngMap for a higher error rate up to ∼15%, we applied the PBSIM2 simulator to generate another two simulated datasets with 20% (parameter: --accuracy-mean 20) and 25% (parameter: --accuracy-mean 25) error rates; the other parameter settings are similar to those given in k-mers of the reference genome sequences to build the hash table index; thus, the maximum complexity is in the order of O(G), where G is the length of the genome sequences. 2) In the phase of generating k-mer d-neighborhood graph, it needs to retrieve all the matches of the k-mers for each query read, so the maximum complexity is O(N*L), where N is the number of reads, and L is the average read length. 3) In the phase of generating the skeleton of alignment, it needs to recurrently calculate the score of each node, so the maximum complexity is O(N*M), where M is the average number of matched k-mers for all reads. 4) In the phase of filling the gaps between anchors, it needs to obtain the detailed base-to-base alignment, so the maximum complexity is O(K*Q2), where K is the average number of gaps, Q is the average length of gaps, and Q<<L. In summary, the total complexity for kngMap is O(G+N*L+N*M+K*Q2). Since Q<<L, kngMap has a time complexity of the order of G and L. In order to graphically evaluate the computational efficiency of our kngMap, we compared kngMap with other mapping tools on the real H. sapiens datasets. The massive amount of long noisy read data produced by SMS technologies brings some challenges to existing mapping approaches. In addition to accuracy, computational complexity is another important issue that needs to be considered. The time complexity of kngMap has four main components: 1) In the phase of constructing the reference genome index, it needs to extract all Since the infancy of SMS technologies  that produce longer but higher sequencing error reads, mapping these reads to a reference genome is often the most basic and computing-expensive step for downstream genome sequence analysis. Developing novel long read mapping tools is on demand for improving the mapping sensitivity and effectiveness of SMS read alignment.In this study, we present kngMap, a new, fast, and highly sensitive mapping algorithm for long noisy reads. Mainly, kngMap contains three key characteristics: 1) kngMap proposes a scoring strategy in the chaining procedure to choose a group of anchors to form the initial alignment skeleton for each read. 2) kngMap designs an increased credibility function to refine the alignment skeleton. The scoring strategy and increased credibility function progressively ensure that kngMap can locate the aligned region for every query read, even in the situation that the matched seeds are dispersedly distributed in the reference genome. 3) For each of the gaps within the skeleton, kngMap classifies it into one of three categories and implements a specific alignment strategy to fill the corresponding gaps, which can help to robustly handle potentially different types of SVs in the reads. kngMap was benchmarked on simulated and real datasets across various genomes with other state-of-the-art mappers. The experimental results demonstrated that kngMap has higher accuracy and sensitivity that can correctly map more sequences and bases to the reference genome and achieves 100% aligned read coverage ratio; meanwhile, it also has good ability to span different types of SVs within the reads.


Sequence–structure alignment for protein sequences is an important task for the template-based modeling of 3D structures of proteins. Building a reliable sequence–structure alignment is a challenging problem, especially for remote homologue target proteins. We built a method of sequence–structure alignment called CRFalign, which improves upon a base alignment model based on HMM-HMM comparison by employing pairwise conditional random fields in combination with nonlinear scoring functions of structural and sequence features. Nonlinear scoring part is implemented by a set of gradient boosted regression trees. In addition to sequence profile features, various position-dependent structural features are employed including secondary structures and solvent accessibilities. Training is performed on reference alignments at superfamily levels or twilight zone chosen from the SABmark benchmark set. We found that CRFalign method produces relative improvement in terms of average alignment accuracies for validation sets of SABmark benchmark. We also tested CRFalign on 51 sequence–structure pairs involving 15 FM target domains of CASP14, where we could see that CRFalign leads to an improvement in average modeling accuracies in these hard targets (TM-CRFalign  Comparing a protein sequence with another sequence or a sequence with a known protein structure is one of the important tasks in bioinformatics, especially in the template-based 3D structure modeling of proteins. In spite of striking new developments in recent years  on 3DIn traditional template-based modeling (TBM), the model qualities are highly dependent on finding the best templates and good alignments between the target sequence and the templates. When multiple templates are given, multiple alignments between the sequence and templates ,4,5,6 arVarious kinds of profile comparison methods have been developed to improve the alignment quality between sequences. For example, there are several score functions available for calculating the match scores between profiles, such as the dot product score , the JenIn this work, we built a method for pairwise alignment between a sequence and a structure that combines an HMM-HMM comparison scoring scheme  and an One distinctive feature of CRFalign is that it combines (in an additive way) HMM-HMM comparison scores and additional nonlinear scoring scheme implemented in multiple steps of boosted regression trees. That is, the additional nonlinear scoring part is constructed by a sum of residual training steps. Therefore, we expect that the HMM-HMM comparison scores guarantee a reasonable baseline performance and the additional nonlinear scoring part learns the mismatch between the true structural alignment and incorrect alignment (induced from the incorrect HMM profiles) so that it learns better how to align the sequence and structure when the HMM-HMM scores are not reliable enough. These residual learning incorporates comparison of several predicted structural features of the target sequence and the true structural features of the templates including secondary structures and solvent accessibilities such that complex relationships between environmental features can be obtained. These features can be contrasted with MRFalign  or ExMacWe find that improvement of alignment accuracy can be achieved, especially for pairwise alignments between protein sequence and structures with remote homologues. We evaluated the alignment quality of CRFalign by modeling the 3D structures via Modeller for different test sets from SABmark benchmark database and some CASP targets ,29. Heres  and t (which we denote as the sequence for the target with unknown structure), an arbitrary alignment between the structural sequence s and the target sequence t can be represented as a sequence of match (M), insertion (I) or deletion (D) states. If we suppose that structure, and that target, then this sequence of alignment states can also be represented as an alignment path on a rectangular lattice of dimensions M, a horizontal one to an I and a vertical one to a D. Here we assume that the target sequence (t) lies along the horizontal with the sequence length s) along the vertical with the sequence length Here, we present the formalism of conditional random fields as applied to pairwise sequence–structure alignment of proteins . For a gh Ls see .L) as L in addition to i and i in conventional pairwise sequence alignment. Here, however, it depends not just on the present alignment state i. This makes it possible to naturally incorporate position dependence or environmental dependence in match scores as well as gap penalties. Important features include similarities of sequence profiles between the sequence and structure, similarities of secondary structures and solvent accessibilities. Originally, conditional random field formalism was based on the function F with linear combination of various scores [F such as neural networks or boosted regression trees [F is obtained through training on a set of reference alignments such that the average probability of these reference alignments get maximal values.Now let us denote the sequence of alignment states . Then it is straightforward to show that, for any alignment model defined by i actually pass along a reference alignment A and if not, it is equal to zero. A simple way to understand this relation is that, when the alignment model defined by s and t with the restriction that a specific transition F, which can be easily sampled from training alignments using the right-hand-side of Equation δlnPδFδlnPδF or a Deletion (D) state, the larger score of the two corresponding states in the original five-state model from HHalign is chosen.Accommodation of the HHalign-type scoring into our CRF alignment model with additional nonlinear scoring function may be implemented in two different ways that are called in this work as the three-state scheme or the five-state scheme. In the three-state scheme of CRF alignment model, we reduce the five states It is also possible to construct a CRF alignment model with a five-state scheme  incorporating the full HHalign scoring and additional nonlinear scoring functions. Moreover, in this scheme of five state, for the purpose of training from the reference alignments, it is necessary to assign an appropriate five-state label for each of the alignment positions between the target and the template. Since the reference alignments are built by some structure alignments without relation to the HMM profiles of the targets or templates, it is not straightforward to assign five state labels to the alignment states due to the ambiguity between Once the base alignment model for the three-state scheme is fixed, additional nonlinear scoring functions  are weight parameters that can be adjusted to control the degree of convergence in the training, where we chose i in this work. For each of the three (for the three-state scheme) or five (for the five-state scheme) alignment states, there corresponds a boosted regression tree. Input features for the regression trees include position-dependent structural features such as secondary structures and solvent accessibilities for the known protein structure. In addition, for the sequence with unknown 3D structure, predicted secondary structures and solvent accessibilities are employed instead. In all, there are six features for the Match state and there are another six features for the Gap state. For further details on the input features to the boosted regression trees, refer to For training these gradients, we used so-called gradient boosted regression trees . In addiIn the CRF alignment model, two kinds of alignments are possible. One is the so-called Viterbi alignment algorithm which selects the one highest scoring alignment . The other method of alignment is the so-called MAP (MAximum Posterior Probability) alignment which first calculates the net probability glocal  alignment is commonly adopted, where the alignment can begin (and end) at internal positions of either the target or the template but not both. If we suppose that the sequence of the structure template runs along vertical axis on the left boundary of a rectangular lattice, with that of the target running along horizontal axis on the top boundary, this corresponds  to beginning the alignment on the upper or left boundaries of the rectangle and ending on the opposite sides (bottom or right boundaries) in the dynamic programming.In contrast to global alignment , local alignments can be generated by allowing the alignment to begin (and end) at any position of the target and the template without scoring for the end gaps. In the case of MAP alignment, this can be conveniently implemented by introducing a threshold value As for the reference alignment set for training our sequence–structure alignment method, we chose the SABmark (version 1.65) benchmark set  which waThe Twilight Zone set consists of 209 sequence groups that each represent a SCOP fold. Sequence similarity is very low with the sequence identities ranging between 0% and 25% and also with the structures being distantly similar. SABmark homepage states that “This set therefore, represents the worst case scenario for sequence alignment, which unfortunately is also the most frequent one, as most related sequences share less than 25% identity” [We chose three sets of reference alignment, each consisting of 200 pairwise alignments from the Superfamilies set and from the Twilight Zone. These three sets are labeled as NG200, NF200 and TW200, respectively. These are chosen in such a way that the pairs are evenly distributed among different groups of families so that as many groups of families as possible are covered. Among these three sets, two of them (NG200 and NF200 set) are from the Superfamilies set with average sequence identities of 24.2%, 21.2%, respectively. The remaining set of TW200 is derived from the Twilight zone set with average sequence identity of 13.8%. By training our sequence–structure alignment methods on these sets with different levels of sequence similarity, we may be able to compare the modeling capabilities of the resulting alignment methods and choose the most efficient one among those results.M), insertion (I) and deletion (D) state, respectively .HMM files were generated by using hhmake tools of HMM hhsuite ,23. In oM), we add the set of corresponding features together with the target label value I) or deletion (D) states along the reference alignment path, we add the corresponding features and the label value to the boosted regression trees for I and D respectively. Now, we have to also collect negative samples, that is, those transitions that do not appear on the reference alignments. Suppose that the sequence length of the structure s and the target t are M, I and D. We tried other values for k. Change of this parameter did not show much difference in the performance of the resulting alignment model.For each pairwise alignment of the reference training set, we take each of the alignment states along the reference alignment path as a positive sample (for training the scoring function). If it is a match state , in order to perform training of our alignment model and then perform validation test in terms of alignment accuracies, we divided the set into four subsets of 50 pairs each, and then carried out a four-fold training and test with 150 pairs for training and the remaining 50 pairs for test in turn. Alignment accuracies are measured as the ratio of the number of aligned pairs out of the true aligned pairs in the reference structure alignment of the sequence pairs of the SABmark benchmark. For training and test on these sets presented, we employed a three-state scheme.In order to assess our alignment method in terms of protein structure modeling for proteins in the SABmark set, we chose the whole 200 pairs of the NF200 set to train our alignment model and then performed sequence–structure alignment with the trained model together with structure modeling on two independent test sets using the Modeller program based on the alignment. One of the two test sets called NG64 consists of 64 pairs chosen from the Superfamilies set of the SABmark. On the other hand, the second test sets called TW55 consists of 55 pairs chosen from the Twilight Zone set of the SABmark, representing more difficult alignment situations. Both sets consist of pairs of sequences that are less than 30% sequence identity against those of the training set NF200 with the average of the sequence identity against the training set being Another example is shown in The final example is shown in For building working alignment models (targeted for blind structure prediction such as CASP), we trained several hundred different three-state alignment models  on the three sets  using the whole 200 pairwise alignments for each of the three sets. In order to choose optimal alignment models, we need to test these for their modeling capabilities. For this, we tested these on CASP10 targets with appropriate templates by performing alignment and modeling. We chose 58 single-domain targets from CASP10, for which there exist templates. Among these, for 50 of them, we could choose two templates. Hence, in all, we have 108 pairs to align and model.o CASP11  and CASPo CASP11 .Recently, we constructed a larger training set called TR367 from SABmark for CRFalign with the five-state alignment model. The training set TR367 consists of 367 pairs of proteins from SABmark superfamily (299 pairs) and twilight zone set (68 pairs). These were carefully selected more or less uniformly among different folds and families. In order to assess the pair-wise alignments of the five-state alignment model, we prepared two test sets W200 and S200 from SABmark benchmark set. The W200 set consists of 200 pairs chosen from the twilight zone subset of SABmark set, while those of S200 are 200 pairs from the superfamily set, where all the sequences in the test set have sequence identities less than 20% against those sequences in the training set (TR367). Therefore, the pairs in W200 set should be considered, in general, harder  than those of S200 set. d=12.111 . The nexsd=4.616 . The finsd=7.159 .https://predictioncenter.org/download_area/CASP14/templates/LGA/, last accessed on 1 February 2022). For each of these domain targets, 1–6 homologues are available for templates. We ended up with 51 pairs of target and templates involving 15 CASP14 domains for sequence–structure alignment. We compared the TM scores of the structure models obtained via Modeller based on the pairwise alignments using CRFalign and HHalign, respectively. We also tested the performance of CRFalign (five-state scheme) on hard targets of CASP14 , where t2 scores  and alsoSequence–structure alignment is useful in fold recognition i.e., template search. In order to test the template search capability of CRFalign alignment, we incorporated CRFalignment (with the five-state scheme) into our fold recognition framework called CRFpred ,33. CRFpFor each target, search is made from the database (excluding the target itself) and the top five templates are chosen from the result of CRFpred search. A sequence–structure alignment method CRFalign is presented that improves upon a reduced three-state or five-state scheme of HMM-HMM profile alignment model by means of conditional random fields with nonlinear scoring on the sequence and structural features implemented with boosted regression trees. CRFalign can extract and exploit complex nonlinear relationships among sequence profiles and structural features, including secondary structures, solvent accessibilities, environment-dependent properties that give rise to position-dependent and environment-dependent match scores and gap penalties. Training of the CRFalign is performed on a chosen set of reference pairwise alignments from the SABmark benchmark set, which consists of Twilight Zone set and Superfamilies set with pairs of sequences very low to low, and low to intermediate sequence similarity, respectively. We found that our alignment method produces relative improvement in terms of average alignment accuracies, especially for the alignment of remote homologous proteins. Comparison of the modeling capabilities of our alignment on independent pairs of SABmark set with those of HHalign showed that our alignment method produced better modeling results especially in the relatively hard targets. This was also confirmed in recent tests on hard targets of CASP14. CRFalign was successfully applied to the initial stages of fold recognition and as an input to the multiple sequence alignment called (MSACSA) in the CASP11 and CASP12 competition on protein structure predictions.


Multiple sequence alignment (MSA) is a basic step in many bioinformatics pipelines. However, achieving highly accurate alignments on large datasets, especially those with sequence length heterogeneity, is a challenging task. Ultra-large multiple sequence alignment using Phylogeny-aware Profiles (UPP) is a method for MSA estimation that builds an ensemble of Hidden Markov Models (eHMM) to represent an estimated alignment on the full-length sequences in the input, and then adds the remaining sequences into the alignment using selected HMMs in the ensemble. Although UPP provides good accuracy, it is computationally intensive on large datasets.We present UPP2, a direct improvement on UPP. The main advance is a fast technique for selecting HMMs in the ensemble that allows us to achieve the same accuracy as UPP but with greatly reduced runtime. We show that UPP2 produces more accurate alignments compared to leading MSA methods on datasets exhibiting substantial sequence length heterogeneity and is among the most accurate otherwise.https://github.com/gillichu/sepp.Bioinformatics online. Multiple sequence alignment (MSA) is a fundamental bioinformatics task, and producing accurate alignments can have profound impact in many downstream analyses, such as phylogeny inference , detectiBecause of the significant interest in alignment estimation, many alignment methods have been developed .btad007_Supplementary_DataClick here for additional data file.