-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
2,996 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(conforms_to_delta_fileorg) | ||
export(get_hn2_subnetworks) | ||
importFrom(dplyr,"%>%") | ||
importFrom(rlang,"!!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#' Checks if a directory for a delta value conforms to the expected output | ||
#' | ||
#' Returns \code{TRUE} or \{FALSE} for whether a directory conforms to the | ||
#' expected organization of the delta directory output by HotNet2. | ||
#' | ||
#' @param delta_dir The delta directory. | ||
#' | ||
#' @return A boolean value for wether the directory conforms to the expected file organization. | ||
#' | ||
#' @export conforms_to_delta_fileorg | ||
conforms_to_delta_fileorg <- function(delta_dir) { | ||
|
||
components_txt <- file.path(delta_dir, "components.txt") | ||
if (!check_for_file(components_txt)) return(FALSE) | ||
|
||
results_json <- file.path(delta_dir, "results.json") | ||
if (!check_for_file(results_json)) return(FALSE) | ||
|
||
significance_txt <- file.path(delta_dir, "significance.txt") | ||
if (!check_for_file(significance_txt)) return(FALSE) | ||
|
||
return(TRUE) | ||
} | ||
|
||
|
||
check_for_file <- function(fname) { | ||
if (!file.exists(fname)) { | ||
message(glue::glue("Expected file at {fname} is not available.")) | ||
return(FALSE) | ||
} | ||
return(TRUE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#' Finds the best delta for a the HotNet2 results | ||
#' | ||
#' Briefly, ... (explain how the best delta is chosen). More is explained in the | ||
#' vignette "...". | ||
#' | ||
#' @param delta_tib A data frame (or tibble) with the columns ... for all of the delta values. | ||
#' @param pval_cutoff The maximum p-value to use for statistical significance. | ||
#' | ||
#' @return The best delta value to use or \code{NA} if none can be used. | ||
#' | ||
#' @importFrom dplyr %>% | ||
#' @importFrom rlang !! | ||
get_best_delta <- function(delta_df, pval_cutoff = 0.05) { | ||
delta_best <- delta_df %>% | ||
dplyr::group_by(delta) %>% | ||
dplyr::summarise(sig_ks = sum(pval < !!pval_cutoff)) %>% | ||
dplyr::ungroup() %>% | ||
dplyr::filter(sig_ks > 0) %>% | ||
dplyr::arrange(dplyr::desc(sig_ks), delta) %>% | ||
dplyr::slice(1) %>% | ||
dplyr::pull(delta) | ||
if (length(delta_best) > 0) { | ||
return(delta_best) | ||
} else { | ||
# if no significant deltas | ||
return(NA) | ||
} | ||
} | ||
|
||
utils::globalVariables( | ||
c("delta", "sig_ks", "pval"), | ||
add = TRUE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#' Read in HotNet2 results | ||
#' | ||
#' Point this function at the output directory from HotNet2 and it will retrieve | ||
#' the results from that analysis. | ||
#' | ||
#' @param output_dir The output directory from HotNet2. | ||
#' | ||
#' @return An S3 object with the parsed results from HotNet2. | ||
#' | ||
#' @export get_hn2_subnetworks | ||
get_hn2_subnetworks <- function(output_dir) { | ||
|
||
# check if the output directory exists | ||
if (!dir.exists(output_dir)) { | ||
stop(glue::glue("The directory {output_dir} is not accessible or does not exist.")) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#' Read in the "k" values for a delta directory | ||
#' | ||
#' @param delta_dir The direcotry for a delta value. | ||
#' | ||
#' @return A tibble with columns "size", "expected", "actual", and "pval". | ||
get_k_for_delta <- function(delta_dir) { | ||
sig_tib <- readr::read_tsv( | ||
paste0(delta_dir, "/significance.txt"), | ||
progress = FALSE, col_types = readr::cols()) | ||
colnames(sig_tib) <- c("size", "expected", "actual", "pval") | ||
return(sig_tib) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
pandoc: 2.7.3 | ||
pkgdown: 1.4.0 | ||
pkgdown_sha: ~ | ||
articles: | ||
HotNet2-setup-and-example: HotNet2-setup-and-example.html | ||
articles: [] | ||
|
Oops, something went wrong.