Skip to main content
BMC Bioinformatics logoLink to BMC Bioinformatics
. 2025 Jul 21;26:188. doi: 10.1186/s12859-025-06182-5

Aryana-bs: context-aware alignment of bisulfite-sequencing reads

Hassan Nikaein 1,, Ali Sharifi-Zarchi 1,, Afsoon Afzal 2, Saeedeh Ezzati 1, Farzane Rasti 1, Hamidreza Chitsaz 3, Govindarajan Kunde-Ramamoorthy 4
PMCID: PMC12281798  PMID: 40691759

Abstract

Background

DNA methylation is essential in various biological processes, including imprinting, development, inflammation, and numerous disorders, such as cancer. Bisulfite sequencing (BS) serves as the gold standard for measuring DNA methylation at single-base resolution by converting unmethylated cytosines to thymines while leaving methylated cytosines intact. However, this C-to-T conversion presents a well-known challenge in conventional short-read aligners, which treat these conversions as substitutions. Many aligners that require seed sequences fail when frequent C-to-T conversions occur over short distances, resulting in reduced alignment accuracy. To address this challenge, two alignment methods have been well established: three-letter alignment and wildcard alignment. Three-letter alignment faces the significant issue of data loss by converting all thymines to cytosines, which obscures meaningful information. On the other hand, wildcard alignment introduces a biased alignment, failing to treat reads from unmethylated and methylated regions equally, leading to artifacts in methylation level estimation and inaccuracies in quantifying DNA methylation. This work introduces ARYANA-BS, a novel BS aligner that diverges from conventional DNA aligners by directly integrating BS-specific base alterations within its alignment engine. Leveraging known DNA methylation patterns across different genomic contexts, ARYANA-BS constructs five indexes from the reference genome, aligns each read to all indexes, and selects the alignment with the minimum penalty. To further refine alignment accuracy, an optional Expectation-Maximization (EM) step is incorporated, which integrates methylation probability information into the decision-making process for choosing the optimal index for each read. This approach aims to enhance BS read alignment accuracy by accommodating the complexities of DNA methylation patterns across diverse genomic contexts.

Results

Experimental evaluations on both simulated and real data reveal that ARYANA-BS achieves state-of-the-art accuracy, maintaining competitive speed and memory efficiency.

Conclusions

ARYANA-BS significantly improves alignment accuracy for bisulfite sequencing data by effectively integrating DNA methylation-specific alterations and genomic context. It outperforms existing methods, such as BSMAP, bwa-meth, Bismark, BSBolt, and abismal, particularly in robustness against genomic biases and alignment of longer, higher-error reads, demonstrating suitability for cancer research and cell-free DNA studies. While the Expectation-Maximization (EM) algorithm provides only modest initial improvements, it establishes a valuable framework for future refinement and potential enhancements in sensitive applications.

Keywords: DNA methylation, bisulfite sequencing, alignment, CpG island

Introduction

DNA methylation is the earliest recognized epigenetic mechanism that is found primarily in vertebrates. This process involves the attachment of a methyl group to carbon 5 of genomic cytosine, resulting in 5-methylcytosine [1]. DNA methylation plays a crucial role in a multitude of biological processes, including but not limited to imprinting, differentiation, development, inflammation, transcriptional silencing, and various diseases such as cancer [2]. Therefore, analyzing and evaluating methylation data can provide extensive information about the regulatory mechanisms of vertebrate cellular life.

Most methylated cytosines are found adjacent to a guanine nucleotide, forming a CpG site. However, cytosines in the forms of CpA, CpT, and CpC are typically not methylated [1]. Many regions of a vertebrate genome lack CpGs due to the deamination of methylated cytosines, which convert them to uracil. During DNA replication, uracil is replaced by thymine, resulting in a C to T conversion [3]. Specific regions in the vertebrate genome, called CpG islands, have a higher ratio of CpGs and GC content than other genomic regions. CpG islands are usually hypomethylated (i.e., having lower DNA methylation levels), while isolated CpGs located outside of CpG islands tend to be hypermethylated (i.e., having higher DNA methylation levels) [1].

Several experimental techniques are used to measure DNA methylation levels across the genome, including methyl-DNA immunoprecipitation (MeDIP), methylation-sensitive restriction enzymes (MSREs), and bisulfite sequencing (BS) [4]. Among these techniques, BS is widely used due to its ability to provide single-base resolution and high-throughput scale when used with next-generation sequencing (NGS) technology. Treating genomic DNA with sodium bisulfite results in the deamination of unmethylated cytosines, which are converted to uracils. During polymerase chain reaction (PCR), uracils are replaced by thymines, resulting in a C to T conversion. Meanwhile, methylated cytosines remain unchanged. By using NGS and aligning the resulting data, we can map reads to the reference genome and identify C to C versus C to T conversions to count the number of methylated versus unmethylated cytosines, respectively.

It is important to note that the reverse complement strand generated by PCR shows no change in guanine opposite methylated cytosines, whereas guanine is converted to adenine opposite unmethylated cytosines. (Fig. 1).

Fig. 1.

Fig. 1

The bisulfite sequencing procedure. In the first step, an enzyme unwinds the DNA into Watson and Crick fragments. Then, during bisulfite treatment, the unmethylated cytosines are converted to uracil. Furthermore, during PCR, all uracils are converted to thymines in the final step. This conversion converts the related Crick(Watson) nucleotide from guanine to adenine

Depending on the biological inquiry at hand, there are several sequencing methods available for profiling cytosine methylation patterns in DNA, including whole genome bisulfite sequencing (WGBS), reduced representation bisulfite sequencing (RRBS), and targeted bisulfite sequencing. WGBS involves the treatment of the entire genomic DNA with sodium bisulfite, followed by PCR amplification and sequencing, resulting in a comprehensive view of cytosine methylation patterns across the entire genome, albeit at a higher NGS cost. In contrast, RRBS targets CpG-rich regions such as promoters and CpG islands by using specific methylation-insensitive restriction enzymes, enabling the generation of more data at a lower NGS cost [5]. Lastly, targeted bisulfite sequencing is employed when we want to analyze the methylation status of a specific gene or genomic region.

A significant challenge in analyzing WGBS and RRBS data is aligning NGS reads to the reference genome. In conventional DNA short read aligners such as BWA [6], Bowtie2 [7], and others, all C to T and G to A conversions are interpreted as mismatches. Many of these aligners rely on a seed-and-extend strategy [8], which may not be effective in finding exact matches (seed sequences) when mismatches occur frequently. Therefore, specific aligners are needed for the analysis of bisulfite sequencing reads.

Many BS short read aligners use the primary strategy of adapting BS reads and/or the reference genome to enable conventional short read aligners to align them without modification. However, two different methods have emerged to resolve the C to T conversions (G to A conversions can be resolved in a similar manner).

The first method is the three-letter alignment, which involves converting all Cs of both reference and reads to Ts, thereby eliminating mismatches due to bisulfite C to T conversions and making it easy to use a conventional short-read aligner [9]. Bismark [10] produces two indices from the reference genome by converting Cs to Ts and Gs to As and then aligns the reads to each of them using the same conversions. This adaptation of the data, however, results in the loss of the distinctions between Cs and Ts in both reference and reads, and consequently, read Cs can be aligned to genomic Ts, which is not possible in bisulfite conversion. This information loss leads to multiple alignment hits across the reference at the same score, reducing the number of reads with a unique alignment position [11]. Some methods have extended this approach to introduce a two-letter alignment by simultaneously converting Cs to Ts and Gs to As in both reference and reads [12], but this approach leads to even more information loss than the three-letter method.

The second method is wild-card alignment, which involves replacing all Cs of the reference with the wild-card letter Y, which can stand for either C or T in IUPAC. In this way, Cs and Ts of the reads can be aligned to the reference Ys. BSMAP [13] uses a hash table to record all k-mers in the reference genome and records all C-to-T variations of the reference k-mers to implement the wild-card alignment. Unlike the three-letter alignment, the wild-card alignment does not result in information loss. However, it has a bias toward aligning reads from hypermethylated genomic regions better, as reads coming from such regions have more Cs, which can only be mapped to reference Ys. In hypomethylated regions, Cs diminish after C to T conversion, and Ts of a read can be aligned to both Ys and Ts of the reference, leading to nonunique alignment. Many downstream analyses, including the estimation of the methylation ratio of each genomic cytosine, eliminate nonuniquely aligned reads. As a result, this method suffers from a systematic overestimation of the methylation ratio, since reads from hypermethylated regions have a better chance of unique alignment [11].

In this article, we introduce ARYANA-BS, a novel bisulfite sequencing short-read aligner building upon our previous work on the conventional short-read aligner ARYANA [14]. Unlike many existing methods that rely on adapting reads and/or references, ARYANA-BS incorporates specific treatments for BS reads during the alignment process. Specifically, we have enhanced the methods for gap-filling, computing edit distance, and alignment score (penalty), considering the possible base conversions that may occur due to bisulfite treatment, based on the distinct contexts in which they occur. These contexts include differentiating between CpG and non-CpG cytosines, as well as CpG island and non-CpG island regions. Additionally, we utilize five distinct indexes for optimizing the seed-finding procedure, as described in detail in the Methods section. Furthermore, we developed an optional EM step that leverages the methylation probability of each cytosine to improve the final alignment result.

We benchmarked ARYANA-BS, as well as several widely-used BS aligners, including Bismark [10], BSMAP [13], bwa-meth [15] (a three-letter aligner), BSBolt [16] (another three-letter aligner), and abismal [17] (a two-letter aligner), using both simulated and real data. We utilized a pair of simulators, one developed by us and another introduced in independent research, and found consistent results. Additionally, we used real data that had previously been used in independent benchmarks of BS aligners. We provide time, memory, and accuracy comparisons of the aligners, and show that ARYANA-BS outperforms the other aligners in terms of alignment accuracy on simulated and real data, while still maintaining competitive speed and memory usage.

Results

We conducted a comparative analysis of ARYANA-BS against five other widely used WGBS aligners: BSMAP (2.90 using bioconda), Bismark (0.23.0 using bioconda), bwa-meth (0.2.2 using bioconda), BSBolt (1.4.8 using cpfarrell), and abismal (3.1.1). BSMAP was chosen for its acceptable results in prior studies, while Bismark is known for its effectiveness and widespread use. bwa-meth is an adaptation of BWA mem, while BSBolt is a new aligner, and abismal employs a unique approach of two-letter mapping. The default configuration parameters were employed for all tools. The comparison was carried out using SAM file analyses, with hg38 as the reference and the CpG islands file obtained from http://hgdownload.cse.ucsc.edu/goldenpath/hg38/database/cpgIslandExt.txt.gz.

In the initial phase, we generated simulated bisulfite-treated reads from the hg38 genome using both the ARYANA and SHERMAN read simulators [18]. In the subsequent phase, we conducted an extensive evaluation of our algorithm using real data sourced from SRR3469520, which is available from the NCBI. This real-world dataset served as a valuable benchmark to assess our methodology’s efficacy. Finally, in the last phase of our investigation, we delved into the impact of incorporating an additional expectation-maximization (EM) step on the outcomes generated by ARYANA-BS. This step was introduced to further refine the results and explore potential enhancements to the algorithm’s efficacy.

It should be noted that although Bismark supports paired-end alignment, we encountered several unsuccessful attempts to run it on paired-end data, resulting in no output. Furthermore, BSMAP can only align reads that are 144 bp or shorter, rendering it unusable in some analyses.

Although ARYANA-BS and other tools were capable of running in multi-threaded mode, they were executed in single-threaded mode to ensure a more accurate comparison. All tools were employed in single-threaded mode, with an AMD Ryzen 5 3600X CPU and a maximum of 48 GB memory. We used the ARYANA simulator to generate 100 bp single-end reads for test 2 and test 3. Additionally, the other parameters of all tools were not modified and remained at their default values. To compare tools, we do not consider concordant alignments and accept only one result per read for each aligner.

Simulated data

In the initial stage, our objective is to compare ARYANA-BS with other tools based on simulated data. The data generated for this purpose were simulated using both the ARYANA simulator and Sherman. We used the ARYANA simulator to generate both 100 bp and 300 bp single-end and paired-end reads. For Sherman, we only generated 100 bp single-end reads. However, despite running for 163 h, Sherman failed to generate any output for the simulation of 300 bp single-end reads.

The ARYANA simulator was developed to generate reads for regular sequencing as well as bisulfite sequencing. To simulate bisulfite sequencing, the simulator takes the reference genome as input and produces SNPs after loading the reference genome into memory. During the read generation process, the simulator takes into account the insertion, deletion, and mismatch ratio provided in the input. Moreover, the simulator generates reads from both the positive and negative strands. In the case of bisulfite sequencing, the simulator also incorporates the effects of negative strand and PCR in the output reads. These effects are based on G-to-A and C-to-T conversions that are dependent on the C or G in the reference genome. The CpG islands from the input are utilized by the simulator to make bisulfite conversions based on the context of cytosines. The default methylation ratios for the CpGs inside the CpG islands are set at 0.1, while outside the CpG islands the default is 0.9, and for the CpH, the default methylation ratio is 0.01.

The primary aim of the first comparison is to evaluate the accuracy and performance of various tools. In the subsequent two comparisons, we closely examine the effect of possible biases in the genomic context on the performance of the tools.

Comparison of memory, time, false discovery rate (FDR), and correctly mapped reads percentage

In this analysis, we evaluated the accuracy of the tools based on simulated reads. We generated 1,000,000 reads for each simulation and used the tools to align them with the reference genome. We used the ARYANA simulator for four simulations that differed in the length of reads and whether they were single-end or paired-end sequencing. The ARYANA simulator was configured to use 4 million single-nucleotide polymorphisms (SNPs). Additionally, the Sherman simulator was used to simulate 100 base pair (bp) single-end reads.

We considered an alignment to be correct if the reported position by the tool for the alignment differed by no more than one base pair from the actual position reported by the simulator. We also computed the FDR using the following formula:

graphic file with name d33e344.gif

In all simulation data generated by ARYANA and the Sherman simulator, ARYANA-BS outperformed all other tools in terms of the number of correctly mapped reads. However, BSMAP had comparable results in three simulations, but it only supports reads shorter than 145 bp, making it unsuitable for sequencers of larger read sizes.

The best whole-genome bisulfite sequencing (WGBS) aligner in terms of computational performance was abismal, exhibiting the shortest runtime and lowest memory usage among all tools. However, its accuracy—a key measure of alignment performance—was not acceptable. Bismark had better memory usage, but its accuracy was worse than that of any other tool. ARYANA-BS had comparable runtime to other tools, and in simulations with longer read lengths, it was faster than other tools. Moreover, its memory usage stood at an average level, closely aligning with that of BSMAP.

The FDR of ARYANA-BS is slightly higher than that of bwa-meth and BSBolt. Additional work is needed to address this issue. (see Fig. 2)

Fig. 2.

Fig. 2

Comparison of ARYANA, BSMAP, bwa-meth, Bismark, BSBolt, abismal. We have shown four comparisons: percent of correctly mapped reads, FDR (false discovery rate), memory footprint, and runtime. We compared these tools with five simulated inputs: 100 base pairs single-end reads, 300 base pairs single-end reads, 100 base pairs paired-end reads, 300 base pairs paired-end reads, all simulated with ARYANA read simulator, and 100 base pairs single-end reads simulated with Sherman

In Fig. 3, we demonstrated that most of the reads aligned to the context-aware indexes instead of the original index and three-letter indexes. This result highlights the importance of context-aware alignment in the improvements of ARYANA-BS.

Fig. 3.

Fig. 3

Percent of alignment of reads to each index. This figure shows the percentage of each dataset that aligned to each index. The majority of the reads aligned to the context-aware indexes, rather than the original index and three-letter indexes

Single nucleotide polymorphisms (SNPs) and indel rates

In Fig. 4, we present a comparison of correctly mapped reads for simulated reads with varying SNP counts and different indel rates. This analysis showcases the efficacy of the tool in genomic change analyses, such as cancer analyses.

Fig. 4.

Fig. 4

Evaluation of tools across varying SNP counts and indel rates We generated two different simulated reads with different SNP counts. This figure shows the percentage of correctly mapped reads for each tool case. In both cases, ARYANA-BS performed better than the other tools. Additionally, we generated three different simulated reads with different indel rates, and again ARYANA-BS mapped more reads correctly with different indel rates than others

In the initial simulation, we simulated two sets of reads with SNP counts of 4 million and 40 million. Although this change has a negligible impact on the tool’s performance, it is worth noting that ARYANA-BS outperforms all other tools in both tests.

To further investigate ARYANA-BS’s performance concerning the sequence with nucleotide insertion or deletion, we simulated three sets of reads with varying indel rates. Specifically, we simulated reads with a low indel rate of 0.001, an indel rate of 0.01, and a high indel rate of 0.05. As illustrated in Fig. 4, even a minuscule indel rate of 0.001 significantly impacts BSMAP’s performance. Additionally, the results from 0.01 and 0.05 indel rates indicate that ARYANA-BS is more resistant to indel rates than other tools, and it consistently aligns more reads correctly than any other tool.

Percentage of reads in CpG Islands and methylation percentage

We conducted three simulations to investigate the bias of ARYANA-BS toward reads from CpG islands. In the first simulation, no reads originated from CpG islands. In the second simulation, 50% of the reads came from CpG islands, while all the reads in the third simulation belonged to CpG islands. Although the results were similar across all simulations, ARYANA-BS consistently outperformed the other tools (see Fig. 5).

Fig. 5.

Fig. 5

Evaluation of tools across different percentages of reads in CpG islands and varying methylation levels This figure shows the performance of each tool for different percentages of reads in CpG islands and the percent of methylation in the simulated reads created with the ARYANA read simulator. ARYANA-BS is better than other tools in all cases

We further analyzed the bias of ARYANA-BS and other tools toward methylation percentages of reads. To accomplish this, we simulated reads with varying degrees of methylation, including hypomethylated reads (10% methylation), averagely methylated reads (50% methylation), and hypermethylated reads (90% methylation). In all three cases, ARYANA-BS exhibited superior performance compared to other tools. However, no significant differences were observed among all the tools (see Fig. 5).

Real data analysis

To evaluate the accuracy of the proposed algorithm on real data, we compared the alignment efficiency of ARYANA-BS with other available tools. The first one million reads from each file of SRR3469520 run from NCBI (https://trace.ncbi.nlm.nih.gov/Traces/index.html?view=run_browser&acc=SRR3469520) were used for this purpose.

As we lacked knowledge of the exact position of each read in the real data, we computed the alignment penalty of each read for each tool to obtain a fair comparison between the two tools. To ensure a level playing field, we utilized penalty scores from bwa-meth. Mismatch penalties were set at 4, gap open penalties were set at 6, gap extension penalties were set at 1, and match scores were set at 4. The difference between the alignment penalty of the two tools was then computed for each read.

Figure 6 showcases the count of reads with differentiations in comparison between ARYANA-BS and other tools, as well as the number of reads each tool could align while the other failed to do so. It is noteworthy that we did not employ Bismark because it was unable to generate output in the case of paired-end reads. It is evident that ARYANA-BS outperformed other tools in this analysis. The alignment penalty of BSMAP was lower than that of ARYANA-BS on 4% of the reads. However, BSMAP failed to align 29.4% of the reads, demonstrating the overall superior performance of ARYANA-BS.

Fig. 6.

Fig. 6

Comparison of ARYANA-BS against bwa-meth, BSMAP, abismal, and BSBolt with real data We used the read alignment penalty to compare the tools with real data to determine the alignment quality of each tool. For this comparison, we have calculated the penalty for each tool on each read and the differentiation between the ARYANA-BS alignment penalty and the other tool’s penalty. In this figure, we have indicated the count of reads with each differentiation and the number of reads that were aligned only by ARYANA-BS or the other tool. Note: the box chart was trimmed to avoid large plots. Additionally, the reads with equal alignment penalties omitted from the box chart

Analysis of the additional EM-step

To investigate the impact of the EM (Expectation-Maximization) step on the improvement of ARYANA-BS results, a dataset consisting of 5 million reads, each with a length of 100 base pairs, was generated from chromosome 21. This was done to achieve an approximate sequencing depth of approximately 10X, considering resource constraints that prevented a genome-wide analysis.

A summary of the ARYANA-BS execution, both without the EM step and with the EM step applied to this dataset, is presented in Table 1. In summary, the implementation of the EM step was able to reduce the ARYANA-BS error by 3.23% without any change in the needed memory, incurring an additional 9.76% runtime. Furthermore, it increased the percentage of reads aligned to their correct positions from 90.73 to 91.03%.

Table 1.

Analysis of the additional EM-step on ARYANA-BS

correctly mapped reads (%) User+Sys Time (s) Memory (GB) FDR
ARYANA-BS 90.73 3634.33 1.87 0.0927
ARYANA-BS with EM-step 91.03 3991.57 1.87 0.0897

Methods

As mentioned in the background section, the current paradigm in many BS short read aligners is to use a conventional short read aligner of untreated genomic DNA as a black box (unchanged or with minimal changes) and, rather, adapt the reference genome and/or reads (i.e., wild-card, two-letter or three-letter).

Information loss, as observed in two- or three-letter methods, as well as a biased alignment rate depending on the methylation ratio of the genomic region in wild-card aligners, has been extensively discussed in the literature as the major limitation of these methods [19].

Context-aware paradigm

In order to overcome the shortcomings of existing methods, ARYANA-BS applies a new paradigm that we call context-aware alignment. This paradigm adapts the seed-and-extend algorithm specifically to improve bisulfite (BS) short read alignment. To achieve this, ARYANA-BS integrates well-established biological knowledge about DNA methylation patterns across different genomic contexts:

  • Dinucleotide context: The distribution of the DNA methylation ratio of cytosines present in CpG dinucleotides is significantly different from the other contexts (i.e., CpA, CpC and CpT dinucleotides). Although the presence of 5-methylcytosines in DNA was discovered in the 1940 s, there was very limited knowledge about non-CpG methylation by the early 2010 s [20]. Following major developments in DNA-methylation assays, particularly RRBS and WGBS, more studies have shown the existence of non-CpG methylation in some human tissues (e.g., brain), as well as embryonic stem cells [21]. Further research showed biological functions of non-CpG methylation [2224], and suggested epigenetic mechanisms that regulate the presence of non-CpG methylation [25, 26]. Some packages perform downstream analysis of DNA methylation data (e.g., finding differentially methylated regions) by distinguishing between CpG vs. non-CpG methylation [27]. However, the extreme alteration of methylation distribution in CpG vs. non-CpG context is considered neither in two/three letters, nor in wild-card alignment.

  • Genomic context: A significant alteration of the methylation pattern was observed in different genomic contexts, particularly in active regions (e.g., promoters of expressed genes) [28, 29] vs. silenced regions (e.g., heterochromatin) [3032]. These alterations have been confirmed at single-cell, cell-type resolution [33]. A common observation has been a significant alteration of CpG methylation distribution in CpG islands: although isolated CpGs tend to be hypermethylated in many tissues, those present in CpG-rich regions such as CpG islands, particularly in proximity to active promoters, show lower methylation levels [34, 35].

We should note that these rules are not zero–one rules, as there are well-known hypermethylated CpG islands in different tissues and diseases [3639]. There are also observations about flanking regions of CpG islands, called CpG island shores [40]. Altered methylation distribution of isolated CpGs vs. those present in CpG islands can be employed as important prior information that was not taken into account in two/three letter or wild-card alignment.

ARYANA-BS is an enhancement of our conventional short-read aligner ARYANA [14], which performs context-aware alignment of BS reads. To better describe ARYANA-BS, we need to have a quick glance over how ARYANA works, and then review what enhancements are made to build ARYANA-BS.

subsectionA review of ARYANA ARYANA, which has been previously published, uses a seed-and-extend paradigm for aligning short reads of genomic DNA. It creates a Burrows-Wheeler Transform (BWT) index of the genome using the BWA engine [6], partitions the reference genome into equal-sized windows, and finds maximal substrings that exactly match between the read and the reference (seeds). For each seed, it scores the genomic windows that contain the seed. It then selects a subset of windows with the maximum scores, finds the precise alignment penalty of the read in each window, and reports the alignment position with the minimum penalty.

In the original ARYANA, a bidirectional BWT search algorithm was introduced and used for seed-extension in both directions. The algorithm creates a BWT index on the reference and its reverse complement, as well as another BWT index on the reverse of the reference and the reference complement. The former index is used to find a minimal seed that does not overlap with the previous seed, while the latter index is used to extend it. This approach enabled a significant speedup by creating non-overlapping seeds over the read instead of searching every base of the read for a new seed. Furthermore, several algorithmic enhancements and techniques were implemented in ARYANA to improve its efficiency. For example, it uses a reset-free hash table as the data structure to search and update window scores; by "reset-free," it is meant that the hash table does not need to be cleared for each new read. ARYANA is multithreaded and can process both single-end and paired-end reads.

ARYANA-BS employs context awareness of DNA methylation patterns in both seed finding and extension phases of read alignment, as described below:

Context-aware seed finding

By considering alterations in the cytosine-methylation probability distribution across dinucleotide and genomic contexts, ARYANA-BS creates five different indexes from the reference genome (Fig. 7):

  • Index a: the original reference genome, unchanged.

  • Index b: all cytosines that are more likely to be unmethylated, according to their dinucleotide and genomic contexts, are converted to thymines. This resembles the most probable sequence of the genome, after being treated with sodium bisulfite. The default strategy is to consider CpGs outside CpG islands more likely to be methylated, and all other cytosines (e.g., CpAs, CpCs, and CpTs across the genome as well as CpGs inside CpG islands) more likely to be unmethylated. The list of genomic regions considered to be hypomethylated is provided as an input to the algorithm. By default, it contains CpG islands, but it can be changed depending on the specific organism, tissue or cell type to contain most likely hypomethylated regions across the whole genome.

  • Index c: all cytosines are converted to thymines, regardless of their genomic or dinucleotide contexts. This index is identical to the one used in the three-letter strategy, but as we later show, the extension phase of ARYANA-BS is different from what is used in three-letter algorithms.

  • Indexes b’ and c’: similar to genomes b and c, in which, guanine to adenine conversions are made. It is very important to note that PCR amplification of bisulfite-treated DNA fragments can lead to four different sequences from the same region, depending on whether the original forward vs. reverse fragment is used as the PCR template, and whether the final fragment being sequenced is similar or reverse complement to the template 1. The PCR product contains fragments that are reverse complemented to the original template from the genomic bisulfite-treated DNA. These fragments contain G to A conversions, which distinguish them from reverse-strand fragments of the original bisulfite-treated DNA. In genome b’, we select all Gs in the forward strand of the reference genome where the opposite C in the reverse strand is more likely to be unmethylated (as described in genome b) and convert them to A. In genome c’, we convert all Gs in the forward strand of the reference genome to A.

It is important to note that for each of the five above genomes, we concatenate the sequence and its reverse complement (with a separator in the middle) and use the resulting sequence to create the BWT index. In this way, both forward and reverse reads can be aligned.

Fig. 7.

Fig. 7

Context-aware different indexes for the ARYANA-BS seed finding algorithm. Genome a: original reference genome. Genome b: all cytosines that are expected to be unmethylated, according to the prior context information, are converted to thymines. Genome c: all cytosines, regardless of their contexts, are converted to thymines. Genomes b’ and c’: similar to genomes b and c, by converting guanines to adenines

By using these five different genomes, we ensure that the context information is used to create longer exact seeds without information loss. Reads are NOT altered neither in seed finding, nor extension.

Context-aware seed extension

As we mentioned earlier, both ARYANA and ARYANA-BS partition each reference genome into equal-sized windows to find the best part of the genome for read mapping. Each read was aligned independently to each of the five references. For each reference, we find maximal exact matches and score the genomic windows that contain the seed (for more details, see ARYANA article [14]). Then, we list the top scored windows and try to extend individual seeds in each window to cover match the whole read.

This extension phase is mainly performed by the following steps:

  • A maximal list of consequenced seeds in each window can be determined using a greedy algorithm that guarantees compatibility between the order of the read and the reference. The seeds in the read are arranged in a nonoverlapping fashion, making the greedy algorithm a viable approach for identifying a maximal list of consequenced seeds that are not overlapped in the reference and maintain the same order.

  • Filling the gaps between each pair of consecutive seeds in the list. For this purpose, we have developed a dynamic programming algorithm for finding the optimal-matching between the part of the read between two seeds, and part of the reference located between the same pair of seeds. Although this algorithm has the same logic as Smith-Waterman, it has several differences. The scoring scheme is compliant with bisulfite-sequencing. Therefore, in genomes a, b, and c, we consider zero penalty for genomic cytosines that are mapped to read thymines. However, it is important to mention that genomic thymines mapped to read cytosines are treated as mismatches, which makes the ARYANA-BS extension different from either two/three-letter or wild-card aligners. Furthermore, we take the dinucleotide context of cytosine into account and treat CpG dinucleotides differently from CpAs, CpCs and CpTs in terms of the mapping penalty. For genomes b’ and c’, we consider a similar penalty scheme for genomic guanines that are mapped to read adenines.

  • Finally, we sum the total match scores and mismatch/indel penalties for all gaps inside the consecutive seeds. If the data is paired end, we look for the best pair of matches, one of read-1 and the other for read-2, which are concordant according to the distancing arguments provided to ARYANA-BS. If no concordant alignment is identified, we can report discordant alignment of each read if specified in the arguments.

EM algorithm for improving methylation probability estimation and read alignment

Following the initial alignment phase, a post-processing step is performed on the aligned reads for each of the five reference genomes. This process involves the computation of context-aware alignment penalties for the reads within each of these five reference genomes. The alignment with the most favorable penalty score is selected, further enhancing the precision of the alignment. To augment the accuracy of this step, an optional EM algorithm is employed (Fig. 8).

Fig. 8.

Fig. 8

The EM-step of ARYANA-BS. In the expectation step, the probability of cytosine methylation at each site, denoted as the latent variable Z, is determined based on the alignment specified in Inline graphic. Subsequently, in the maximization step, the best index for the placement of each read is determined based on the probability of cytosine methylation at each cytosine site, utilizing the Eq. 3

The EM algorithm plays a pivotal role in estimating the methylation probability of each cytosine, treating it as a latent variable. This methylation probability is then seamlessly integrated into the alignment penalty calculation for each read within each of the five indices. This integration ensures that the resulting alignment not only optimizes the penalty score but also takes into account the methylation probability of each individual cytosine.

The algorithm introduces a variable, denoted as Inline graphic, which is represented as a tuple Inline graphic. In this representation, Inline graphic characterizes the alignment of read Inline graphic with one of the five generated indices, and Inline graphic denotes the specific aligned location. Consequently, the dataset X encompasses sequences corresponding to each input read.

Furthermore, a missing variable, Z, is defined as follows:

graphic file with name d33e712.gif

In this definition, G[i] signifies nucleotide i within genome G, and Inline graphic denotes the methylation state (either methylated or unmethylated) of each cytosine at the specified genomic locations.

Expectation phase

In the E-step of the EM algorithm, we embark on the task of determining the methylation probability for each cytosine situated within CpG dinucleotides found in both the forward and reverse strands. This determination is derived from the outcomes of the read alignments against the five reference genomes. In this context, each C-to-C alignment on the forward strand (and G-to-G alignment on the reverse strand) is considered representative of a methylated cytosine, while T-to-C and A-to-G alignments are regarded as indicative of unmethylated cytosines.

To calculate the methylation probability for each cytosine Inline graphic within genome G (where Inline graphic denotes the i-th nucleotide of genome G) based on the estimated parameter Inline graphic, the following formula is employed:

graphic file with name d33e768.gif

This formula calculates the likelihood of methylation for a specific cytosine Inline graphic in genome G, taking into account the information from the read alignments and the parameter estimate Inline graphic.

Maximization phase

In the maximization step of the EM algorithm, reads are aligned to each of the five reference indices based on the methylation probabilities computed in the expectation step. The objective function Inline graphic is defined as follows:

graphic file with name d33e799.gif 1

Although the alignment probability of Inline graphic to Inline graphic is not independent of the alignment probability of Inline graphic to Inline graphic, for the sake of simplicity, we assume they are independent, as done in many other similar studies [10, 1316].

Therefore, Inline graphic can be computed as:

graphic file with name d33e848.gif

Therefore we can rewrite the expression 1 as follows:

graphic file with name d33e857.gif 2

In a simplified model where Inline graphic represents the sequencer error probability, Inline graphic can be computed as:

graphic file with name d33e877.gif

Assuming a mismatch penalty equal to Inline graphic, Inline graphic can be approximated as:

graphic file with name d33e895.gif

In line with the provided explanations, to determine Inline graphic for maximizing Inline graphic, the values of Inline graphic need to be determined in a manner that maximizes the expression 2. Given that the values of Inline graphic are independent of each other, and the effect of each one on expression 2 is independent of the others, for each read Inline graphic, the value of Inline graphic is set in a way that maximizes the following:

graphic file with name d33e945.gif 3

Discussion

We have improved the ARYANA aligner as the ARYANA-BS aligner to align WGBS reads. ARYANA-BS uses the theoretical knowledge about the methylation ratio of each position of the genome to achieve better alignment.

We have compared ARYANA-BS with BSMAP, bwa-meth, Bismark, BSBolt, and abismal to assess the proposed algorithm. The comparison has shown that the ARYANA-BS aligner improves previous works in the number of correctly mapped reads for simulated data and reduces penalties while increasing mapped reads in the alignment of real datasets. Additionally, ARYANA-BS exhibits a comparable memory footprint and runtime relative to other tools.

ARYANA-BS demonstrates increased robustness against biases related to genomic context, including hypermethylation, hypomethylation, indels, and SNP counts. This feature makes it particularly suitable for analyses reliant on genomic alterations, such as cancer research and cell-free DNA studies. Moreover, ARYANA-BS can effectively handle reads up to 1000 bases in length and shows promising potential for longer and higher-error reads generated by technologies like PacBio and Oxford Nanopore. This enhanced performance is likely due to its greater resilience against insertions and deletions, although further dedicated studies are required to optimize its internal parameters for these platforms.

Although the application of the Expectation-Maximization (EM) algorithm has not resulted in a substantial improvement at first glance, our main goal was to establish a theoretical framework for integrating EM into bisulfite sequencing alignment. Furthermore, when the baseline alignment accuracy already exceeds 90

Acknowledgements

The authors express their gratitude to Maryam Rabiee for her significant contributions to the initial development of ARYANA-BS and to Seyed Amir Malekpour for proposing the use of the EM approach. We also thank Richard Dannebaum for his support throughout this work.

Author contributions

A.Sh. and H.N. wrote the manuscript and contributed to code development. A.A. contributed to code development. H.N., S.E., F.R., and G.K. performed benchmarking and prepared the initial version of the manuscript. A.Sh. and H.C. provided guidance throughout the study. G.K. also contributed to the conceptualization of the study. All authors reviewed and approved the final manuscript.

Funding

Not applicable

Data availability

The source code of ARYANA and ARYANA-BS, the read simulator for both normal and bisulfite-treated reads, SAM file analyzer which is used for post processing of the alignment penalties, and test procedures for benchmarking different aligners using simulated and real data, are publicly available in (https://github.com/hnikaein/aryana). The first one million reads from each file of SRR3469520 run from NCBI (https://trace.ncbi.nlm.nih.gov/Traces/index.html?view=run_browser&acc=SRR3469520) were used to evaluate the accuracy of the proposed algorithm on real data.

Declarations

Ethics approval and consent to participate

Not applicable

Consent for publication

Not applicable

Conflict of interest

The authors declare that they have no Conflict of interest. AutoX Technologies played no role in the design, development, execution, or interpretation of this study.

Footnotes

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Contributor Information

Hassan Nikaein, Email: nikaein@ce.sharif.edu.

Ali Sharifi-Zarchi, Email: sharifi@sharif.edu.

References

  • 1.Weber M, Davies JJ, Wittig D, Oakeley EJ, Haase M, Lam WL, Schuebeler D. Chromosome-wide and promoter-specific analyses identify sites of differential dna methylation in normal and transformed human cells. Nat Genet. 2005;37(8):853–62. [DOI] [PubMed] [Google Scholar]
  • 2.Varriale A. Dna methylation, epigenetics, and evolution in vertebrates: facts and challenges. Int J Evolut Biol 2014 (2014) [DOI] [PMC free article] [PubMed]
  • 3.Hayatsu H. Discovery of bisulfite-mediated cytosine conversion to uracil, the key reaction for dna methylation analysis—a personal account. Proceedings of the Japan Academy, Series B. 2008;84(8):321–30. [DOI] [PMC free article] [PubMed]
  • 4.Kurdyukov S, Bullock M. Dna methylation analysis: choosing the right method. Biology. 2016;5(1):3. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Meissner A, Gnirke A, Bell GW, Ramsahoye B, Lander ES, Jaenisch R. Reduced representation bisulfite sequencing for comparative high-resolution dna methylation analysis. Nucleic Acids Res. 2005;33(18):5868–77. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6.Li H, Durbin R. Fast and accurate short read alignment with burrows–wheeler transform. bioinformatics, (2009);25(14), 1754–1760 [DOI] [PMC free article] [PubMed]
  • 7.Langmead B, Salzberg SL. Fast gapped-read alignment with bowtie 2. Nat Methods. 2012;9(4):357–9. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Schbath S, Martin V, Zytnicki M, Fayolle J, Loux V, Gibrat J-F. Mapping reads on a genomic sequence: an algorithmic overview and a practical comparative analysis. J Comput Biol. 2012;19(6):796–813. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Feng S, Rubbi L, Jacobsen SE, Pellegrini M. Determining dna methylation profiles using sequencing. In: High-Throughput Next Generation Sequencing. Springer, (2011), pp. 223–238 [DOI] [PubMed]
  • 10.Krueger F, Andrews SR. Bismark: a flexible aligner and methylation caller for bisulfite-seq applications. Bioinformatics. 2011;27(11):1571–2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Bock C. Analysing and interpreting dna methylation data. Nat Rev Genet. 2012;13(10):705–19. [DOI] [PubMed] [Google Scholar]
  • 12.Gong W, Pan X, Xu D, Ji G, Wang Y, Tian Y, Cai J, Li J, Zhang Z, Yuan X. Benchmarking dna methylation analysis of 14 alignment algorithms for whole genome bisulfite sequencing in mammals. Comput Struct Biotechnol J. 2022;20:4704–16. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Xi Y, Li W. Bsmap: whole genome bisulfite sequence mapping program. BMC Bioinform. 2009;10(1):1–9. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Gholami M, Arbabi A, Sharifi-Zarchi A, Chitsaz H, Sadeghi M. Aryana: Aligning reads by yet another approach. In: BMC Bioinformatics, (2014);vol. 15, pp. 1–10. BioMed Central [DOI] [PMC free article] [PubMed]
  • 15.Pedersen BS, Eyring K, De S, Yang IV, Schwartz DA. Fast and accurate alignment of long bisulfite-seq reads. arXiv (2014). https://arxiv.org/abs/1401.1129
  • 16.Farrell C, Thompson M, Tosevska A, Oyetunde A, Pellegrini M. Bisulfite bolt: A bisulfite sequencing analysis platform. Gigascience. 2021;10(5):033. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Sena Brandine G, Smith AD. Fast and memory-efficient mapping of short bisulfite sequencing reads using a two-letter alphabet. NAR Genom Bioinform. 2021;3(4):115. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Sherman, A simple Bisulfite FastQ Read Simulator (BiQRS). https://github.com/FelixKrueger/Sherman
  • 19.Kunde-Ramamoorthy G, Coarfa C, Laritsky E, Kessler NJ, Harris RA, Xu M, Chen R, Shen L, Milosavljevic A, Waterland RA. Comparison and quantitative verification of mapping algorithms for whole-genome bisulfite sequencing. Nucleic Acids Res. 2014;42(6):43–43. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Moore LD, Le T, Fan G. Dna methylation and its basic function. Neuropsychopharmacology. 2013;38(1):23–38. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Varley KE, Gertz J, Bowling KM, Parker SL, Reddy TE, Pauli-Behn F, Cross MK, Williams BA, Stamatoyannopoulos JA, Crawford GE. Dynamic dna methylation across diverse human cell lines and tissues. Genome Res. 2013;23(3):555–67. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Patil V, Ward RL, Hesson LB. The evidence for functional non-cpg methylation in mammalian cells. Epigenetics. 2014;9(6):823–8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Jang HS, Shin WJ, Lee JE, Do JT. Cpg and non-cpg methylation in epigenetic gene regulation and brain function. Genes. 2017;8(6):148. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 24.Ramasamy D, Rao Deva Magendhra AK, Rajkumar T, Mani S. Non-cpg methylation-a key epigenetic modification in cancer. Brief Funct Genom. 2021;20(5):304–11. [DOI] [PubMed] [Google Scholar]
  • 25.Arand J, Spieler D, Karius T, Branco MR, Meilinger D, Meissner A, Jenuwein T, Xu G, Leonhardt H, Wolf V. In vivo control of cpg and non-cpg dna methylation by dna methyltransferases. PLoS Genet. 2012;8(6):1002750. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Balasubramanian D, Akhtar-Zaidi B, Song L, Bartels CF, Veigl M, Beard L, Myeroff L, Guda K, Lutterbaugh J, Willis J. H3k4me3 inversely correlates with dna methylation at a large class of non-cpg-island-containing start sites. Genome Med. 2012;4:1–11. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Catoni M, Tsang JM, Greco AP, Zabet NR. Dmrcaller: a versatile r/bioconductor package for detection and visualization of differentially methylated regions in cpg and non-cpg contexts. Nucleic Acids Res. 2018;46(19):114–114. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.Ehrlich M, Lacey M. Dna methylation and differentiation: silencing, upregulation and modulation of gene expression. Epigenomics. 2013;5(5):553–68. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 29.Greenberg MV, Bourc’his D. The diverse roles of dna methylation in mammalian development and disease. Nat Rev Molecular Cell Biol. 2019;20(10):590–607. [DOI] [PubMed] [Google Scholar]
  • 30.Rountree M, Selker E. Dna methylation and the formation of heterochromatin in neurospora crassa. Heredity. 2010;105(1):38–44. [DOI] [PubMed] [Google Scholar]
  • 31.Tan F, Lu Y, Jiang W, Wu T, Zhang R, Zhao Y, Zhou D-X. Ddm1 represses noncoding rna expression and rna-directed dna methylation in heterochromatin. Plant Physiol. 2018;177(3):1187–97. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Ren W, Fan H, Grimm SA, Kim JJ, Li L, Guo Y, Petell CJ, Tan X-F, Zhang Z-M, Coan JP. Dnmt1 reads heterochromatic h4k20me3 to reinforce line-1 dna methylation. Nat Commun. 2021;12(1):2490. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33.Zhu T, Liu J, Beck S, Pan S, Capper D, Lechner M, Thirlwell C, Breeze CE, Teschendorff AE. A pan-tissue dna methylation atlas enables in silico decomposition of human tissue methylomes at cell-type resolution. Nat Methods. 2022;19(3):296–306. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.Hogart A, Lichtenberg J, Ajay SS, Anderson S, Margulies EH, Bodine DM, Center NIS. Genome-wide dna methylation profiles in hematopoietic stem and progenitor cells reveal overrepresentation of ets transcription factor binding sites. Genome Res. 2012;22(8):1407–18. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Shin Y, Kim M, Won J, Kim J, Oh SB, Lee J-H, Park K. Epigenetic modification of cftr in head and neck cancer. J Clin Med. 2020;9(3):734. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Huang TH-M, Perry MR, Laux DE. Methylation profiling of cpg islands in human breast cancer cells. Human Molecular Genet. 1999;8(3):459–70. [DOI] [PubMed] [Google Scholar]
  • 37.Yegnasubramanian S, Kowalski J, Gonzalgo ML, Zahurak M, Piantadosi S, Walsh PC, Bova GS, De Marzo AM, Isaacs WB, Nelson WG. Hypermethylation of cpg islands in primary and metastatic human prostate cancer. Cancer Res. 2004;64(6):1975–86. [DOI] [PubMed] [Google Scholar]
  • 38.Wen L, Li J, Guo H, Liu X, Zheng S, Zhang D, Zhu W, Qu J, Guo L, Du D. Genome-scale detection of hypermethylated cpg islands in circulating cell-free dna of hepatocellular carcinoma patients. Cell Res. 2015;25(11):1250–64. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 39.Silva Rodrigues G, Noronha NY, Almeida ML, Sobrinho ACDS, Watanabe LM, Pinhel MADS, Lima JG, Zhang R, Nonino CB, Alves CR et al. Exercise training modifies the whole-blood methylation profile in middle-aged and older women. J Appl Physiol (2023) [DOI] [PubMed]
  • 40.Mitsumori R, Sakaguchi K, Shigemizu D, Mori T, Akiyama S, Ozaki K, Niida S, Shimoda N. Lower dna methylation levels in cpg island shores of cr1, clu, and picalm in the blood of japanese alzheimer’s disease patients. PLoS One. 2020;15(9):0239196. [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The source code of ARYANA and ARYANA-BS, the read simulator for both normal and bisulfite-treated reads, SAM file analyzer which is used for post processing of the alignment penalties, and test procedures for benchmarking different aligners using simulated and real data, are publicly available in (https://github.com/hnikaein/aryana). The first one million reads from each file of SRR3469520 run from NCBI (https://trace.ncbi.nlm.nih.gov/Traces/index.html?view=run_browser&acc=SRR3469520) were used to evaluate the accuracy of the proposed algorithm on real data.


Articles from BMC Bioinformatics are provided here courtesy of BMC

RESOURCES