extract_highest_scoring_path: Extract Highest Scoring Path

View source: R/RWR_shortestpaths.R

extract_highest_scoring_pathR Documentation

Extract Highest Scoring Path

Description

extract_highest_scoring_path parses through the dataframe output of RWR_ShortestPaths and extracts the highest weighted edge per layer of a user defined path. The method with which these edges are extracted can be either by the normalized weight (default) or by the non-normalized weight. If the edges are unweighted, this will not yield any meaningful results

Usage

extract_highest_scoring_path(
  shortest_paths_df,
  desired_path,
  weight_type = "normalized"
)

Arguments

shortest_paths_df

A dataframe denoting the shortest paths of between a series of predefined genes. The output of RWR_ShortestPaths

desired_path

A string denoting the desired path that the user wishes to extract (must match pathname of an existing path within the shorest_paths_df).

weight_type

A string determining the weight used to determine the highest weighted path. Options: "weightnorm" (Default) uses normalized edges by edgeweight_i / N_vertices_in_layer

                     "weight" uses edge weight alone.

Value

Returns a data frame following the path with the highest edge weights

Examples


# An example of Running `extract_highest_scoring_path`

extdata.dir <- system.file("example_data", package = "RWRtoolkit")
multiplex_object_filepath <- paste(extdata.dir,
  "/string_interactions.Rdata",
  sep = ""
)
geneset1_filepath <- paste(extdata.dir, "/geneset1.tsv", sep = "")
geneset2_filepath <- paste(extdata.dir, "/geneset2.tsv", sep = "")
outdir <- "./rwr_shortestpath"

rwr_shortest_path_output <- RWR_ShortestPaths(
  data = multiplex_object_filepath,
  source_geneset = geneset1_filepath,
  target_geneset = geneset2_filepath,
  write_to_file = TRUE,
  outdir = outdir
)

optimal_path <- extract_highest_scoring_path(
  rwr_shortest_path_output,
  desired_path = "TPI1_PMM2"
)


dkainer/RWRtoolkit documentation built on Jan. 11, 2025, 3:26 a.m.