pathfindR: An R Package for Comprehensive Identification of Enriched Pathways in Omics Data Through Active Subnetworks

Pathway analysis is often the first choice for studying the mechanisms underlying a phenotype. However, conventional methods for pathway analysis do not take into account complex protein-protein interaction information, resulting in incomplete conclusions. Previously, numerous approaches that utilize protein-protein interaction information to enhance pathway analysis yielded superior results compared to conventional methods. Hereby, we present pathfindR, another approach exploiting protein-protein interaction information and the first R package for active-subnetwork-oriented pathway enrichment analyses for class comparison omics experiments. Using the list of genes obtained from an omics experiment comparing two groups of samples, pathfindR identifies active subnetworks in a protein-protein interaction network. It then performs pathway enrichment analyses on these identified subnetworks. To further reduce the complexity, it provides functionality for clustering the resulting pathways. Moreover, through a scoring function, the overall activity of each pathway in each sample can be estimated. We illustrate the capabilities of our pathway analysis method on three gene expression datasets and compare our results with those obtained from three popular pathway analysis tools. The results demonstrate that literature-supported disease-related pathways ranked higher in our approach compared to the others. Moreover, pathfindR identified additional pathways relevant to the conditions that were not identified by other tools, including pathways named after the conditions.


INTRODUCTION
High-throughput technologies revolutionized biomedical research by enabling comprehensive characterization of biological systems. One of the most common use cases of these technologies is to perform experiments comparing two groups of samples (typically disease versus control) and identify a list of altered genes. However, this list alone often falls short of providing mechanistic insights into the underlying biology of the disease being studied (Khatri et al., 2012). Therefore, researchers face a challenge posed by high-throughput experiments: extracting relevant information that allows them to understand the underlying mechanisms from a long list of genes.
One approach that reduces the complexity of analysis while simultaneously providing great explanatory power is identifying groups of genes that function in the same pathways, i.e., pathway analysis. Pathway analysis has been successfully and repeatedly applied to gene expression (Werner, 2008;Emmert-Streib and Glazko, 2011), proteomics (Wu et al., 2014), and DNA methylation data .
Most commonly used pathway analysis methods are overrepresentation analysis (ORA) and functional class scoring (FCS). For each pathway, ORA statistically evaluates the proportion of altered genes among the pathway genes against the proportion among a set of background genes. In FCS, a genelevel statistic is calculated using the measurements from the experiment. These gene-level statistics are then aggregated into a pathway-level statistic for each pathway. Finally, the significance of each pathway-level statistic is assessed, and significant pathways are determined.
While they are widely used, there are drawbacks to conventional pathway analysis methods. The statistics used by ORA approaches usually consider the number of genes in a list alone. ORA methods are also independent of the values associated with these genes, such as fold changes or p values. Most importantly, both ORA and FCS methods lack in incorporating interaction information. We propose that directly performing pathway analysis on a gene set is not completely informative because this approach reduces gene-phenotype association evidence by ignoring information on interactions of genes.
We propose a pathway analysis method, which we named pathfindR, that first identifies active subnetworks and then performs enrichment analysis using the identified active subnetworks. For a given list of significantly altered genes, an active subnetwork is defined as a group of interconnected genes in a protein-protein interaction network (PIN) that predominantly consists of significantly altered genes. In other words, active subnetworks define distinct disease-associated sets of interacting genes.
The idea of utilizing PIN information to enhance pathway enrichment results was sought and successfully implemented in numerous studies. Gene Network Enrichment Analysis (GNEA)  analyzes gene expression data. The mRNA expression of every gene is mapped onto a PIN, and a significantly transcriptionally affected subnetwork is identified via jActiveModules (Ideker et al., 2002). To determine the gene set enrichment, each gene set is then tested for overrepresentation in the subnetwork. In EnrichNet (Glaab et al., 2012), input genes and pathway genes are mapped on a PIN. Using the random walk with restart (RWR) algorithm, distances between input genes and pathway genes are calculated. Enrichment results are obtained by comparing these distances to a background model. In both NetPEA and NetPEA′ , initially, the RWR algorithm is used to measure distances between pathways and input gene sets. The significances of pathways are then calculated by comparing against a background model created with two different approaches: a) randomizing input genes (NetPEA) and b) randomizing input genes and the PIN (NetPEA′).
With pathfindR, our aim was likewise to exploit interaction information to extract the most relevant pathways. We aimed to combine together active subnetwork search and pathway enrichment analysis. By implementing this original activesubnetwork-oriented pathway analysis approach as an R package, our intention was to provide the research community with a set of utilities (in addition to pathway analysis, clustering of pathways, scoring of pathways, and visualization utilities) that will be effective, beneficial, and straightforward to utilize for pathway enrichment analysis exploiting interaction information.
The active-subnetwork-oriented pathway enrichment paradigm of pathfindR can be summarized as follows: Mapping the statistical significance of each gene onto a PIN, active subnetworks, i.e., subnetworks in the PIN that contain an optimal number of significant nodes maximizing the overall significance of the subnetwork, either in direct contact or in indirect contact via an insignificant (non-input) node, are identified. Following a subnetwork filtering step, enrichment analyses are then performed on these active subnetworks. Similar to the abovementioned PIN-aided enrichment approaches, utilization of active subnetworks allows for efficient exploitation of interaction information and enhances enrichment analysis.
In summary, pathfindR integrates information from three main resources to enhance determination of the mechanisms underlying a phenotype: (i) differential expression/methylation information obtained through omics analyses, (ii) interaction information through a PIN via active subnetwork identification, and (iii) pathway/gene set annotations from sources such as Kyoto Encyclopedia of Genes and Genomes (KEGG) (Kanehisa and Goto, 2000;Kanehisa et al., 2017), Reactome (Fabregat et al., 2018), BioCarta (Nishimura, 2001), and Gene Ontology (GO) (Ashburner et al., 2000).
The pathfindR R (https://www.R-project.org/) package was developed based on a previous approach developed by our group for genome-wide association studies (GWASes): Pathway and Network-Oriented GWAS Analysis (PANOGA) (Bakir-Gungor et al., 2014). PANOGA was successfully applied to uncover the underlying mechanisms in GWASes of various diseases, such as intracranial aneurysm , epilepsy , and Behcet's disease (Bakir-Gungor et al., 2015). With pathfindR, we aimed to extend the approach of PANOGA to omics analyses and provide novel functionality.
In this article, we present an overview of pathfindR, example applications on three gene expression data sets, and comparison of the results of pathfindR with those obtained using three tools widely used for enrichment analyses: The Database for Annotation, Visualization and Integrated Discovery (DAVID) (Huang da et al., 2009), Signaling Pathway Impact Analysis (SPIA) (Tarca et al., 2009), and Gene Set Enrichment Analysis (GSEA) (Subramanian et al., 2005).

PINs and Gene Sets
PIN data available in pathfindR by default are KEGG, Biogrid (Stark et al., 2006;Chatr-Aryamontri et al., 2017), GeneMania (Warde-Farley et al., 2010), and IntAct (Orchard et al., 2014). The default PIN is Biogrid. Besides these four default PINs, the researcher can also use any other PIN of their choice on the condition that they provide the PIN file in simple interaction file (SIF) format.
The KEGG Homo sapiens PIN was created by an in-house script using the KEGG pathways. In KEGG, pathways are represented in XML files that contain genes and gene groups, such as protein complexes as entries and interactions as entry pairs. The KEGG pathway XML files were obtained using the official KEGG Application Programming Interface (API) which is a REST-style interface to the KEGG database resource. Using the in-house script, the XML files were parsed; the interactions were added as undirected pairs, while interaction types were disregarded. In cases of an entry in an interacting pair containing multiple genes, interactions from all of these genes to the other entry were built.
For IntAct, the PIN data in Proteomics Standards Initiative -Molecular Interactions tab-delimited (PSI-MI TAB) (MITAB) format (intact.txt) were obtained from the IntAct Molecular Interaction Database FTP site (ftp://ftp.ebi.ac.uk/pub/databases/ intact/current) in January 2018.
For GeneMania, Homo sapiens PIN data in tab-delimited text format from the latest release (COMBINED.DEFAULT_ NETWORKS.BP_COMBINING.txt) was obtained from the official data repository (http://genemania.org/data/current/ Homo_sapiens.COMBINED/). For this PIN only, only interactions with GeneMania weights ≥0.0006 were kept, allowing only strong interactions.
No filtration for interaction types were performed for any PIN (i.e., all types of interactions were kept). The processing steps performed for all the PINs were (1.) if the HUGO Gene Nomenclature Committee (HGNC) symbols for interacting genes were not provided, conversion of provided gene identifiers to HGNC symbols using biomaRt (Durinck et al., 2009) was performed; (2.) duplicate interactions and self-interactions (if any) were removed; and (3.) all PINs were formatted as SIFs.
KEGG gene sets were obtained using the R package KEGGREST. Reactome gene sets in Gene Matrix Transposed (GMT) file format were obtained from the Reactome website (https:// reactome.org/download/current/). BioCarta gene sets in GMT format were retrieved from the Molecular Signatures Database (MSigDB) (Liberzon et al., 2011) website (http://software. broadinstitute.org/gsea/msigdb). All "High-quality" GO gene sets were obtained from GO2MSIG (Powell, 2014) web interface (http://www.go2msig.org/cgi-bin/prebuilt.cgi?taxid=9606) in GMT format. All of the datasets were processed using R to obtain (1) a list containing the genes involved in each given gene set/ pathway (hence, each element of the list is named by the gene set ID and is a vector of gene symbols located in the given gene set/ pathway) and (2) a list containing the descriptions for each gene set/pathway (i.e., a list linking gene set IDs to description).
All of the gene sets in pathfindR are for Homo sapiens, and the default gene set is KEGG. The researcher can also use a gene set of their choice following the instructions on pathfindR wiki.
All of the default data for PINs and gene sets are planned to be updated annually.

Scoring of Subnetworks
In pathfindR, we followed the scoring scheme that was proposed by Ideker et al., 2002). The p value of each gene is converted to a z score using equation (1), and the score of a subnetwork is calculated using equation (2). In equation (1) Φ -1 is the inverse normal cumulative distribution function. In equation (2), A is the set of genes in the subnetwork and k is its cardinality. (2) In the same scoring scheme, a Monte Carlo approach is used for the calibration of the scores of subnetworks against a background distribution. Using randomly selected genes, 2,000 subnetworks of each possible size are constructed, and for each possible size, the mean and standard deviation of the score is calculated. These values are used to calibrate the subnetwork score using equation (3).

Active Subnetwork Search Algorithms
Currently, there are three algorithms implemented in the pathfindR package for active subnetwork search, described below.

Greedy Algorithm
Greedy algorithm is the problem-solving/optimization concept that chooses locally the best option in each stage with the expectation of reaching the global optimum. In active subnetwork search, this is generally applied by starting with a significant seed node and considering addition of a neighbor in each step to maximize the subnetwork score. In pathfindR, we used the approach described by Chuang et al. (2007). This algorithm considers addition of a node within a specified distance d to the current subnetwork. In our method, the maximum depth from the seed can also be set. With the default parameters, our greedy method considers addition of direct neighbors (d = 1) and forms a subnetwork with a maximum depth of 1 for each seed. Because the expansion process runs for each significant seed node, several overlapping subnetworks emerge. Overlapping subnetworks are handled by discarding a subnetwork that overlaps with a higher scoring subnetwork more than a given threshold, which is set to 0.5 by default.

Simulated Annealing Algorithm
Simulated annealing is an optimization algorithm inspired by annealing in metallurgy. In the annealing process, the material is heated above its recrystallization temperature and cooled slowly, allowing atoms to diffuse within the material and decrease dislocations. Analogous to this process, simulated annealing algorithm starts with a "high temperature" in which there is a high probability of accepting a solution that is worse than the current one as the solution space is explored. The acceptability of worse solutions allows a global search and escaping from local optima. The equation connecting temperature and probability of accepting a new solution is given in equation (4) A less worse solution and higher temperature are the conditions that increase the chance of acceptation of a new solution. The probability of accepting a non-optimal action decreases in each iteration, as the temperature decreases in each step.
Simulated annealing provides improved performance over the greedy search by accepting non-optimal actions to increase exploration in the search space. In the active subnetwork search context, the search begins with a set of randomly chosen genes (the chosen genes are referred to as genes in "on" state and the not chosen genes are referred to as genes in "off " state). Connected components in this candidate solution are found, and the scores are calculated. In each iteration, the state of a random node is changed from on to off and vice versa. Connected components are found in the new solution, and their scores are calculated. If the score improves, the change is accepted. If the score decreases, the change is accepted with a probability proportional to the temperature parameter that decreases in each step.

Genetic Algorithm
Genetic algorithm is a bio-inspired algorithm that mimics evolution by implementing natural selection, chromosomal crossover, and mutation. The main phases of the genetic algorithm are "the selection phase" and "the crossover phase. " In the selection phase, parents from the existing population are selected through a fitness-based process to breed a new generation. Common selection methods are (i) roulette wheel selection in which a solution's selection probability is proportional to its fitness score, (ii) rank selection in which a solution's selection probability is proportional to its rank, thus preventing the domination of a high fitness solution to the rest, and (iii) tournament selection in which parents are selected among the members of randomly selected groups of solutions, thus giving more chance to small fitness solutions that would have little chance in other selection methods.
In the crossover phase, encoded solution parameters of the parents are exchanged analogous to chromosomal crossover. The common crossover operators are (i) single-point crossover in which the segment next to a randomly chosen point in the solution representation is substituted between parents, (ii) twopoint crossover in which the segment between two randomly chosen points is substituted, and (iii) uniform crossover in which each parameter is randomly selected from either of the parents. Mutation is the process of randomly changing parameters in the offspring solutions in order to maintain genetic diversity and explore search space.
In our genetic algorithm implementation, candidate solutions represent the on/off state of each gene. In the implementation, we used rank selection and uniform crossover. In each iteration, the fittest solution of the previous population is preserved if the highest score of the current population is less than the previous population's score. In every 10 iterations, the worst scoring 10% of the population is replaced with random solutions. Because uniform cross-over and addition of random solutions make adequate contribution to the exploration of the search space, mutation is not performed under the default settings.

Selecting the Active Subnetwork Search Algorithm
The default search method in pathfindR is greedy algorithm with a search depth of 1 and maximum depth of 1. This method stands out with its simplicity and speed. This is also the "local subnetwork approach" used in the Local Enrichment Analysis (LEAN) method (Gwinner et al., 2017). As mentioned in the LEAN study, the number of subnetworks to be identified typically increases exponentially with increasing number of genes in the PIN, and the "local subnetwork approach" enables iterating over each local subnetwork and determining phenotype-related clusters. Greedy algorithm with search depth and maximum depth equal to 2 or more lets the search algorithm look further in the network for another significant gene to add to the cluster, but this may result in a slower runtime and a loss in interpretability.
Simulated annealing and genetic algorithms are heuristic methods that do not make any assumptions on the active subnetwork model. They can let insignificant genes between two clusters of significant genes to create a single connected active subnetwork. Thus, these algorithms may result in a large highest scoring active subnetwork, while the remaining subnetworks identified become small and therefore uninformative. This tendency towards large subnetworks was attributed to a statistical bias prevalent in many tools (Nikolayeva et al., 2018).
The default active search method (greedy algorithm with a search depth of 1 and maximum depth of 1) in pathfindR was preferred because multiple active subnetworks are used for enrichment analyses. If the researcher decides to use the single highest scoring active subnetwork for the enrichment process, they are encouraged to consider greedy algorithm with greater depth, simulated annealing, or genetic algorithm.

Active-Subnetwork-Oriented Pathway Enrichment Analysis
The overview of the active-subnetwork-oriented pathway enrichment approach is presented in Figure 1A.
The required input is a two-or three-column table: Gene symbols, change values as log-fold change (optional) and adjusted p values associated with the differential expression/ methylation data.
Initially, the input is filtered so that all p values are less than or equal to the given threshold (default is 0.05). Next, gene symbols that are not in the PIN are identified. If aliases of these gene symbols are found in the PIN, these symbols are converted to the corresponding aliases.
The processed data are then used for active subnetwork search. The identified active subnetworks are filtered via the following criteria: (i) has a score larger than the given quantile threshold (default is 0.80) and (ii) contains at least a specified number of input genes (default is 10).
For each filtered active subnetwork, using the genes contained in each of these subnetworks, separate pathway enrichment analyses are performed via one-sided hypergeometric testing. The enrichment tests use the genes in the PIN as the gene pool (i.e., background genes). Using the genes in the PIN instead of the whole genome is more appropriate and provides more statistical strength because active subnetworks are identified using only the genes in the PIN. Next, the p values obtained from the enrichment tests are adjusted (default is by Bonferroni method. However, the researcher may choose another method they prefer). Pathways with adjusted p values larger than the given threshold (default is 0.05) are discarded. These significantly enriched pathways per all filtered subnetworks are then aggregated by keeping only the lowest adjusted p value for each pathway if a pathway was found to be significantly enriched in the enrichment analysis of more than one subnetwork.
This process of active subnetwork search and enrichment analysis (active subnetwork search, filtering of subnetworks, enrichment analysis on each filtered subnetwork, and aggregation of enrichment results over all subnetworks) is repeated for a selected number of iterations (default is 10 iterations for greedy and simulated annealing algorithms, 1 for genetic algorithm).
Finally, the lowest and the highest adjusted p values, the number of occurrences over all iterations, and up-regulated and down-regulated genes in each enriched pathway are returned as a table. Additionally, a Hypertext Markup Language (HTML) format report with the pathfindR enrichment results is created. Pathways are linked to the visualizations of the pathways if KEGG gene sets are chosen. The KEGG pathway diagrams are created using the R package pathview (Luo and Brouwer, 2013). By default, these diagrams display the involved genes colored by change values, normalized between −1 and 1, on a KEGG pathway graph. If a gene set other than KEGG is chosen and visualization is required, graphs of interactions of genes involved in the enriched pathways in the chosen PIN are visualized via the R package igraph (Csardi and Nepusz, 2006).

Pathway Clustering
Enrichment analysis usually yields a large number of related pathways. In order to establish representative pathways among similar groups of pathways, we propose that clustering can be performed either via hierarchical clustering (default) or via a fuzzy clustering method as described by Huang et al. (2007). These clustering approaches are visually outlined in Figure 1B and described below: Firstly, using the input genes in each pathway, a kappa statistics matrix containing the pairwise kappa statistics, a chance-corrected measure of co-occurrence between two sets of categorized data, between the pathways is calculated (Huang et al., 2007).
By default, the wrapper function for pathway clustering, cluster_pathways, performs agglomerative hierarchical clustering (defining the distance as 1 − kappa statistic), automatically determines the optimal number of clusters by maximizing the average silhouette width, and returns a table of pathways with cluster assignments.
Alternatively, the fuzzy clustering method, previously proposed and described in detail by Huang et al. (2007), can be used to obtain fuzzy cluster assignments. Hence, this fuzzy approach allows a pathway to be a member of multiple clusters.
Finally, the representative pathway for each cluster is assigned as the pathway with the lowest adjusted p value.

Pathway Scoring Per Sample
The researcher can get an overview of the alterations of genes in a pathway via the KEGG pathway graph. To provide even more insight into the activation/repression statuses of pathways per each sample, we devised a simple scoring scheme that aggregates gene-level values to pathway scores, described below.
For an experiment values matrix (e.g., gene expression values matrix), EM, where columns indicate samples and rows indicate genes, the gene score GS of a gene g in a sample s is calculated as: Here, X g is the mean value for gene g across all samples, and sd g is the standard deviation for gene g across all samples.
For a set P i , the set of k genes in pathway i, and a sample j, the i th row and j th column of the pathway score matrix PS is calculated as follows: The pathway score of a sample for a given pathway is therefore the average value of the scores of the genes in the pathway for the given sample.
After calculation of the pathway score matrix, a heat map of these scores is plotted. Via this heat map, the researcher can examine the activity of a pathway in individual samples as well as compare the overall activity of the pathway between cases and controls.

Application on Gene Expression Datasets
To analyze the performance of pathfindR, we used three gene expression datasets. All datasets were obtained via the Gene Expression Omnibus (GEO) (Edgar et al., 2002). The first dataset (GSE15573) aimed to characterize and compare gene expression profiles in the peripheral blood mononuclear cells of 18 rheumatoid arthritis (RA) patients versus 15 healthy subjects using the Illumina human-6 v2.0 expression bead chip platform. This dataset will be referred to as RA. The second dataset (GSE4107) compared the gene expression profiles of the colonic mucosa of 12 early onset colorectal cancer patients and 10 healthy controls using the Affymetrix Human Genome U133 Plus 2.0 Array platform. The second dataset will be referred to as CRC. The third dataset (GSE55945) compared the expression profiles of prostate tissue from 13 prostate cancer patients versus 8 controls using the Affymetrix Human Genome U133 Plus 2.0 Array platform. This dataset will be referred to as PCa.
After preprocessing, which included log2 transformation and quantile normalization, differential expression testing via a moderated t test using limma (Ritchie et al., 2015) was performed. Next, the resulting p values were corrected using false discovery rate (FDR) adjustment. The differentially expressed genes (DEGs) were defined as those with FDR < 0.05. Probes mapping to multiple genes and probes that do not map to any gene were excluded. If a gene was targeted by multiple probes, the lowest p value was kept. The results of differential expression analyses for RA, CRC, and PCa, prior to filtering (differential expression statistics for all probes) and after filtering (lists of DEGs), are provided in Supplementary Data Sheet 1.
We chose to use these three datasets because these are wellstudied diseases and the involved mechanisms are considerably well characterized. These different datasets also allowed us to test the capabilities of pathfindR on DEGs obtained from different platforms.
We performed enrichment analysis with pathfindR, using the default settings. Greedy algorithm for active subnetwork search was used, and the analysis was carried out over 10 iterations. The enrichment significance cutoff value was set to 0.25 for each analysis (changing the argument enrichment_threshold of run_ pathfindR function) as we later performed validation of the results using the three significance cutoff values of 0.05, 0.1, and 0.25 To better evaluate the performance of pathfindR, we compared results on the three gene expression datasets by three widely used pathway analysis tools, namely, DAVID (Huang da et al., 2009), SPIA (Tarca et al., 2009), and GSEA (Subramanian et al., 2005). DAVID 6.8 was used for the analyses. SPIA was performed using the default settings. GSEA was also performed using the default settings (using phenotype permutations). Additionally, preranked GSEA was performed (GSEAPreranked) using the default settings. The rank of the i th gene rank i was calculated as follows: The unfiltered results of enrichment analyses using the different methods on the three datasets are presented in Supplementary Data Sheet 2.
For each analysis, the Bonferroni-corrected p values for pathfindR were used to filter the results. For all the other tools, as the Bonferroni method would be too strict and result in too few or no significant pathways, the FDR-corrected p values were used.
Because there is no definitive answer to which pathways are involved in the pathogenesis of the conditions under study, we analyzed the results in light of the existing biological knowledge on the conditions and compared our results with other tools in this context. The significant pathways were assessed on the basis of how well they fitted with the existing knowledge. For this, two separate approaches were taken: (i) assessment of literature support for the significantly enriched pathways (using a significance threshold of 0.05), and (ii) assessment of the percentages of pathway genes that are also known disease genes (using the three significance thresholds of 0.05, 0.10, and 0.25). While both assessments could be separately used to determine the "disease-relatedness" of a pathway, we chose to use them both as these are complementary measures: the former is a more subjective but a comprehensive measure of association, and the latter is a limited but a more objective measure of association. For determining the percentages of known disease genes in each significantly enriched pathway, two curated lists were used. For the RA dataset, mapped genes in the curated list of SNPs associated with RA was obtained from the NHGRI-EBI Catalog of published genome-wide association studies (GWAS Catalog, retrieved on 19.12.2018) (MacArthur et al., 2017). These genes will be referred to as "RA Genes. " For the CRC and PCa datasets, the "Cancer Gene Census" (CGC) genes from the Catalogue of Somatic Mutations in Cancer (COSMIC, http://cancer.sanger. ac.uk, retrieved on 19.12.2018) were used. These genes will be referred to as "CGC Genes. "

Assessment Using Permuted Inputs
We performed pathfindR analyses using real and permuted data with different sizes to assess the number of enriched pathways identified in the permuted data against the actual data. For this assessment, the RA data was used. The analyses were performed on data subsets taken as the top 200, 300, 400, and 500 most significant DEGs as well as the complete list of 572 DEGs. For each input size, 100 separate pathfindR analyses were performed on both the actual input data and permuted data. While the real input data were kept unchanged, for the permuted data, a random permutation of genes (using the set of all genes available on the microarray platform) was carried out at each iteration over 100 analyses. Analyses with pathfindR were performed using the default settings described above.
The distributions of the number of enriched pathways for actual vs. permuted data were compared using Wilcoxon rank sum test.

ORA Assessment of the Effect of DEGs Without Any Interactions
We performed ORA as implemented in pathfindR (as the "enrichment" function) to assess any effect of removing DEGs without any interactions on enrichment results. For this purpose, ORA were performed for (i) the full lists of DEGs for all datasets and (ii) the lists of DEGs that are found in the Biogrid PIN. As gene sets, KEGG pathways were used. As background genes, all of the genes in the Biogrid PIN were used for both analyses so that the results could be comparable. The enrichment p values were adjusted using the FDR method. Pathway enrichment was considered significant if FDR was <0.05.

Assessment of the Effect of PINs on Enrichment Results
To analyze the effect of the chosen PIN on the enrichment results, we performed pathfindR analyses using the four PINs provided by default: the Biogrid, GeneMania, IntAct, and KEGGPINs. For these analyses, the default settings were used with the default active search algorithm (greedy) and the default gene sets (KEGG).

Software Availability
The pathfindR package is freely available for use under MIT license: https://cran.r-project.org/package=pathfindR. The code of the pathfindR package is deposited in a GitHub repository (https://github.com/egeulgen/pathfindR) along with a detailed wiki, documenting the features of pathfindR in detail. Docker images for the latest stable version and the development version of pathfindR are deposited on Docker Hub (https://hub.docker. com/r/egeulgen/pathfindr)

The RA Dataset
A total of 572 DEGs were identified for the RA dataset (Supplementary Data Sheet 1). Filtered by adjusted p values (adjusted-p ≤ 0.05), pathfindR identified 78 significantly enriched KEGG pathways which were partitioned into 10 clusters (Figures 2A, B). The relevancy of 31 out of 78 (39.74%) pathways was supported by literature, briefly stated in Table 1.
The summary of results obtained using the different tools and literature support for the identified pathways (where applicable) are presented in Table 1. For this dataset, SPIA identified two significant pathways, which were both also identified by pathfindR. No significant pathway was identified by the other tools.
Clustering allowed us to obtain coherent groups of pathways and identify mechanisms relevant to RA, including autoimmune response to the spliceosome (Hassfeld et al., 1995), mechanisms related with response to microbial infection, such as generation of neo-autoantigens and molecular mimicry (Li et al., 2013), dysregulation of various signaling pathways (Remans et al., 2002;Rihl et al., 2005;Barthel et al., 2009;Malemud, 2015), DNA damage repair (Lee et al., 2003), dysregulation of energy metabolism , and modulation of immune response and inflammation by the proteasome (Wang and Maldonado, 2006).
The activity scores of the representative pathways for each subject indicated that most representative pathways were downregulated in the majority of subjects ( Figure 2C).

The CRC Dataset
For the CRC dataset, 1,356 DEGs were identified (Supplementary Data Sheet 1). pathfindR identified 100 significantly enriched pathways (adjusted-p ≤ 0.05) which were partitioned into 14 coherent clusters (Figures 3A, B). Forty-eight (48%) of these enriched pathways were relevant to CRC biology, as supported by literature. Brief descriptions of how these are relevant are provided in Table 2.
The results obtained using the different tools and literature support for the identified pathways (where applicable) are presented in Table 2. For this dataset, DAVID identified 20 significant pathways, 15 of which were also found by pathfindR (4 out of the remaining 5 were not supported by literature to be relevant to CRC). SPIA identified 13 significantly enriched pathways, 11 of which were also identified by pathfindR. Out of the remaining two enriched pathways, only "PPAR signaling pathway" was related to CRC biology (You et al., 2015). Neither GSEA nor GSEAPreranked yielded any significant pathways for the CRC dataset. The Colorectal cancer pathway was identified to be significantly enriched only by pathfindR.
Upon clustering, 14 clusters were identified (Figures 3A,  B). These clusters implied processes previously indicated FIGURE 2 | pathfindR enrichment and clustering results on the rheumatoid arthritis (RA) dataset (lowest p ≤ 0.05). (A) Clustering graph, each color displaying the clusters obtained for RA. Each node is an enriched pathway. Size of a node corresponds to its −log(lowest_p). The thickness of the edges between nodes corresponds to the kappa statistic between the two terms. (B) Bubble chart of enrichment results grouped by clusters (labeled on the right-hand side of each panel). The x axis corresponds to fold enrichment values, while the y axis indicates the enriched pathways. The size of the bubble indicates the number of differentially expressed genes (DEGs) in the given pathway. Color indicates the −log10(lowest-p) value; the more it shifts to red, the more significantly the pathway is enriched. (C) Heat map of pathway scores per subject. The x axis indicates subjects, whereas the y axis indicates representative pathways. Color scale for the pathway score is provided in the right-hand legend. September 2019 | Volume 10 | Article 858 Frontiers in Genetics | www.frontiersin.org     (Vasilopoulos et al., 2007). Autoimmune response to cytoskeletal proteins (including actin) was reported in RA (Shrivastav et al., 2002 in colorectal cancer, including but not limited to colorectal cancer and related signaling pathways (Fang and Richardson, 2005;Zenonos and Kyprianou, 2013;Francipane and Lagasse, 2014), apoptosis (Watson, 2004), p53 signaling (Slattery et al., 2018), dysregulation of metabolic functions, including glucose metabolism (Fang and Fang, 2016), fatty acid metabolism (Wen et al., 2017), and amino acid metabolism (Santhanam et al., 2016;Antanaviciute et al., 2017), and cell cycle (Hartwell and Kastan, 1994;Collins et al., 1997;Jarry et al., 2004). Brief descriptions of all pathways relevant to CRC are provided in Table 2.
Representative pathways that were upregulated in the majority of subjects included important pathways related to cancer in general and colorectal cancer, such as the proteoglycans in cancer, adherens junction, gap junction, and Hippo signaling pathway. Representative pathways that were downregulated in the majority of subjects included other important pathways related to colorectal cancer, such as valine, leucine, and isoleucine degradation, mTOR signaling pathway, and cell cycle ( Figure 3C).

The PCa Dataset
For the PCa dataset, 1,240 DEGs were identified (Supplementary Data Sheet 1). pathfindR identified 92 significantly enriched pathways (adjusted-p ≤ 0.05) which were clustered into 14 coherent clusters (Figures 4A, B). Forty-six (50%) of these enriched pathways were relevant to PCa biology, as supported by literature. Brief descriptions of the relevancies are provided in Table 3.
The results obtained using the different tools and literature support for the identified pathways (where applicable) are presented in Table 3. DAVID identified eight significant pathways, which were all also identified by pathfindR and only half of which were relevant to PCa. SPIA identified five significantly enriched pathways, all of which were also identified by pathfindR. GSEA identified no significant pathways, whereas GSEAPreranked identified one significant pathway, for which no association with PCa was provided by the literature. The prostate cancer pathway was identified to be significantly enriched only by pathfindR.
The majority of representative pathways relevant to PCa were down-regulated ( Figure 4C).

Common Pathways Between the CRC and PCa Datasets
Because the CRC and PCa datasets were both cancers, they were expected to have common pathways identified by pathfindR. Indeed, 47 common significant pathways (adjusted-p ≤ 0.05) were identified (Supplementary Table 1). These common pathways included general cancer-related pathways, such as pathways in cancer, proteoglycans in cancer, MAPK signaling pathway, Ras signaling pathway, Hippo signaling pathway, mTOR signaling pathway, Toll-like receptor signaling pathway, Wnt signaling pathway, and adherens junction.

Disease-Related Genes in the Significantly Enriched Pathways
The percentages of disease-related genes for each pathway found to be enriched by any tool (adjusted-p ≤ 0.05) are presented in the corresponding columns of Tables 1, 2, and 3 ("% RA Genes" for the RA dataset and "% CGC Genes" for the CRC and PCa datasets). These percentages show great variability but support the literature search results in assessing the disease-relatedness of the enriched pathways.
The distributions of disease-related gene percentages in pathways identified by each tool in the three different datasets, filtered by the adjusted-p value thresholds of 0.05, 0.1, and 0.25, are presented in Figure 5. As stated before, for the RA dataset, only pathfindR and SPIA identified significant pathways. The median percentages of RA-associated genes of the enriched pathways of pathfindR was higher than the median percentages of SPIA (2.43% vs. 0.96% for the 0.05 cutoff, 2.5% vs. 0.61% for the 0.1 cutoff, and 2.27% vs. 0.67% for the 0.25 cutoff). For CRC, pathfindR displayed the highest median percentage of CGC genes for all the cutoff values (17.84%, 17.72%, and 16.7% for 0.05, 0.1, and 0.25, respectively). For the PCa dataset, the median  .
"ID" indicates the Kyoto Encyclopedia of Genes and Genomes (KEGG) ID for the enriched pathway, whereas "Pathway" indicates the KEGG pathway name. "% RA genes" indicates the percentage of RA genes in the pathway. The lowest Bonferroni-adjusted p value for pathfindR analysis is provided in "pathfindR," the false discovery rate (FDR)adjusted p value for Database for Annotation, Visualization and Integrated Discovery (DAVID) analysis is provided in "DAVID," the FDR-adjusted p value for Signaling Pathway Impact Analysis (SPIA) is presented in "SPIA," and the FDR-adjusted p values for Gene Set Enrichment Analysis (GSEA) and GSEAPreranked are presented in "GSEA" and "GSEAPreranked," respectively. Significant p values (i.e., adjusted p value <0.05) are given in bold font. "-" indicates the pathway was not found to be enriched by the given tool. If a pathway is relevant to RA, a brief description of its relevance is provided in "Brief Description." September 2019 | Volume 10 | Article 858 Frontiers in Genetics | www.frontiersin.org     (Hartwell and Kastan, 1994;Collins et al., 1997;Jarry et al., 2004). hsa04932 Non-alcoholic fatty liver disease (NAFLD)    (You et al., 2015). hsa01200 Carbon metabolism Metabolic pathways 0 -0.015541794 ---Metabolic reprogramming has consequences at the cellular and molecular level with implications for cancer initiation and growth (Hagland et al., 2013) "ID" indicates the Kyoto Encyclopedia of Genes and Genomes (KEGG) ID for the enriched pathway, whereas "Pathway" indicates the KEGG pathway name. "% CGC genes" indicates the percentage of Cancer Gene Census (CGC) genes in the pathway. The lowest Bonferroni-adjusted p value for pathfindR analysis is provided in "pathfindR," the false discovery rate (FDR)-adjusted p value for Database for Annotation, Visualization and Integrated Discovery (DAVID) analysis is provided in "DAVID," the FDR-adjusted p value for Signaling Pathway Impact Analysis (SPIA) is presented in "SPIA," and the FDR-adjusted p values for Gene Set Enrichment Analysis (GSEA) and GSEAPreranked are presented in "GSEA" and "GSEAPreranked," respectively. Significant p values (i.e., adjusted p value < 0.05) are given in bold font. "-" indicates the pathway was not found to be enriched by the given tool. If a pathway is relevant to CRC, a brief description of its relevance is provided in "Brief Description." percentages of CGC genes of the enriched pathways of pathfindR were again the highest among all tools for all significance cutoff values (18.73%, 18.37%, and 17.93% for 0.05, 0.1, and 0.25, respectively).

Permutation Assessment
To assess the number of pathways identified to be enriched by pathfindR, we performed analyses using actual and permuted data of different sizes. Comparison of the distributions of actual vs. permuted data is presented in Figure 6. Wilcoxon rank sum tests revealed that the distributions of the numbers of enriched pathways obtained using actual and permuted input data were significantly different (all p < 0.001). The median number of enriched pathways was lower for permuted data in each case. It was observed that the ratio of the median number of pathways (permuted/actual) tended to increase as the number of input genes increased. This is most likely because as the input size gets larger, there is higher chance in finding highly connected subnetworks that in turn leads to identifying a higher number of enriched pathways.

Assessment of the Effect of DEGs Without Any Interactions on Enrichment Results
To gain further support for our proposal that directly performing enrichment analysis on a list of genes is not completely informative because this ignores the interaction information, we performed ORA (as implemented in pathfindR) on (i) all of the DEG lists (RA, CRC, and PCa) and (ii) the filtered list of DEGs for the same datasets so that they only contain DEGs found in the Biogrid PIN. This allowed us to assess any effect of eliminating DEGs with no interactions on the enrichment results.
The numbers of DEGs found in the Biogrid PIN for each dataset was as follows: RA-481 (out of 572 total), CRC-989 (out of 1,356) and PCa-900 (out of 1,240). The ORA results are presented in Supplementary Data Sheet 3. The elimination of DEGs without any interaction clearly affected numbers of significantly enriched (FDR < 0.05) KEGG pathways (Supplementary Table 2). For the RA dataset, no significantly enriched pathways were found using all DEGs, whereas elimination of non-interacting DEGs resulted in one significant pathway. For CRC and PCa, using only DEGs found FIGURE 3 | pathfindR enrichment and clustering results on the colorectal cancer (CRC) dataset (lowest p ≤ 0.05). (A) Clustering graph, each color displaying the clusters obtained for CRC. Each node is an enriched pathway. The size of a node corresponds to its −log(lowest_p). The thickness of the edges between nodes corresponds to the kappa statistic between the two terms. (B) Bubble chart of enrichment results grouped by clusters (labeled on the right-hand side of each panel). The x axis corresponds to fold enrichment values, while the y axis indicates the enriched pathways. The size of the bubble indicates the number of differentially expressed genes (DEGs) in the given pathway. The color indicates the −log10(lowest-p) value; the more it shifts to red, the more significantly the pathway is enriched. (C) Heat map of pathway scores per subject. The x axis indicates subjects, whereas the y axis indicates representative pathways. Color scale for the pathway score is provided in the right-hand legend.
in the PIN, the number of significantly enriched pathways were doubled compared to using all of the genes without taking into account any interaction information. We would like to note that these results partly explain why taking interaction information into account results in enhanced enrichment results.

Assessment of the Effect of PINs on Enrichment Results
To assess any effect of the choice of PIN on pathfindR results, we first compared the default PINs in terms of the interactions they contain. The number of interactions in the PINs were as follows: 289,417 interactions in Biogrid, 79,741 interactions in GeneMania, 121,007 interactions in IntAct, and 53,047 interactions in KEGG. The numbers of common interactions between any pair of PINs and the overlap percentages of the interactions are presented in Supplementary Table 3. The results show that there is very little overlap between the PINs. Despite the fact that Biogrid has more than double the interactions of IntAct and 3 times the interactions of GeneMania, it remarkably does not contain half of the interactions they contain, implying this lack of overlap between PINs may affect pathfindR results.
We then proceeded with analyzing any effect of the choice of PIN on active-subnetwork-oriented pathway enrichment analysis. Venn diagrams comparing enrichment results obtained through pathfindR analyses with all available PINs are presented in Supplementary Figure 1. This comparison revealed that there was no compelling overlap among the enriched pathways obtained by using different PINs. Overall, using Biogrid and KEGG resulted in the highest number of significantly enriched pathways for all datasets.
As described in Materials and Methods, the results presented in this subsection were obtained using greedy search with search depth of 1 and maximum depth of 1, which results in multiple subnetworks structured as local subnetworks. Although it is not fully dependent on it, this method requires direct interactions between input genes. In the extreme case where there is no direct connection between any pair of two input genes, it is impossible to get any multi-node subnetworks with this method. Therefore, in order to gain a better understanding of the lack of overlap between the enrichment results    (Weber and Gioeli, 2004;Whitaker and Neal, 2010).
(Continued) September 2019 | Volume 10 | Article 858 Frontiers in Genetics | www.frontiersin.org  (Hartwell and Kastan, 1994;Collins et al., 1997;Balk and Knudsen, 2008    In case of utilizing KEGG PIN and KEGG pathways, the same interactions for both subnetwork interaction and enrichment analysis are considered. This approach does not introduce any extra information to the analysis, and it is clear that interacting gene groups in the KEGG PIN will be enriched in KEGG pathways. This explains the high number of pathways obtained using the KEGG PIN. Moreover, it is known that pathways in pathway databases may be strongly biased by some classes of genes or phenotypes that are popular targets, such as cancer signaling . Therefore, the PIN obtained through KEGG pathway interactions are biased. Biogrid has the highest coverage for direct interactions among DEGs as seen in Supplementary Figure 2. It is unbiased in terms of phenotypes, and using Biogrid to extract KEGG pathways combines the two sources of information.
Considering all of the above-mentioned findings, we conclude that utilizing the Biogrid PIN can provide the researcher with the most extensive enrichment results.

DISCUSSION
PathfindR is an R package that enables active subnetworkoriented pathway analysis, complementing the gene-phenotype associations identified through differential expression/ methylation analysis. "ID" indicates the Kyoto Encyclopedia of Genes and Genomes (KEGG) ID for the enriched pathway, whereas "Pathway" indicates the KEGG pathway name. "% CGC genes" indicates the percentage of Cancer Gene Census (CGC) genes in the pathway. The lowest Bonferroni-adjusted p value for pathfindR analysis is provided in "pathfindR," the false discovery rate (FDR)-adjusted p value for Database for Annotation, Visualization and Integrated Discovery (DAVID) analysis is provided in "DAVID," the FDR-adjusted p value for Signaling Pathway Impact Analysis (SPIA) is presented in "SPIA," and the FDR-adjusted p values for Gene Set Enrichment Analysis (GSEA) and GSEAPreranked are presented in "GSEA" and "GSEAPreranked," respectively. Significant p values (i.e., adjusted p value < 0.05) are given in bold font. "-" indicates the pathway was not found to be enriched by the given tool. If a pathway is relevant to PCa, a brief description of its relevance is provided in "Brief Description." In most gene set enrichment approaches, relational information captured in the graph structure of a PIN is overlooked. Hence, during these analyses, genes in the network neighborhood of significant genes are not taken into account. The approach we considered for exploiting interaction information to enhance pathway enrichment analysis was active subnetwork search. In a nutshell, active subnetwork search enables inclusion of genes that are not significant genes themselves but connect significant genes. This results in the identification of phenotype-associated connected significant subnetworks. Initially identifying active subnetworks in a list of significant genes and then performing pathway enrichment analysis of these active subnetworks efficiently  exploits interaction information between the genes. This, in turn, helps uncover relevant phenotype-related mechanisms underlying the disease, as demonstrated in the example applications.
Through pathfindR, numerous relevant pathways were identified in each example. The literature-supported diseaserelated pathways mostly ranked higher in the pathfindR results. The majority of additional pathways identified through pathfindR were relevant to the pathogenesis of the diseases under study, as supported by literature. A separate confirmation of diseaserelatedness was provided by analysis of the distributions of the percentage of disease genes in the identified pathways. This analysis revealed that pathfindR pathways contained the highest median percentages of disease-related genes in each dataset regardless of significance cutoff value, implying that the pathways identified by pathfindR are indeed associated with the given disease. Together, these two assessments of disease-relatedness of pathways indicate that pathfindR produces pathway enrichment results at least as relevant as the other tools widely used for enrichment analysis.
We propose that pathfindR performed better than the analyzed pathway analysis tools because, for enrichment analysis, it included disease-related genes that were not in the DEG list but that were known to interact with the DEGs, which most enrichment tools disregard. By performing enrichment analyses on distinct sets of interacting genes (i.e., active subnetworks), pathfindR also eliminated "false positive" genes that lacked any strong interaction. The above findings indicate that incorporating interaction information prior to enrichment analysis results in better identification of disease-related mechanisms.
This package extends the use of the active-subnetwork-oriented pathway analysis approach to omics data. Additionally, it provides numerous improvements and useful new features. The package provides three active subnetwork search algorithms. The researcher is therefore able to choose between the different algorithms to obtain the optimal results. For the greedy and simulated annealing active subnetwork search algorithms, the search and enrichment processes are executed several times. By summarizing results over the iterations and identifying consistently enriched pathways, the stochasticity of these algorithms is overcome. Additionally, the researcher is able to choose from several built-in PINs and can use their own custom PIN by providing the path to the SIF file. The researcher is also able to choose from numerous built-in gene sets, listed above, and can also provide a custom gene set resource. pathfindR also allows for clustering of related pathways. This allows for combining relevant pathways together, uncovering coherent "meta-pathways" and reducing complexity for easier interpretation of findings. This clustering functionality also aids in eliminating falsely enriched pathways that are initially found because of their similarity to the actual pathway of interest. The package also allows for scoring of pathways in individual subjects, denoting the pathway activity. Finally, pathfindR is built as a stand-alone package, but it can easily be integrated with other tools, such as differential expression/ methylation analysis tools, for building fully automated pipelines.
To the best of our knowledge, pathfindR is the first and, so far, the only R package for active-subnetwork-oriented pathway enrichment analysis. It also offers functionality for pathway clustering, scoring, and visualization. All features in pathfindR work together to enable identification and further investigation of dysregulated pathways that potentially reflect the underlying pathological mechanisms. We hope that this approach will allow researchers to better answer their research questions and discover mechanisms underlying the phenotype being studied.