Weighted persistent homology for biomolecular data analysis

In this paper, we systematically review weighted persistent homology (WPH) models and their applications in biomolecular data analysis. Essentially, the weight value, which reflects physical, chemical and biological properties, can be assigned to vertices (atom centers), edges (bonds), or higher order simplexes (cluster of atoms), depending on the biomolecular structure, function, and dynamics properties. Further, we propose the first localized weighted persistent homology (LWPH). Inspired by the great success of element specific persistent homology (ESPH), we do not treat biomolecules as an inseparable system like all previous weighted models, instead we decompose them into a series of local domains, which may be overlapped with each other. The general persistent homology or weighted persistent homology analysis is then applied on each of these local domains. In this way, functional properties, that are embedded in local structures, can be revealed. Our model has been applied to systematically study DNA structures. It has been found that our LWPH based features can be used to successfully discriminate the A-, B-, and Z-types of DNA. More importantly, our LWPH based principal component analysis (PCA) model can identify two configurational states of DNA structures in ion liquid environment, which can be revealed only by the complicated helical coordinate system. The great consistence with the helical-coordinate model demonstrates that our model captures local structure variations so well that it is comparable with geometric models. Moreover, geometric measurements are usually defined in local regions. For instance, the helical-coordinate system is limited to one or two basepairs. However, our LWPH can quantitatively characterize structure information in regions or domains with arbitrary sizes and shapes, where traditional geometrical measurements fail.

The great success of persistent homology based machine learning models depends on the multiscale topological features obtained from biomolecular structures [9][10][11] . Unlike all previous geometric and topological models, which either focus on local structure information or study qualitative global properties, persistent homology embeds the geometric information into the topological invariants, thus provides the first quantitative topological measurements. With the proposed filtration process, a series of nested simplicial complexes, which are encoded with structural topological information from different scales, are generated in PH. These simplicial complexes provide a multiscale topological profile of the structures. Topological features, such as individual components, holes, circles, and voids, can be evaluated from them. More importantly, some features persist while other die quickly during the filtration. The "lifespans" or "persisting times" provide a size measurement of the topological features [12][13][14] . With its unique power in data simplification and structure representation, PH has already been applied to various fields, including shape recognition 15 , network structure [16][17][18] , image analysis [19][20][21][22][23] , data analysis [24][25][26][27][28] , chaotic dynamics verification 29 , computer vision 23 , computational biology [30][31][32][33][34][35][36][37] , amorphous material structures 38,39 , etc. Many powerful softwares, including JavaPlex 40 , Perseus 41 , Dipha 42 , Dionysus 43 , jHoles 44 , GUDHI 45 , Ripser 46 , PHAT 47 , DIPHA 48 , R-TDA package 49 , etc, have been developed. The persistent times of topological features can be represented or visualized by several models, including persistent diagram (PD) 14 , persistent barcode (PB) 50 , persistent landscape 51,52 , persistent image 53 , persistent curves 54,55 , etc. However, traditional persistent homology models use only one filtration parameter, significantly hindering their applications in revealing some heterogeneous properties. To overcome this problem, several multidimensional filtration PH models have been proposed. These models can greatly boost the performance of traditional PH models. Another important approach is to design weighted persistent homology (WPH). The essential idea of WPH is to introduce weight information, which reflects certain physical, chemical or biological properties, into the simplicial complex generation or homological generator calculation. In this way, the topological features, obtained from WPH, will characterize more heterogeneous biomolecular properties.
Generally speaking, the weighted persistent homology can be characterized into three major categories, vertex-weighted 35,[56][57][58][59][60] , edge-weighted 2,5,35,44,61,62 , and simplex-weighted models [63][64][65] . For vertex-weighted models, a weight value is defined on each vertex. Among these methods, the weighted alpha complex is the first model that has been used in biomolecular structure characterization 58 . By assigning a weight value to each atom, a modified distance function can be proposed and further used to generate the weighted Voronoi cell. The weighted alpha complex is a subset of weighted Delaunay complex, which is the dual of weighted Voronoi diagram. Other vertex-weighted models consider different types of weighted distance functions 56,57,59 . In a weighted Vietoris-Rips and Čech complex model, a new distance function is proposed as a minimal value of the scaled Euclidean distances between the current position to all atoms 56 . The inverse of the distance function represents the union of balls centered at the atom, and naturally induces weighted Čech complexes through nerve theorem 56,59 . Weighted Vietoris-Rips complexes can be constructed by scaling the Euclidean distances between any two atoms by their weights 56 . Similarly, k-distance functions are proposed and can be used to produce weighted Čech complexes 59 . To characterize the multiscale properties of the biomolecules, a multiscale rigidity function is proposed 35,60,66 . Each atom is associated with a weighted kernel function with a scale parameter. A rigidity function is defined as the summation of all the kernel functions and can be used to generate a series of nested Morse complexes in persistent homology. Unlike vertex-weighted models, edge-weighted models usually specify unique weight values on edges 44,61 . Using weight value as a filtration parameter, Vietoris-Rips or clique complex can be defined as a maximal simplicial complex, whose 1-skeleton has weight values larger (or smaller) than a certain filtration value 57 . For weighted clique rank homology model 61 , a network/graph, with a weight value on each edge, is considered. Clique complex can be defined on the subgraph composed of edges with weight larger than filtration value. A series of physics-aware models are proposed to characterize interactions within and between the biomolecules [2][3][4][5][6][7][8]35,62 . Various modified or generalized distance matrixes are used in these models. Further, simplex-weighted persistent homology models, based on weighted boundary operators, are proposed [63][64][65] . In these models, weight values are defined on simplexes in different dimensions. To ensure the consistence of the homology definition, weight values on different simplexes need to satisfy certain constraints or relations, so that a weighted boundary operation can be well-defined.
In this paper, we propose a localized weighted persistent homology LWPH. Our LWPH model is inspired by the recent great success of element specific persistent homology (ESPH) models as mentioned above. Unlike all previous weighted persistent homology models, which treat biomolecules as an inseparable system, ESPH decomposes the structure into a series of sub-structures made of certain type(s) of atoms. The subnetworks or subgraphs, especially those from protein-ligand complexes, have been proved to capture important biological properties, such as hydrophobic or hydrophilic interactions. In this way, ESPH models have delivered amazing results in biomolecular data analysis [2][3][4][5][6][7][8] . Further, our LWPH models are different from traditional persistent local homology (PLH) [67][68][69][70][71][72] . The PLH studies the relative homology groups between a topological space and its subspace. It is usually used to assess the local structure of a special point within a topological space. In our LWPH, the biomolecular structures and configurations are decomposed into a series of local domains, that may overlap with each other. The general persistent homology or weighted persistent homology analysis is then applied on each of these local domains. In this way, DNA local structure, dynamics and functional properties can be embedded in our LWPH models. Our model has been used in the analysis of DNAs. It has been found that our LWPH based features can be used to successfully discriminate A-, B-, and Z-types of DNA. More importantly, our LWPH based principal component analysis (PCA) model can identify two configurational states of a DNA system in ion liquid environment, which can only be revealed by the complicated helical coordinate representation. The great consistence with the helical-coordinate model demonstrates that our model captures the local structure variations so well that it is comparable with geometric models. Moreover, geometric measurements are usually defined in very local regions, for instance the helical-coordinate system is limited to one or two basepairs. However, our localized weighted homology can quantitatively characterize structure information in a much larger domain, where traditional geometrical measurements fail.

Methods
In this section, we will provide a brief review of the weighted persistent homology models and their applications in biomolecular data analysis. After that, a detailed discussion of our localized weighted persistent homology model will be presented.
Weighted persistent homology. The essential idea of weighted persistent homology models is to introduce a specially-designed weight function/parameter that incorporates the biomolecular physical, chemical or biological properties, into the construction of simplicial complexes or homology generator evaluation. Generally speaking, all these WPH models can be classified into three types, including vertex-weighted 35,56-60 , edge-weighted 2,5,35,44,61,62 , and simplex-weighted models [63][64][65] .
To facilitate our discussion, we define a weighted point set as X V For each point x i , a weight v i is assigned to it. We use d x x ( , ) i j to represent the Euclidean distances between two points x i and x j . Biologically, the weight V is usually chosen to be the radius, atom number, etc.
Vertex-weighted persistent homology. Weighted alpha complex: In weighted alpha complex 58 , a weighted distance is defined as The weighted Voronoi region or Voronoi cell can be defined as . The intersection of t-weighted closed balls and Voronoi cells is In this way, the weighted alpha complex can be expressed as, Essentially, the weighted alpha complex is a subsect of weighted Delaunay complex, which is the dual of weighted Voronoi diagram.
The nerve N is the abstract simplicial complex from the closed balls. The weighted Vietoris-Rips Complex is defined as VR X V For a filtration parameter ≥ t 0, weighted Čech complex at scale t can be denoted as i i and the weighted Vietoris-Rips Complex at scale t can be expressed as Moreover, we can define a distance function as = In this way, we have the inverse and it is homotopy equivalent to Čech X V t ( , , ) as in Eq. (1). Computationally, the weighted Vietoris-Rips Complex 56 can be constructed by using a weighted distance Various softwares, such as JavaPlex 40 denotes the k nearest neighbors in X to the point x. Further, it can be expressed as power distance as follows, www.nature.com/scientificreports www.nature.com/scientificreports/ Here Bary X ( ) k denotes the barycenters of any subsets of k points of X and Moreover, the sublevel sets of the k-distance d X k , are finite union of balls, X k x Bary X x , 1 ( ) 2 1 /2 k Similar to Eq. (2), the inverse of this distance function is homotopy equivalent to a weighted Čech complex, which is the nerve of the closed balls 59 .
Rigidity function based models: Multiscale topological simplification models have been proposed 35,60,66 . The key part of these models is multiscale rigidity function, Here η i is the scale parameter and η Φ d x x ( ( , ); ) i i can be chosen from any monotonically-decreasing functions, such as the generalized power-law equation, i i and the generalized exponential equation, Unlike previous distance functions in Eqs. (2) and (3), the inverse of rigidity function µ − t ([0, ]) 1 may not be expressed as a union of balls. However, it can generate Morse complexes. Computationally, the discrete Morse models can be used to evaluate the persistent homology.
Edge-weighted persistent homology. The essential idea for the edge-weighted persistent homology models is to assign a weight to each edge. With weight as filtration parameter, the Vietoris-Rips complex can be defined as the maximal simplicial complex whose 1-skeleton has weight values larger (or smaller) than the filtration value. Computationally, a weighted distance matrix is usually proposed. The filtration is achieved through the increasing (or decreasing) of the weighted distance value.
Weighted clique rank homology: The weighted clique rank homology is defined on weighted complex networks 44,61 . For weighted networks, each edge/link has a weight on it. The filtration goes from the largest weight to the lowest one. At each filtration value t, a subgraph composed of edges with weight larger than t is formed. Based on the subgraph, clique complex can be constructed. In this way, with the decrease of filtration value, a series of clique complexes are built and their homology and persistence can be calculated.
Physics-aware models: Recently, a series of new persistent homology models have been proposed to characterize the various physical interactions within and between the biomolecules 2,5,35,62 . In these models, the distance matrix between atoms is modified based on their physical properties, including covalent bonds, protein-ligand interactions, electrostatic interactions, etc. To avoid confusion, we call them as physics-aware persistent homology.
For a biomolecule or biomolecular complex, we denote their atomic coordinates as Various modified distance matrices are proposed to characterize different physical, chemical and biological properties of the biomolecular structure. Definition 2. Multi-level persistent homology model 2 considers a modified distance matrix as follows, In computation, we can take ∞ as any value larger than the filtration size. More generally, we can define an n-th level matrix 2 as It has been found that when the modified matrices are employed, the barcode representation is significantly enriched and is able to capture the tiny structure perturbation between the conformations. Further, an interactive persistent homology model is proposed for protein-ligand binding analysis. Definition 3. An interactive persistent homology model is based on the revised distance matrix as follows, www.nature.com/scientificreports www.nature.com/scientificreports/ In this way, interactions between two molecules, such as protein-protein, protein-DNA/RNA, protein-ligand, DNA/RNA-ligand, etc, can be incorporated into topological invariants.
Essentially, Physics-aware persistent homology models 2 are all based on the generalized matrix i j can be any function properties, including van der Waals interaction, electrostatic potential, or any other generalized correlations.
Simplex-weighted persistent homology. Weighted simplicial homology: Weighted simplicial homology is a generalization of simplicial homology [63][64][65] . Every simplex has a weight in a ring R, and the boundary map is weighted accordingly. When all the simplices have the same weight ∈ a R\{0}, the resulting weighted homology is the same as the usual simplicial homology. We list some of the key definitions and results below. Definition 4. A weighted simplicial complex is a pair K w ( , ) consisting of a simplicial complex K and a weight func- , where R is a commutative ring, such that for any σ 1 , is a simplicial subcomplex of K. For the definition of homology of weighted simplicial complexes, we require R to be an integral domain with unity 1.
is the map: where the face maps d i are defined as: where ∂ refers to the relevant weighted boundary map. Definition 6. We define the weighted homology of a weighted simplicial complex to be where ∂ n is the weighted boundary map. Proposition 2.1. Proposition. If all the simplices in K w ( , ) have the same weight ∈ a R\{0}, the weighted homology functor is the same as the usual simplicial homology functor.
Weighted persistent homology: Given a weighted filtered complex Localized weighted persistent homology. In all the above WPH models, weights are defined on the whole system to reveal the intrinsic global structural properties. Stated differently, all these models treat a biomolecule structure as an inseparable system, and explore their topological properties using the whole structure. In contrast, ESPH models 2-8 decompose a biomolecular structure into a series of sub-structures made of certain type(s) of atoms. It has been found that the generated subnetworks or subgraphs, especially those from protein-ligand complexes, can capture important biological properties, such as hydrophobic or hydrophilic interactions 2 . Different from WPH and ESPH models, persistent local homology considers the relative homology groups between a topological space and its subspace. Usually, persistent local homology focuses on the local structure around a special point in a certain topological space.
Motivated by the success of ESPH models, we introduce our localized weighted persistent homology. Instead of decomposing biomolecular structures by their atom types, we focus on local biomolecular regions or domains and study their topological properties. For a better introduction of our LWPH, we will briefly review ESPH and PLH first.
Element specific persistent homology: Biomolecules are made of various atoms with different properties. In protein, DNA or RNA, there are five common types of atoms, including C, N, O, P, and S, and several metal ions, such as Fe, Mn, Zn, etc. Ligands are small molecules, that interact with the protein, DNA or RNA. Other than the common five types of atoms, they may have some other unique atoms, such as F, Cl, Br, I, etc.
Generally speaking, ESPH is proposed to characterize the topological properties within the structure formed by one or several types of atoms [2][3][4][5]7 . Mathematically, it is achieved by assigning weight value 1 to the selected types of atoms, and weight value 0 to all the rest atoms. For instance, all C atoms from both protein and ligand can be selected to form C-networks or graphs. The topological properties of these structures characterize the Generally speaking, local homology is used to evaluate the local structure of a topological space. Persistent local homology can be used in dimension reduction and manifold dimension detection [69][70][71] .
Localized weighted persistent homology: The essential idea of our LWPH is to focus on local regions, of biomolecular structures or configurations, that incorporate the important physical, chemical or biological information, and perform the persistent homology analysis on them. In many situations, there may be several domains that are of great interest and we need to perform LPH on each domain. More generally, we can decompose biomolecular structures into a series of (overlapping) domains. For each domain, we carry out LWPH on all (or certain type(s) of) atoms that are of particular interest. In this way, a series of local topological properties can be obtained and we call them localized topological fingerprints. To avoid confusion, if the general persistent homology is considered, we call it localized persistent homology (LPH). If a weighted persistent homology is considered, we call it localized weighted persistent homology (LWPH).
More specifically, for a biomolecule or biomolecular complex with atomic coordinates  (6) and (7) can be constructed on each of the domain. In this paper, we will focus on the study of DNA, which is made of paired nucleotides. We can consider the weighted distance matrix on the domain X I as follows, , atoms and are from different nucleotide residues; , o therwise (8) ij I i j i j I By using different weight values, LWPH can be designed to capture various local properties in biomolecular structures. The application of LPH and LWPH can be found in following sections.
It should be noticed that we still regard our LPH as a weighted persistent homology model. Essentially, we can set weight as a vector composed of only 1 and 0, and only atoms within the local region have weight values as 1.

Results
In this section, we discuss the application of our localized persistent homology and localized weighted persistent homology in the study of DNA structures. To avoid confusion, only the weight definition as in Eq. (8) is used in our LWPH. The persistent barcodes are used for the representation and visualization of LPH and LWPH results. The persistent Betti numbers (PBNs) are evaluated from barcodes. A systematical evaluation of PBNs under helical coordinates demonstrates the incorporation of the geometric information in our LPH and LWPH models. Further, we show that PCA of the feature vectors from LWPH based PBNs can be successfully used in the classification of the A-, B-, and Z-types of DNAs. Moreover, we explore DNA structure variations in both water and ion liquid (IL) environments using molecular dynamics. With LWPH based feature vectors, we can not only reveal the confinement effect of DNA configurations from water to IL environment, but also identify two DNA configurational states in IL environment. Detailed analysis shows that global-scale PCA models, including atom-coordinate-based PCA, common PH-based PCA, and ESPH-based PCA, all fail in clustering the DNA configurational states in IL. In contrast, LWPH based all-atom or selected-atom models are always able to characterize the DNA structure variations in IL environment. The LWPH results are highly consistent with the helical-coordinate based PCA model. DnA local topological features. DNA molecule has a double helical structure composed of four types of nucleotides, i.e., A, T, G, and C. It has remarkably different scales, ranging from nucleobases, minor and major grooves, to larger structures like nucleosome, chromatin, and then to chromosome. We have proposed a multi-resolution PH model to characterize structural topological features or topological fingerprints of DNA structures in different scales 60,66 . However, the model focuses on the global DNA topology. In this section, we explore DNA topological features from local structures, i.e., DNA localized topological fingerprints. We study the barcodes for both LPH and LWPH models, i.e., one with traditional persistent homology and the other with the weighted persistent homology as in Eq. (8). Different local structures can be systematically studied. In the current paper, our focus is local topological features from different DNA base pairs or base steps. www.nature.com/scientificreports www.nature.com/scientificreports/ To facilitate a better description, we introduce some basic notations. In general, results from PH can be represented as pairs of "birth" and "death" times, i.e., the filtration values for homology generators to appear and disappear. We denote them as follows, here a j k , b j k , l j k to represent "birth", "death", and "persistence" for j-th generator of k-th dimensional Betti number, respectively. And N k is the total number of k-th dimensional topological generators. Due to the limited number of atoms in a local structure, we only consider dimension k equals to 0 and 1. Further, different PH based functions are proposed for the visualization, representation and modeling of topological information 24,51,54,73 . Persistent Betti number, or Betti curve, is one of them. It is defined as the summation of all the k-th dimensional barcodes, is a step function, which equals to one in the region a b [ , ] j k j k and zero otherwise.
As a simple one-dimensional function, PBN has been used in data analysis for dimensionality and complexity reduction. Moreover, PBN based feature vectors can be input into various machine learning models [2][3][4][5][6][7][8] . In this section, PBN based PCA models are used in DNA structure classification and trajectory clustering.
LpH and LWpH for DnA structure representation. As stated above, we consider two types of LPHs, one is LPH with Euclidean distance matrix and the other is LWPH with a similar weighted distance matrix as in Eq. (8). For LWPH, we assume the distance between two atoms from same nucleotide residue to be infinity, and the distance between two atoms from different residues to be their Euclidean distance. In this way, our LPH characterizes topology from covalent-bond-formed structure, while our LWPH reveals topological information on non-covalent bond properties. The DNA base-pair structures are generated by using the 3DNA software 74 . Figure 1 illustrates LPH barcodes for different combinations of base pairs. Shorter β 0 bars (with length around 1.0 Å to 1.5 Å) correspond to covalent bonds, longer β 0 bars with length around 2.8 Å correspond to the hydrogen bonds between paired bases. For β 1 bars, longer ones appear in earlier stage of filtration, i.e., from around 1.4 Å to 2.4 Å, correspond to sugar rings and nitrogenous base rings. The longer β 1 bars range from around 2.9 Å to 3.6 Å, representing loops between paired bases. It can be seen that each A-T pair only contributes one such longer β 1 bar, while each G-C pair contributes two. www.nature.com/scientificreports www.nature.com/scientificreports/ Figure 2 illustrates the corresponding LWPH barcodes for different combinations of base pairs. Similar to LPH results, the total number of β 0 bars is exactly the number of atoms, and shorter β 0 bars with length around 2.8 Å correspond to hydrogen bonds between paired bases. Different from LPH results, more hydrogen-bond related β 0 bars appear in LWPH barcode than LPH barcodes. And the lengths of β 0 bars for LWPH are systematically longer than those for LPH model, indicating that more long-range interactions related information are preserved in our LWPH model. Moreover, the β 1 barcodes for LWPH are much more complicated. Their geometric meanings are not as straightforward as LPH models. Generally speaking, the β 1 bar in LWPH represents loop or ring structure with edges between different nucleotides. In this way, a much larger amount of β 1 bars are generated. Moreover, when there are only two nucleotides (or one base pair), the β 1 bars persist forever.
In general, LPH and LWPH characterize different structure properties, the former is more about covalent-bond related topology while the latter is more about topology from non-covalent bonds. Physically, covalent bonds are much stronger than non-covalent bonds. In this way, LPH are relatively more "stable" and less sensitive to structure variations under thermal fluctuations. While LWPH are less "stable" and much easier to change if there is some external perturbations.

LpH and LWpH based DnA structural analysis. With the embedded geometric information, LPH and
LWPH can be used in not only qualitative but also quantitative analysis of different structures. To assess LPH and LWPH based quantitative analysis, we systematically generate a series of DNA base-pair configurations using DNA helical coordinates. According to the Cambridge University Engineering Department Helix computation Scheme (CEHS) 75 , the motion of a base pair or two neighbouring base pairs can be depicted by 12 helical parameters, including 6 one-base-step related parameters, i.e., shear, stretch, stagger, buckle, propeller and opening, and another 6 two-base-step related parameters, i.e., shift, slide, rise, tilt, roll and twist. For each parameter, we prepare 11 DNA structures, with parameter value taken equally from µ σ − 2 i i to µ σ + 2 i i , using 3DNA 74 . Here µ i , σ i are the mean value and standard deviation of parameter i. And the rest of the helical parameters remain as constants, i.e., their mean values. The mean value and standard deviation of each parameter can be obtained from crystal structures 75 . In DNA helical coordinate evaluation, only the base atoms and C1′ of the sugar ring are considered. For a fair comparison, the same atoms are used in our LPH and LWPH models.
We apply our LPH and LWPH on these series of DNA local structures and check if the quantitative structure variations are reflected in their barcodes. To facilitate a systematical comparison, we consider the PBN function in Eq. (9). For each helical parameter, we take the natural logarithm of all its PBN functions and stack them together to form a two-dimensional image. Note that we systematically add 1 to all PBN functions to avoid  8) is considered. Only the distances between two atoms from different nucleobases are set to be their Euclidean distance, while other distances are set to infinity. The shortest β 0 bars are distances between adjacent atoms from two bases. They characterize the hydrogen bonds between two nucleobases. For a single base pair (A-T or G-C) situation, the generated β 1 bars will never be "killed" as no 2-simplexes can be formed. www.nature.com/scientificreports www.nature.com/scientificreports/ computational problem (from ln 0). Figures 3 and 4 illustrate the results of our LPH and LWPH for two-base-step parameters, respectively. The AT/AT base steps are considered. It can be seen that instead of remaining unchanged for all helical parameter values, both β 0 and β 1 PBN functions for LPH and LWPH models vary greatly, indicating that both models are sensitive to subtle structure variations. More specifically, in LPH based PBN, β 1 functions seem to have comparably larger variations than β 0 functions. In LWPH based PBN, β 0 functions seem to have greater variations than β 1 functions. We also check the β 0 and β 1 PBN functions for LPH and LWPH models for one base step. The results are demonstrated in Figs. 9 and 10 in Supplementary. Both functions in those two models show variations with the change of helical parameter value.   Fig. 3. It can be seen that, similar to LPH based PBNs, LWPH based β 0 (upper figures) and β 1 (lower figures) PBN functions vary with the change of helical parameter value. However, the change of β 0 PBN functions seem is more dramatic in LWPH models.
Since PBN functions from LPH and LWPH are sensitive to the structure variations, we can use them as measurements for DNA structure, function and dynamics analysis. In the following sections, PBN and PBN based features are used in the classification of DNA types and clustering of DNA trajectories.
Local topological feature based DNA classification and clustering. In this section, we study local topological feature based DNA classification and clustering. Essentially, topological features are extracted from PBNs, which are generated from LPH or LWPH. Figure 5 illustrates the LPH and LWPH based DNA featurization. Note that the results from LPH and LWPH can also be represented as persistent diagram 14 , persistent barcode 50 , persistent landscape 51,52 , persistent image 53 , persistent curves 55 , etc. Based on these representations, other featurization forms can also be considered 76 . In this paper, we focus on PBN based featurization.
Classification of three typical DNA forms. We consider three types of DNA structures, including A-, B-and Z-forms. We randomly pick 10 PDB files from each form of DNA and the PDB IDs are shown in Table 2 in Supplementary. In LPH and LWPH, the same atom combination of each base step is chosen as in the above case, i.e., base atoms and C1′ of the sugar ring. The PBN function is calculated for each base step. To systematically compare the PBNs for three types of DNA forms, we summarize all the PBNs from the same DNA form and then compute the average.
The results from LWPH are demonstrated in Fig. 6. It can be seen that the three PBN profiles have very different β 1 , particularly on the filtration range from 4.0 Å to 7.0 Å. Further, we consider the PCA for DNA classification. For each DNA structure, we define a vector made of the average β 0 and β 1 PBN values equally taken from 2.0 Å to 8.0 Å with an interval 0.1 Å. In this way, a feature vector with 120 elements is defined for all 30 DNA structures. The PCA results are demonstrated in Fig. 6. Here x-axis and y-axis represent the first and second eigenvectors (principal components), respectively. It can be seen that three forms of DNA locate in the different regions with clear boundary, which further confirms that LWPH based features can distinguish the subtle conformational deviation. Figure 11 in Supplementary shows the results from LPH. In comparison with LWPH, LPH based PBNs show no obvious difference, and PBN based PCA does not classify the dataset into three individual clusters. Figure 5. LPH and LWPH based DNA featurization. In our DNA cases, the local region is defined as the two adjacent base-steps. The common Euclidean distance matrix is considered in LPH, while the weighted distance matrix as in Eq. (8) is used in LWPH. From LPH or LWPH, PBNs can be calculated and then discretized into vectors, which can be used as a representation of DNA structures. www.nature.com/scientificreports www.nature.com/scientificreports/ Clustering of DNA conformations in different environments. We have demonstrated the DNA structure classification with our LWPH. However, A-, B-and Z-forms of DNAs are static and have relatively "large" configurational differences. In the following, we consider a more challenging case. That is the clustering of the molecular dynamics simulations of the same DNA molecule in different solvent environments.

Molecular dynamics setting.
A brief introduction of the MD procedure is presented as follows. The initial structure of 16-mer DNA duplex is prepared using 3DNA 74 and centered in a cubic box. Two different solution environments are used, including ion liquid (IL) and water (WAT). For IL environment, 600 BMIM + and 600 − BF 4 are firstly inserted and the box is then solvated with TIP3P water and Na + . For WAT environment, the box is directly solvated with water and Na + . After a 100 ps thermostat and 100 ps barostat, the system then goes through a 100 ns product MD. Under each environment setting, we conduct 3 repeated MD simulations, so we obtain 6 trajectories in total. We denoted them as IL1-3 (trajectory 1 to 3 in IL) and WAT1-3 (trajectory 1 to 3 in water). All the simulations are conducted using GROMACS 4.6 package 77 . In our data analysis, 5000 sample frames evenly sampled from the last 10 ns trajectory of 6 simulations are considered. The detailed MD simulation setting and parameters can be found in the related paper 78 .
Weighted persistent homology modeling. For DNA conformation clustering, we extract 13 non-terminal DNA base steps for each frame of the simulation data. Similar to DNA-type classification case, for each base step, we construct a 120-element PBN feature from the LWPH. Then, we concatenate all 13 sets of PBN values together into feature vector for each DNA configuration. This LWPH based feature vector is used in the PCA of DNA trajectories in different environments. More specifically, a covariance matrix of feature vectors for all the frames is built up, and further eigen-decomposed into principal components (eigenvectors). The first two eigenvectors construct a plane and all feature vectors are projected to it. For comparison, in both IL and water, we apply PCA not only on three individual MD trajectories, but also the ensemble made of all three trajectories together. The results are demonstrated in Fig. 7. The projected points are illustrated as their contour values for a better visualization. To avoid confusion, Fig. 7(a 1 -a 4 ) are for DNA trajectories in IL environment. Among them, Fig. 7(a 1 ) is for the ensemble of all three trajectories. Figure 7(a 2 -a 4 ) are for the three trajectories, respectively. Figure 7(b 1 -b 4 ) are for DNA trajectories in water environment. Among them, Fig. 7(b 2 -b 4 ) are for the three trajectories, respectively, and Fig. 7(b 1 ) is for the ensemble of all three trajectories.
Several unique properties can be seen from Fig. 7. Firstly, the confinement effect, i.e., the reduction of distribution area, can be clearly observed in IL environment. In fact, we can count the area of the distribution in IL and water and the results are listed in Table 1. It can be seen that, the areas of distribution map in IL are up to 2/3 of that in water, the smaller area confirms the fluctuation of DNA in IL is greatly attenuated. Secondly, contour graphs for IL and WAT show significantly different patterns. For IL solution, two centers can be clearly identified from contour graph in Fig. 7(a 1 ). Among them, one locates on upper left and the other locates on right part. In contrast, for water solution, only one center can be found and its position differs greatly from the ones of IL systems. The huge difference indicates the change of DNA conformations in different environments. Further, for water solution, all contour graphs have nearly the same distribution, indicating that all three trajectories behaved www.nature.com/scientificreports www.nature.com/scientificreports/ quite similarly. In contrast, for IL solution, contour graph for IL1 shows a clear difference of those for IL2 and IL3, meaning there is a subtle change of ion-DNA binding mode in trajectory IL1. Figure 12 in Supplementary shows the observed variation of ion-DNA binding in different metastates in IL1. Our LWPH based PCA is sensitive enough to capture this subtle structure variation.
Our LWPH based results are highly consistent with previous results from the helical parameter based model 78 . As demonstrated in Fig. 8, similar confinement effect is also observed in CEHS based contour graphs for IL solution. Further, CEHS results show two different centers, while WAT contour graphs have only one center. This means that, CEHS model also captures the subtle change of ion-DNA binding mode in trajectory IL1. To further check if our LWPH and CEHS models identify the same type of ion-DNA configurational changes, we decompose the contour graphs of IL1 into 10 separated subgraphs, each of them represent the DNA trajectories in 1 ns. We can clearly identify four center regions from these subgraphs, and they are consistent with results from HP based PCA. This further indicates that our LWPH based models are highly sensitive to DNA local structural variations. The results are demonstrated in Figs. 13 and 14 in Supplementary.
Further, it should be noted that the local DNA structure variations in IL1 cannot be captured by the general global models. As demonstrated in Fig. 15 in Supplementary, the general atom-coordinates based PCA fails to capture the DNA structure variation in IL1, even thought it manages to preserve the confinement effect (details in Table 1). Similarly, LPH based model also fails to reveal the variation. Moreover, it even cannot reveal the confinement effect of IL environment. Details can be found in Table 1 and Fig. 16 in Supplementary. This is largely due to the reason that LPH based model focuses more on the covalent bonds and its related structures. Even though different combination of atoms are considered, both coordinate-based PCA and LPH-based PCA are unable to identify the structure variation. In contrast, not only the general LWPH model works, we also construct different LWPH models by taking different combinations of backbone atoms and base atoms at local scale. For instance, according to CEHS scheme, we can take C8, C4, N1 and C1′ of purine base and N3, C6 and C1′ of pyrimidine base, as shown in Fig. 17 in Supplementary. These selected atoms based LWPH can also capture very well the IL1  IL2  IL3  Wat1  Wat2  Wat3   AC-PCA  212  167  173  307  301  268   HP-PCA  -217  203  350  352  341   LPH-PCA  340  321  333  345  357  354   LWPH-PCA  -211  186  354  295  313   Table 1. The confinement effect in ion liquid (IL) solution. The area of distribution of each MD trajectory repeat. The area is counted as the number of grids with population larger than 5% of the largest population grid. Four different methods are considered, including the atom-coordinate-based PCA (AC-PCA), the helicalparameter-based PCA (HP-PCA), the LPH-based PCA (LPH-PCA), and LWPH-based PCA (LWPH-PCA).
We have not listed the area for IL1 from HP-PCA and LWPH-PCA, as dynamic transition is observed in these representations and the area cannot be treated as the measurement of degree of conformational fluctuation. www.nature.com/scientificreports www.nature.com/scientificreports/ confinement effect and ion-DNA configurational changes. The corresponding trajectories also show great consistence with both helical-parameter based and LWPH based results. Figures 18 and 19 in Supplementary show the corresponding results.
Lastly, our LWPH based models are very flexible and easy to be combined with machine learning models. Traditional CEHS helical coordinate systems work well only for one and two base steps. They tend to fail if the local structure variation is induced by adjacent three or more base steps. Moreover, CEHS models are only suitable for DNA or RNA and cannot be used in proteins or other biomolecules. In comparison, our LWPH are more general and can be used for any local structures from DNAs, RNAs, proteins, biomolecular complexes, or biomolecular assemblies. Another important property of LWPH based feature vectors are that they are unit free and can be used to compare different-sized local structures. In this way, these feature vectors are extremely suitable for machine learning models.

conclusion Remarks
In this paper, we discuss weighted persistent homology models and their applications in biomolecular structure, function, and dynamics analysis. We briefly review all the WPH approaches, including vertex-weighted, edge-weighted, and simplex-weighted models. Essentially, weight values, which reflects physical, chemical and biological properties, are assigned to vertices (atom centers), edges (bonds), or higher order simplexes (cluster of atoms), depending on the biomolecular structure, function, and dynamics properties.
Further, we propose the first localized persistent homology and localized weighted persistent homology and apply them in the DNA structure classification and clustering. Our LPH and LWPH models are inspired by the great success of element specific persistent homology. In our models, biomolecules are not treated as an inseparable system, instead they are decomposed into a series of local domains, which may overlap with each other. The general persistent homology or weighted persistent homology analysis is then applied on each of these local domains. In this way, functional properties, that embedded in localized topological invariants, can be revealed. Our models characterize structural variations at any level and provide a new featurization of biomolecules for machine learning models.