periodicDNA: an R/Bioconductor package to investigate k-mer periodicity in DNA

Periodic occurrences of oligonucleotide sequences can impact the physical properties of DNA. For example, DNA bendability is modulated by 10-bp periodic occurrences of WW (W = A/T) dinucleotides. We present periodicDNA, an R package to identify k-mer periodicity and generate continuous tracks of k-mer periodicity over genomic loci of interest, such as regulatory elements. periodicDNA will facilitate investigation and improve understanding of how periodic DNA sequence features impact function.


Introduction
Short DNA sequence motifs provide key information for interpreting the instructions in DNA, for example by providing binding sites for proteins or altering the structure of the double-helix. A less studied but important feature of DNA sequence motifs is their periodicity [1][2][3][4] . Two famous examples are the universal 3bp periodic (RNY) n pattern (R = A or G, Y = C or U, N = any base) in exons 5 and 10-bp periodic k-mers in nucleosome positioning (reviewed in 6 and 7). However, despite the wealth of software focusing on motif discovery and analysis, no tool provides an easy way to quantify the periodicity of a given motif, i.e. the extent to which a given motif is repeated at a regular interval in specific sequences. For instance, HeliCis and SpaMo identify conserved distances between two motifs in sequences of interest, but they do not assess larger scale periodic occurrences of motifs 8,9 .
Here we present periodicDNA, an R package to investigate k-mer periodicity. periodicDNA provides a framework to quantify the periodicity of any k-mer of interest in DNA sequences. It can identify which periods are statistically enriched in a set of sequences by using a randomized shuffling approach to compute an empirical p-value and can also generate continuous linear tracks of k-mer periodicity strength over genomic loci.

Operation
The two main functions of periodicDNA are getPeriodicity() and getPeriodicityTrack(). The getPeriodicity() function interrogates the extent to which a given k-mer periodically occurs, and at which periods, in one sequence or a set of sequences. It uses a randomized shuffling approach to compute an empirical p-value and identify k-mer periods that are statistically enriched in the sequences of interest. getPeriodicityTrack() generates a linear .bigWig track over genomic loci of interest, representing the periodicity strength of a chosen k-mer at a given period.
periodicDNA is available as an R package on Github. Package dependencies and system requirements are documented here: https://js2264.github.io/periodicDNA/. periodicDNA has been tested using R (version 4.0.2) on Mac OS (versions 10.11 and later) and Ubuntu 18.04.2 machines.

Implementation
Internally, getPeriodicity() and getPeriodicityTrack() functions both compute the power spectral density (PSD) of an input k-mer in input sequence(s) to estimate its average periodicity. The magnitude of the PSD reflects the strength of the k-mer signal at periodic positions 10 . To compute the power spectral density (PSD) of a k-mer of interest in one or several sequences, the following steps are executed ( Figure 1): 1. The k-mer occurrences are mapped and their pairwise distances are calculated ( Figure 1A).
2. The distribution of all the resulting pairwise distances (also called "distogram") is generated ( Figure 1B).
3. The distogram is transformed into a frequency histogram ( Figure 1C) and smoothed using a moving window of 3 to mask the universal three-base genomic periodicity 11 ( Figure 1D). To normalize the frequency for distance decay, the local average (obtained by averaging the frequency with a moving window of 10) is subtracted from the smoothed frequency ( Figure 1E).
4. Finally, the power spectral density (PSD) is estimated using a Fast Fourier Transform ( Figure 1F). The magnitude of the PSD values indicates the contribution of a given period to the overall periodicity of the k-mer of interest. In Figure 1, TT dinucleotides are generally 10bp periodic.
The package relies on BSGenome packages to handle genome assemblies. Genomic loci can be imported from BED files with rtracklayer and are handled in R by the GenomicRanges classes. Biostrings functions are used to map k-mer occurrences in sequences of interest.

Installation
To install the current release of periodicDNA from Bioconductor, use: > if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") > BiocManager::install("periodicDNA") > library("periodicDNA") The distribution of all resulting pairwise distances (also called the "distogram") is generated. (C) The distogram is transformed into a frequency histogram and (D) smoothed using a moving window of 3 to mask the universal three-base genomic periodicity 11 . (E) To normalize the frequency for distance decay, the local average (obtained by averaging the frequency with a moving window of 10) is subtracted from the smoothed frequency. (F) Finally, the power spectral density (PSD) is estimated using a Fast Fourier Transform (F). In this example, TT shows strong 10bp periodicity.
Alternatively, the developing branch of periodicDNA can be installed from Github as follows: > remotes::install_github("js2264/periodicDNA") > library("periodicDNA") Quantifying k-mer periodicity over a set of sequences Using a provided k-mer (e.g. WW, motif argument) and a set of sequences of interest (seqs argument), getPeriodicity() computes several different metrics: 1. The k-mer power spectral density (PSD) values at different periods obtained by Fourier Transform (following the approach described in the Implementation section). For each individual period T, the corresponding PSD T indicates the relative contribution of the period to the overall periodicity of the k-mer of interest 10 .
2. The log2 fold-change, for each individual period T, between the observed PSD T and the median of the PSD T values measured after shuffling n times the input sequences , , 3. Associated empirical p-values and false discovery rates (FDR) indicating, for each individual period T, whether the observed PSD T,observed is significantly greater than PSD T,shuffled values measured after shuffling n times the input sequences We ran getPeriodicity() on a set of 6,533 300-bp long sequences centered at all S. cerevisiae TSSs, to investigate WW periodicity, comparing to 500 shufflings as default. Using 12 cores in parallel, this function took approximately 15 minutes to run. The results were then plotted using plotPeriodicityResults() (Figure 2A), demonstrating the known underlying 10-bp WW periodicity present at promoter sequences in the yeast genome 13 .   To identify periodicity of WW dinucleotides, getPeriodicity() was run on (A) a set of 300-bp long sequences centered at 6,533 S. cerevisiae TSSs and (B) a set of 300-bp long sequences centered at 2,295 ubiquitous C. elegans TSSs 14 . The plotPeriodicityResults() function was run on the getPeriodicity() results to generate three plots as shown. Left, frequency histogram of distribution of pairwise WW distances; middle, normalised frequency histogram of distribution of pairwise WW distances; right, power spectral densities (PSDs) of a set of experimental sequences (red) and 500 iterations of shuffled sequences (grey). Grey ribbon represents the 95% confidence interval of the PSD values obtained after sequence shuffling. Red-filled dots represent PSD values in experimental sequences statistically higher than those from shuffled sequences (FDR < 0.05).
Using the same approach, we measured the WW periodicity around ubiquitous TSSs in C. elegans, which have been characterized as largely enriched for WW 10-bp periodic sequences 14 ( Figure 2B). The 10-bp WW periodicity at ubiquitous C. elegans TSSs is stronger than at all S. cerevisiae TSSs. ATAC-seq signal and 10-bp WW dinucleotide periodicity at three C. elegans promoters. 10bp WW dinucleotide periodicity signal was generated at 1 kb centered at annotated C. elegans promoters 14 using the `generatePeriodicityTrack()` function. The data are vizualised using IGV.
input genomic loci are split into small sliding windows and for each window, the k-mer periodicity is quantified as described in the Implementation section. The PSD value at the period of interest (e.g. period = 10) is then retrieved and assigned to the center of the corresponding window. Finally, the resulting .bigwig track is smoothed using a rolling window (smooth_track = 20). generatePeriodicityTrac() should be run in parallel across many cores using the BPPARAM argument from BiocParallel. Using 12 cores, this command takes approximately half a day to produce a periodicity track over ~ 15,000 1-kb-long GRanges with default parameters.
As an example, we generated a WW 10-bp periodicity linear track over annotated promoters in C. elegans genome. In the previous section, we have shown that sequences in the vicinity of ubiquitous TSSs were statistically enriched for WW 10-bp periodicity. Here, the .bigwig track highlights the increased WW 10-bp periodicity in the sequences immediately flanking ubiquitous promoters, where the -1 and +1 nucleosomes are positioned 14 .

Conclusion
periodicDNA is an R package that provides functions to investigate the periodicity of k-mers of interest in DNA sequences. It is primarily designed to analyse individual or sets of sequences (typically few hundred bases long and up to a kilobase) to identify overall periodicity of a chosen k-mer. It can also generate linear .bigwig tracks of k-mer periodicity at a chosen period (e.g. 10-bp WW periodicity), over genomic loci of interest. peri-odicDNA is well integrated within the Bioconductor environment and can easily fit in standard genomic analysis workflows.

Data availability
Underlying data This project contains underlying data published in Serizay et al., 2020 14 . All the data are also available from the original reference. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Boris Lenhard
Institute of Clinical Sciences, Faculty of Medicine, Imperial College London, London, UK periodicDNA is a R/Bioconductor package for the detection and visualisation of string-based periodic motifs (k-mers) in DNA sequences. While there are several periodic motifs that are known to occur in genomic sentences, the paper -and, for the most part, the tool itself -focuses on the analysis of by far the most important of them, the 10-bp periodicity of WW dinucleotides that is the hallmark of nucleosome positioning signals, present in the majority of RNA polymerase II promoters, in most eukaryotic genomes analysed so far.
The tool implements the calculation of power spectral density over the distances between the instances of k-mers in a set of sequences by normalising the frequencies of pairwise TT distances against "smoothed" distances. It has only a couple of main functions, one for performing general power spectrum analyses, with table of power spectral density as a result, and one that produces a genome browser track for a selected set of sequences using a predefined period size. The latter is shown to produce a characteristic double pattern at bidirectional promoters in C. elegans ( Figure  3).
The tool is simple, clean, and seems to do its job well. I have only a couple of suggestions: The smoothed local average ( Figure 1D) uses a 10 bp window. While that is a suitable window size for nucleosome positioning signal, it might not work for exploring other, possibly unknown periodic motifs. It should at least be remarked on, and the authors should consider adding functionality to suggest an optimal or at least minimal window size for averaging.

○
The stated running times on a 12-core CPU for the presented examples look surprisingly long to me. Could the authors provide more detail -with or without profiling the codeabout which computational step is the reason the whole calculation takes this long? ○ Is the rationale for developing the new software tool clearly explained? Yes

Is the description of the software tool technically sound? Yes
Are sufficient details of the code, methods and analysis (if applicable) provided to allow replication of the software development and its use by others? Partly

Is sufficient information provided to allow interpretation of the expected output datasets and any results generated using the tool? Yes
Are the conclusions about the tool and its performance adequately supported by the findings presented in the article? Yes © 2021 Ioshikhes I. This is an open access peer review report distributed under the terms of the Creative