Crosslink: An R Package for Network Visualization of Grouped Nodes

The demand for network visualization of relationships between nodes attributed to different categories grows in various biomedical research scenarios, such as gene regulatory networks, drug-target networks, ligand-receptor interactions and association networks of multi-omics elements. Elegantly visualizing the relationships between nodes with complex metadata of nodes and edges appended may inspire new insights. Here, we developed the crosslink R package, tailored for network visualization of grouped nodes, to provide a series of flexible functions for generating network diagrams. We first designed a CrossLink class for storage of metadata about nodes and edges and manipulation of node coordinates. Then affine transformation and function mapping transformation are implemented to perform fundamental node coordinates transformation by groups, based on which various network layouts can be defined easily. For convenience, we predefined several commonly used layouts, including row, column, arc, polygon and hive, which also can be combined in one layout. Finally, we designed a user-friendly wrapper function to draw network connections, aesthetic mappings of metadata and decoration with related annotation graphs in one interface by taking advantage of the powerful ggplot2 system. Overall, the crosslink R package is easy-to-use for achieving complex visualization of a network diagram of grouped nodes surrounded by associated annotation graphs. Availability and Implementation Cosslink is an open-source R package, freely available from github: https://github.com/zzwch/crosslink; A detailed user documentation can be found in https://zzwch.github.io/crosslink/.

The demand for network visualization of relationships between nodes attributed to different categories grows in various biomedical research scenarios, such as gene regulatory networks, drug-target networks, ligand-receptor interactions and association networks of multi-omics elements. Elegantly visualizing the relationships between nodes with complex metadata of nodes and edges appended may inspire new insights. Here, we developed the crosslink R package, tailored for network visualization of grouped nodes, to provide a series of flexible functions for generating network diagrams. We first designed a CrossLink class for storage of metadata about nodes and edges and manipulation of node coordinates. Then affine transformation and function mapping transformation are implemented to perform fundamental node coordinates transformation by groups, based on which various network layouts can be defined easily. For convenience, we predefined several commonly used layouts, including row, column, arc, polygon and hive, which also can be combined in one layout. Finally, we designed a user-friendly wrapper function to draw network connections, aesthetic mappings of metadata and decoration with related annotation graphs in one interface by taking advantage of the powerful ggplot2 system. Overall, the crosslink R package is easy-to-use for achieving complex visualization of a network diagram of grouped nodes surrounded by associated annotation graphs.

INTRODUCTION
With the rapid development of multi-omic technologies, intricate relationships between different categories of biomedical molecules were established, which brought huge opportunities and challenges to network visualization. Visualization of relationships between various biomolecules from different layers is helpful to explain and extract comprehensive biological information. For instance, Youqiong Ye etc. presented the network among the identified molecular alterations and the sensitivity of anticancer drugs to directly display a multi-omic molecular feature landscape of Frontiers in Genetics | www.frontiersin.org tumor hypoxia (Ye et al., 2019). And recently, there is a study characterizing the network among the expression of altered m6A regulators and cancer related pathways to illustrate the role of m6A in carcinogenesis (Li et al., 2019). Besides, researches in brain disease and plant development often provide an intuitive correlation network diagram to explain the influence of key regulators on other related layers (Shahan et al., 2018;Gilson et al., 2020). These cases show the common elements required for network visualization in many biomedical researches: (1) connections between multiple groups of biomolecules (i.e., grouped nodes), (2) mapping of additional biological information onto biomolecules and connections (i.e., nodes and edges), (3) arrangement of biomolecules in columns according to their categories, and (4) combination of annotation graphs around the network diagram.
A number of tools have been developed for visualization of various complex network, such as Cytoscape (Shannon et al., 2003), igraph (Csardi and Nepusz, 2006), ggraph (Pedersen, 2020) and Gelphi (Bastian et al., 2009). Recently, CellChat (Jin et al., 2021) was released to specifically analyze and visualize cell-cell communication network. Importantly, none of the tools above offer the function to combine the network diagram with the corresponding annotation graphs for grouped nodes. For the present, a tool specially designed for network visualization of grouped nodes that supports nodes decoration with annotation plots is still lacking.
Therefore, the user-friendly R package crosslink is developed here to arrange nodes by group, map metadata onto aesthetics of nodes and edges and align annotation graphs with the network. This package would hopefully meet various specific demands on network visualization of grouped biomolecules in biomedical research.

MATERIALS AND METHODS
The crosslink is developed in R language and mainly includes four modules, which is CrossLink class, coordinate transformation methods, layout modules and the plotting function, as shown in Figure 1A. The CrossLink class is the basic module, storing the metadata of nodes and edges, node coordinates and other parameters. The other three modules are operated on the data structure of CrossLink class. Here, we termed the group of nodes as "cross" and the edge between groups as "link".
First, the function "crosslink" is used to generate a CrossLink object. With this function users can easily initialize a default network by inputting nodes and edges information. Several adjustments including spaces between nodes and gaps between crosses (groups) are also available for fine-tuning the default layout.
Second, coordinate transformation module, consisting of several affine transformation methods and the method to define the function for mapping transformation, is then applied for node coordinate transforming by crosses. The "tf_affine" function is designed for coordinate transforming of grouped nodes in the network. It requires a CrossLink object as the input and returns the object with transformed coordinates. This function provides several designed modes including rotating, shifting, shearing, flipping and scaling (Figure 1B), which would be useful when adjusting node coordinates in one or all groups to beautify presentation of complex relationships among multiple types of data, as shown in Figure 1D. The "tf_fun" interface allows users to customize transforming function according to specific needs. Here, as an example, we designed a "sin" transformation method using "tf_fun" interface to illustrate its usage ( Figure 1B).
Third, commonly used styles are predefined in the layout module, including row, column, arc, polygon and hive as shown in Figure 1C. Users can specify a predefined network layout or combine multiple predefined layouts to design a diverse network.
Fourth, the plotting function "cl_plot" allows various aesthetic settings for nodes, edges, node labels and headers by taking advantage of "ggplot2" system (Ito and Murphy, 2013). In particular, this function provides the annotation interface to achieve the combination of the network diagram and corresponding annotation graphs, with node coordinates aligned ( Figure 1D). Additionally, the plotting module also includes several data extraction functions, such as "get_cross" and "get_link", which can be used to obtain the coordinate and metadata information. The "set_header" function is provided to place cross (group) headers.
In summary, crosslink provides a friendly interface for users to realize diverse network plotting of grouped nodes. This package can be applied to various biomedical studies for visualizing complex information and relationships between biomolecules in different categories (Goh et al., 2007;Neph et al., 2012;Chen and Wu, 2013;Shahan et al., 2018).

DISCUSSION
This work presented the first network visualization R package tailored for grouped nodes that implements a series of functions to store network data, manipulate node coordinates, and plot network diagram with supports for aesthetic mappings for nodes and edges and aligned graph annotation.

DATA AVAILABILITY STATEMENT
The original contributions presented in the study are included in the article/Supplementary Material, further inquiries can be directed to the corresponding author/s.

AUTHOR CONTRIBUTIONS
ZL and BL conceived and designed the study. ZL completed the R package "crosslink" and wrote the manuscript. DL performed the figure test and wrote the user guide and the manuscript. ZB proofread and corrected the manuscript. All authors contributed to the article and approved the submitted version.