diff --git a/.Rbuildignore b/.Rbuildignore index 41ecc98..ef78815 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,6 @@ ^LICENSE\.md$ ^doc$ ^Meta$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.Rhistory b/.Rhistory index 574f1e5..58c0370 100644 --- a/.Rhistory +++ b/.Rhistory @@ -1,75 +1,3 @@ -sctSpecies = "human", -cores = 1, -MergeResults = TRUE) { -# remove gene lists that do not have enough valid genes (>= 4) -list_names <- get_valid_gene_lists(ctd, -list_names = list_names, -gene_data = gene_data, -list_name_column = list_name_column, -gene_column = gene_column) -# Create results directory and remove finished gene lists -if (!file.exists(results_dir)) { -dir.create(results_dir) -} -if (!overwrite_past_analysis) { -list_names <- get_unfinished_list_names(list_names,results_dir) -} -# Run analysis -ewce_para(list_names = list_names, -gene_data = phenotype_to_genes, -list_name_column = "Phenotype", -gene_column = "Gene", -results_directory = results_dir, -ctd_file = ctd, -background_genes = background, -bootstrap_reps = reps, -annotation_Level= annotLevel, -genes_Species = genelistSpecies, -ctd_Species = sctSpecies, -cores = cores) -# Combine results into a single dataframe -if (MergeResults) { -results_final <- merge_results(results_dir = results_dir, -list_name_column = list_name_column) -saveRDS(results_final,paste0("results_",Sys.time(),"_",Sys.Date())) -return(results_final) -} -} -# TEST IT -test_results <- gen_results(ctd = ctd, -gene_data = phenotype_to_genes, -list_names = Phenotypes, -background_genes = background, -list_name_column = "Phenotype", -gene_column = "Gene", -results_dir = "results/", -overwrite_past_analysis = FALSE, -reps = 10, -annotLevel = 1, -genelistSpecies = "human", -sctSpecies = "human", -cores = 1, -MergeResults = TRUE) -#' Is not analysed? -#' -#' Takes a gene list name and checks the output results directory to see if that -#' gene list has been analysed yet. The ewce_para function outputs the results -#' for each gene list in to the results directory with name format list_name.rds -#' @param list_name The name of a gene list e.g. "Phenotypic abnormality" -#' @param results_dir The path to results directory (with "/" at the end) -#' @return True or false -#' @export -is_not_analysed <- function(list_name,results_dir) { -file_path <- paste0(results_dir,list_name,".rds") -if (file.exists(file_path)){ -return (FALSE) -} else { -return (TRUE) -} -} -# TEST IT -test_results <- gen_results(ctd = ctd, -gene_data = phenotype_to_genes, list_names = Phenotypes, background_genes = background, list_name_column = "Phenotype", @@ -510,3 +438,75 @@ load("data/CTD_DescartesHuman.rda") load("tests/testthat/data/CTD_DescartesHuman.rda") devtools::test() devtools::test() +phenotype_to_genes = load_phenotype_to_genes("data/phenotype_to_genes.txt") +library(HPOExplorer) +phenotype_to_genes = load_phenotype_to_genes("data/phenotype_to_genes.txt") +phenotype_to_genes = load_phenotype_to_genes("tests/testhat/data/phenotype_to_genes.txt") +phenotype_to_genes = load_phenotype_to_genes("tests/testthat/data/phenotype_to_genes.txt") +devtools::load_all() +?ewce_para +load("tests/testthat/data/CTD_DescartesHuman.rda") +Phenos1 = unique(phenotype_to_genes$Phenotype)[1:5] +Phenos2 = unique(phenotype_to_genes$Phenotype)[1:10] +results1 <- ewce_para(Phenos1, +phenotype_to_genes, +list_name_column = "Phenotype", +gene_column ="Gene", +results_directory = "results", +ctd_file = ctd, +background_genes = unique(phenotype_to_genes$Gene), +bootstrap_reps = 10, +annotation_Level = 1, +genes_Species = "human", +ctd_Species = "human", +cores = 1) +mkdir("results") +file.create("results") +dir.create("results") +file.create("results") +dir.create("results") +results1 <- ewce_para(Phenos1, +phenotype_to_genes, +list_name_column = "Phenotype", +gene_column ="Gene", +results_directory = "results", +ctd_file = ctd, +background_genes = unique(phenotype_to_genes$Gene), +bootstrap_reps = 10, +annotation_Level = 1, +genes_Species = "human", +ctd_Species = "human", +cores = 1) +dir.create(tests/testthat/data/results) +dir.create("tests/testthat/data/results") +devtools::test() +devtools::test() +devtools::test() +devtools::test() +devtools::test() +devtools::test() +devtools::test() +resultsdir = "data/results" +for (f in list.files(paste0("tests/testthat/",resultsdir))) { +file.remove(paste0("tests/testthat/",resultsdir,f)) +} +for (f in list.files(paste0("tests/testthat/",resultsdir))) { +file.remove(paste0("tests/testthat/",resultsdir,"/",f)) +} +roxygen2::roxygenise() +?gen_results +devtools::test() +devtools::test() +devtools::test() +devtools::test() +dir.create("testing/test") +dir.create("testing") +file.remove("testing") +dir.remove("testing") +remove.file("testing") +file.remove("testing") +dir.remove("testing") +devtools::test() +devtools::check() +devtools::test() +devtools::check() diff --git a/.gitignore b/.gitignore index 9f583b9..318655d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ inst/doc /doc/ /Meta/ tests/testthat/data/ + diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..c9cafa0 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,5 @@ +url: ~ + +template: + params: + bootswatch: cerulean diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..05f0f9a --- /dev/null +++ b/docs/404.html @@ -0,0 +1,143 @@ + + + + + + + + +Page not found (404) • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ + + +
+ + + +
+ + +
+

Site built with pkgdown 1.6.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html new file mode 100644 index 0000000..aac68f3 --- /dev/null +++ b/docs/LICENSE-text.html @@ -0,0 +1,145 @@ + + + + + + + + +License • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +
YEAR: 2021
+COPYRIGHT HOLDER: MultiEWCE authors
+
+ +
+ + + +
+ + + +
+ + +
+

Site built with pkgdown 1.6.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/LICENSE.html b/docs/LICENSE.html new file mode 100644 index 0000000..e5f0f88 --- /dev/null +++ b/docs/LICENSE.html @@ -0,0 +1,149 @@ + + + + + + + + +MIT License • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +
+ +

Copyright (c) 2021 MultiEWCE authors

+

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

+

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

+

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+
+ +
+ + + +
+ + + +
+ + +
+

Site built with pkgdown 1.6.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/articles/MultiEWCE.html b/docs/articles/MultiEWCE.html new file mode 100644 index 0000000..e581374 --- /dev/null +++ b/docs/articles/MultiEWCE.html @@ -0,0 +1,363 @@ + + + + + + + +Expression Weighted Celltype Enrichment on Multiple Gene Lists With MultiEWCE • MultiEWCE + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+library(MultiEWCE)
+
+

+Introduction

+

The MultiEWCE package is an extension of the EWCE package. It is designed to run expression weighted celltype enrichment (EWCE) on multiple gene lists in parallel. The results are then stored both as separate .rds files, one for each individual EWCE analysis, as well as a in a single dataframe containing all the results.

+

This package is useful in cases where you have a large number of related, but separate, gene lists. In this vignette we will use an example from the Human Phenotype Ontology (HPO). The HPO contains over 9000 clinically relevant phenotypes annotated with lists of genes that have been found to be associated with the particular phenotype.

+
+
+

+Installation

+

This tutorial will require the MultiEWCE package and a few additional packages related to the particular dataset we will be using. Install and load these with the following R code:

+
+# if (!require("devtools")) {
+#   install.packages("devtools")
+# }
+if (!require("HPOExplorer")) {
+  devtools::install_github("ovrhuman/HPOExplorer")
+}
+#if (!require("MultiEWCE")) {
+#  devtools::install_github("ovrhuman/MultiEWCE")
+#}
+
+
+

+Loading Phenotype Associated Gene Lists from the HPO

+

The MultiEWCE package requires the gene data to be in a particular format. It must be a data.frame that includes one column of gene list names, and another column of genes. For example:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PhenotypeGene
“Abnormal heart”gene X
“Abnormal heart”gene Y
“Poor vision”gene Z
“Poor vision”gene Y
“Poor vision”gene W
“Short stature”gene V
+

etc…

+

Now we will get a dataset like this from the HPO.

+
+# Download phenotype associated gene data
+#HPOExplorer::download_phenotype_to_genes("phenotype_to_genes.txt")
+
+# Load data into the environment
+gene_data <- HPOExplorer::load_phenotype_to_genes("phenotype_to_genes.txt")
+
+print(head(gene_data))
+#>           ID                  Phenotype EntrezID     Gene Additional    Source
+#> 1 HP:0000002 Abnormality of body height     5073     PARN            orphadata
+#> 2 HP:0000002 Abnormality of body height    10084    PQBP1            orphadata
+#> 3 HP:0000002 Abnormality of body height    50485 SMARCAL1          -  mim2gene
+#> 4 HP:0000002 Abnormality of body height     2317     FLNB            orphadata
+#> 5 HP:0000002 Abnormality of body height    79648    MCPH1          -  mim2gene
+#> 6 HP:0000002 Abnormality of body height      523  ATP6V1A          -  mim2gene
+#>        LinkID
+#> 1  ORPHA:1775
+#> 2 ORPHA:93950
+#> 3 OMIM:242900
+#> 4   ORPHA:503
+#> 5 OMIM:251200
+#> 6 OMIM:617403
+

In this example our gene list names column is called Phenotype and our column of genes is called Gene. However, different column names can be specified to the MultiEWCE package.

+
+
+

+Setting up input arguments for the gen_results function

+
+ctd <- readRDS("CTD_Descartes_withplot.rds")
+list_names <- unique(gene_data$Phenotype)[1:10]
+background_genes <- unique(gene_data$Gene)
+list_name_column <- "Phenotype"
+gene_column <- "Gene"
+results_dir <- "results"
+overwrite_past_analysis <- FALSE
+MergeResults <- TRUE
+reps <- 10
+annotLevel <- 1
+genelistSpecies <- "human"
+sctSpecies <- "human"
+cores <- 1
+
+

+ctd

+

The ctd (cell type data) file contains the single cell RNA sequence data that is required for EWCE. for further information about generating a ctd please see the EWCE documentation. In this example we will use a CTD of human gene expression data, generated from the Descartes Human Cell Atlas. Replace this with your own CTD file.

+
+
+

+gene_data

+

Gene data is the dataframe containin gene list names and genes, in this case we have already loaded it and assigned it to the variable gene_data.

+
+
+

+list_names

+

This is a character vector containing all the gene list names. This can be obtained from your gene_data as follows. To save time in this example analysis we will only use the first 10 gene lists ([1:10])

+
+
+

+background_genes

+

This is a character vector of genes to be used as the background genes. See EWCE package docs for more details on background genes.

+
+
+

+Column names

+

list_name_column is the name of the column in gene_data that contains the gene list names and gene_column contains the genes.

+
+
+

+Processing results arguments

+

The results_dir argument is the path to the directory where the individual EWCE results will be saved.

+

The overwrite_past_analysis argument can be set to TRUE or FALSE and states if you want to redo and overwrite analysis of gene lists that have already been saved to the results_dir. Setting this to FALSE is useful in cases where you stopped an analysis midway and would like to carry on from where you left off.

+

MergeResults is another TRUE/FALSE argument. If TRUE, gen_results will also return a single dataframe containing all of the results from all gene lists. A .rds file of these merged results will also be saved to your current working directory in a file called “results_<datetime_of_analysis>.rds” ## Number of cores The cores argument is the number of cores you would like to run in parallel. This is dependent on what is available to you on your computer. In this case we will just run it on one core, no parallelism.

+
+
+

+EWCE::bootstrap_enrichment_test arguments

+

The gen_results function calls the EWCE bootstrap_enrichment_test function. Here we set the input parameters related to this.

+

reps is the number of bootstrap reps to run, for this tutorial we will only do 10 to save time, but typically you would want to do closer to 100,000.

+

annotLevel is the level of cell type specificity to use from the ctd file. genelistSpecies can be “human” or “mouse” and is the species of the genes in the gene lists.

+

sctSpecies is the species of the CTD data, also can be “human” or “mouse”.

+
+
+
+

+Run analysis

+

Now we have set up all our desired inputs, we can run the analysis.

+
+all_results <-MultiEWCE::gen_results(ctd,
+                           gene_data,
+                           list_names,
+                           background_genes,
+                           list_name_column,
+                           gene_column,
+                           results_dir,
+                           overwrite_past_analysis,
+                           reps,
+                           annotLevel,
+                           genelistSpecies,
+                           sctSpecies,
+                           cores,
+                           MergeResults) 
+
+
+

+Adjust for multiple comparisons

+

Seeing as we have ran EWCE on multiple gene lists, we need to make adjustments for multiple comparisons. We can use Benjamini-Hochberg procedure to false discovery rate adjusted p values (which we will call q values here).

+
+all_results$q <- stats::p.adjust(all_results$p, method = "BH")
+
+print(head(all_results))
+#>                                          CellType annotLevel   p fold_change
+#> AFP_ALB_positive_cells     AFP_ALB_positive_cells          1 1.0   0.4272957
+#> Acinar_cells                         Acinar_cells          1 1.0   0.5842171
+#> Adrenocortical_cells         Adrenocortical_cells          1 0.8   0.9506813
+#> Amacrine_cells                     Amacrine_cells          1 1.0   0.6769709
+#> Antigen_presenting_cells Antigen_presenting_cells          1 1.0   0.6388861
+#> Astrocytes                             Astrocytes          1 0.5   0.9489154
+#>                          sd_from_mean
+#> AFP_ALB_positive_cells     -3.8668595
+#> Acinar_cells               -2.4460971
+#> Adrenocortical_cells       -0.8480984
+#> Amacrine_cells             -6.2117392
+#> Antigen_presenting_cells   -4.5347799
+#> Astrocytes                 -0.4808309
+#>                                                                 Phenotype q
+#> AFP_ALB_positive_cells   Abnormal morphology of female internal genitalia 1
+#> Acinar_cells             Abnormal morphology of female internal genitalia 1
+#> Adrenocortical_cells     Abnormal morphology of female internal genitalia 1
+#> Amacrine_cells           Abnormal morphology of female internal genitalia 1
+#> Antigen_presenting_cells Abnormal morphology of female internal genitalia 1
+#> Astrocytes               Abnormal morphology of female internal genitalia 1
+
+
+

+Visualise the results

+

Just as an example, we will create a plot showing the number of significant enrichments per phenotype in the all_results data.frame. We will use q <= 0.05 as the significance threshold.

+
+library(ggplot2)
+
+n_signif <- data.frame()
+for (p in unique(all_results$Phenotype)) {
+  n_signif <- rbind(n_signif, 
+                    data.frame("Phenotype" = p
+                               ,"signif_enrichments"=length(
+                                 all_results$q[all_results$Phenotype == p &
+                                                 all_results$q <= 0.05])))
+}
+
+
+plot1 <-  ggplot(n_signif, aes(Phenotype,signif_enrichments)) +
+    geom_col() +
+    xlab("Phenotype") +
+    ylab("Enrichments (n)") +
+    theme_bw() +
+    theme(axis.text.x = element_text(angle=90,vjust = 0.5, hjust = 1))
+
+print(plot1)
+

+
+
+

+Other functions in MultiEWCE

+
+

+merge_results

+

If you have a results directory of individual EWCE results but do not have the merged dataframe of all results, you can call the merge_results function manually. The results_dir argument is the path to your results directory and the list_name_column argument is the name of the column containing gene list names. In this case we used “Phenotype” as this column name when we generated the results.

+
+all_results_2 <- MultiEWCE::merge_results(results_dir = "results",
+                                          list_name_column = "Phenotype")
+
+
+

+get_gene_list

+

This function gets a character vector of genes assocaited with a particular gene list name.

+
+eye_contact_genes <- MultiEWCE::get_gene_list(list_name = "Poor eye contact", 
+                                      gene_data = gene_data,
+                                      list_name_column = "Phenotype",
+                                      gene_column = "Gene")
+
+cat(paste("5 genes associated with poor eye contact:",paste(eye_contact_genes[1:5],collapse = " ")))
+#> 5 genes associated with poor eye contact: TWNK PIGP CDKL5 NDUFAF4 NDUFC2
+
+
+

+get_unfinished_list_names

+

This function is used to find which gene lists you have not yet analysed

+
+unfinished <- MultiEWCE::get_unfinished_list_names(list_names = unique(gene_data$Phenotype)[1:15],
+                                        results_dir = "results")
+cat(paste0("Gene lists not yet analysed:\n",paste(unfinished, collapse = ",\n")))
+#> Gene lists not yet analysed:
+#> Abnormality of the bladder,
+#> Bladder diverticulum,
+#> Urinary retention,
+#> Nocturia,
+#> Migrating focal seizure
+
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.6.1.

+
+ +
+
+ + + + + + diff --git a/docs/articles/MultiEWCE_files/figure-html/display-1.png b/docs/articles/MultiEWCE_files/figure-html/display-1.png new file mode 100644 index 0000000..f841b37 Binary files /dev/null and b/docs/articles/MultiEWCE_files/figure-html/display-1.png differ diff --git a/docs/articles/MultiEWCE_files/header-attrs-2.11/header-attrs.js b/docs/articles/MultiEWCE_files/header-attrs-2.11/header-attrs.js new file mode 100644 index 0000000..dd57d92 --- /dev/null +++ b/docs/articles/MultiEWCE_files/header-attrs-2.11/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/docs/articles/index.html b/docs/articles/index.html new file mode 100644 index 0000000..70e6c29 --- /dev/null +++ b/docs/articles/index.html @@ -0,0 +1,142 @@ + + + + + + + + +Articles • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + + +
+
+ + +
+ + +
+

Site built with pkgdown 1.6.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/authors.html b/docs/authors.html new file mode 100644 index 0000000..8c939eb --- /dev/null +++ b/docs/authors.html @@ -0,0 +1,142 @@ + + + + + + + + +Authors • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +
    +
  • +

    First Last. Author, maintainer. +

    +
  • +
+ +
+ +
+ + + +
+ + +
+

Site built with pkgdown 1.6.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css new file mode 100644 index 0000000..5a85941 --- /dev/null +++ b/docs/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 28px; + font-weight: 500; +} + +/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ +nav[data-toggle='toc'] .nav > .active > ul { + display: block; +} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js new file mode 100644 index 0000000..1cdd573 --- /dev/null +++ b/docs/bootstrap-toc.js @@ -0,0 +1,159 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function() { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function(el) { + var text = $(el).text(); + var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function(el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function(el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function() { + return $(''); + }, + + createChildNavList: function($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function(anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function(headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter($scope, topSelector + ',' + secondarySelector); + }, + + getNavLevel: function(el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function(i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function(arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + } + }, + + // accepts a jQuery object, or an options object + init: function(opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + } + }; + + $(function() { + $('nav[data-toggle="toc"]').each(function(i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(); diff --git a/docs/docsearch.css b/docs/docsearch.css new file mode 100644 index 0000000..e5f1fe1 --- /dev/null +++ b/docs/docsearch.css @@ -0,0 +1,148 @@ +/* Docsearch -------------------------------------------------------------- */ +/* + Source: https://github.com/algolia/docsearch/ + License: MIT +*/ + +.algolia-autocomplete { + display: block; + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1 +} + +.algolia-autocomplete .ds-dropdown-menu { + width: 100%; + min-width: none; + max-width: none; + padding: .75rem 0; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, .1); + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); +} + +@media (min-width:768px) { + .algolia-autocomplete .ds-dropdown-menu { + width: 175% + } +} + +.algolia-autocomplete .ds-dropdown-menu::before { + display: none +} + +.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { + padding: 0; + background-color: rgb(255,255,255); + border: 0; + max-height: 80vh; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + margin-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + padding: 0; + overflow: visible +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + padding: .125rem 1rem; + margin-top: 0; + font-size: 1.3em; + font-weight: 500; + color: #00008B; + border-bottom: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + float: none; + padding-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: none; + width: auto; + padding: 0; + text-align: left +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + float: none; + width: auto; + padding: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content::before { + display: none +} + +.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { + padding-top: .75rem; + margin-top: .75rem; + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { + display: block; + padding: .1rem 1rem; + margin-bottom: 0.1; + font-size: 1.0em; + font-weight: 400 + /* display: none */ +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + display: block; + padding: .25rem 1rem; + margin-bottom: 0; + font-size: 0.9em; + font-weight: 400 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + padding: 0 1rem .5rem; + margin-top: -.25rem; + font-size: 0.8em; + font-weight: 400; + line-height: 1.25 +} + +.algolia-autocomplete .algolia-docsearch-footer { + width: 110px; + height: 20px; + z-index: 3; + margin-top: 10.66667px; + float: right; + font-size: 0; + line-height: 0; +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + background-image: url("data:image/svg+xml;utf8,"); + background-repeat: no-repeat; + background-position: 50%; + background-size: 100%; + overflow: hidden; + text-indent: -9000px; + width: 100%; + height: 100%; + display: block; + transform: translate(-8px); +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF8C00; + background: rgba(232, 189, 54, 0.1) +} + + +.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) +} + +.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { + background-color: rgba(192, 192, 192, .15) +} diff --git a/docs/docsearch.js b/docs/docsearch.js new file mode 100644 index 0000000..b35504c --- /dev/null +++ b/docs/docsearch.js @@ -0,0 +1,85 @@ +$(function() { + + // register a handler to move the focus to the search bar + // upon pressing shift + "/" (i.e. "?") + $(document).on('keydown', function(e) { + if (e.shiftKey && e.keyCode == 191) { + e.preventDefault(); + $("#search-input").focus(); + } + }); + + $(document).ready(function() { + // do keyword highlighting + /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ + var mark = function() { + + var referrer = document.URL ; + var paramKey = "q" ; + + if (referrer.indexOf("?") !== -1) { + var qs = referrer.substr(referrer.indexOf('?') + 1); + var qs_noanchor = qs.split('#')[0]; + var qsa = qs_noanchor.split('&'); + var keyword = ""; + + for (var i = 0; i < qsa.length; i++) { + var currentParam = qsa[i].split('='); + + if (currentParam.length !== 2) { + continue; + } + + if (currentParam[0] == paramKey) { + keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); + } + } + + if (keyword !== "") { + $(".contents").unmark({ + done: function() { + $(".contents").mark(keyword); + } + }); + } + } + }; + + mark(); + }); +}); + +/* Search term highlighting ------------------------------*/ + +function matchedWords(hit) { + var words = []; + + var hierarchy = hit._highlightResult.hierarchy; + // loop to fetch from lvl0, lvl1, etc. + for (var idx in hierarchy) { + words = words.concat(hierarchy[idx].matchedWords); + } + + var content = hit._highlightResult.content; + if (content) { + words = words.concat(content.matchedWords); + } + + // return unique words + var words_uniq = [...new Set(words)]; + return words_uniq; +} + +function updateHitURL(hit) { + + var words = matchedWords(hit); + var url = ""; + + if (hit.anchor) { + url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; + } else { + url = hit.url + '?q=' + escape(words.join(" ")); + } + + return url; +} diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..5aafa19 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,111 @@ + + + + + + + +What the Package Does (One Line, Title Case) • MultiEWCE + + + + + + + + + + +
    +
    + + + + +
    +
    +
    + +

    R package for analysing multiple gene lists in parallel using EWCE

    +
    +

    +Tutorial

    +

    Here is a vignette to help you get started.

    +
    +
    +
    + + +
    + + +
    + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + diff --git a/docs/link.svg b/docs/link.svg new file mode 100644 index 0000000..88ad827 --- /dev/null +++ b/docs/link.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css new file mode 100644 index 0000000..1273238 --- /dev/null +++ b/docs/pkgdown.css @@ -0,0 +1,367 @@ +/* Sticky footer */ + +/** + * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ + * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css + * + * .Site -> body > .container + * .Site-content -> body > .container .row + * .footer -> footer + * + * Key idea seems to be to ensure that .container and __all its parents__ + * have height set to 100% + * + */ + +html, body { + height: 100%; +} + +body { + position: relative; +} + +body > .container { + display: flex; + height: 100%; + flex-direction: column; +} + +body > .container .row { + flex: 1 0 auto; +} + +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + color: #666; + display: flex; + flex-shrink: 0; +} +footer p { + margin-bottom: 0; +} +footer div { + flex: 1; +} +footer .pkgdown { + text-align: right; +} +footer p { + margin-bottom: 0; +} + +img.icon { + float: right; +} + +img { + max-width: 100%; +} + +/* Fix bug in bootstrap (only seen in firefox) */ +summary { + display: list-item; +} + +/* Typographic tweaking ---------------------------------*/ + +.contents .page-header { + margin-top: calc(-60px + 1em); +} + +dd { + margin-left: 3em; +} + +/* Section anchors ---------------------------------*/ + +a.anchor { + margin-left: -30px; + display:inline-block; + width: 30px; + height: 30px; + visibility: hidden; + + background-image: url(./link.svg); + background-repeat: no-repeat; + background-size: 20px 20px; + background-position: center center; +} + +.hasAnchor:hover a.anchor { + visibility: visible; +} + +@media (max-width: 767px) { + .hasAnchor:hover a.anchor { + visibility: hidden; + } +} + + +/* Fixes for fixed navbar --------------------------*/ + +.contents h1, .contents h2, .contents h3, .contents h4 { + padding-top: 60px; + margin-top: -40px; +} + +/* Navbar submenu --------------------------*/ + +.dropdown-submenu { + position: relative; +} + +.dropdown-submenu>.dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover>.dropdown-menu { + display: block; +} + +.dropdown-submenu>a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #cccccc; + margin-top: 5px; + margin-right: -10px; +} + +.dropdown-submenu:hover>a:after { + border-left-color: #ffffff; +} + +.dropdown-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left>.dropdown-menu { + left: -100%; + margin-left: 10px; + border-radius: 6px 0 6px 6px; +} + +/* Sidebar --------------------------*/ + +#pkgdown-sidebar { + margin-top: 30px; + position: -webkit-sticky; + position: sticky; + top: 70px; +} + +#pkgdown-sidebar h2 { + font-size: 1.5em; + margin-top: 1em; +} + +#pkgdown-sidebar h2:first-child { + margin-top: 0; +} + +#pkgdown-sidebar .list-unstyled li { + margin-bottom: 0.5em; +} + +/* bootstrap-toc tweaks ------------------------------------------------------*/ + +/* All levels of nav */ + +nav[data-toggle='toc'] .nav > li > a { + padding: 4px 20px 4px 6px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; +} + +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 5px; + color: inherit; + border-left: 1px solid #878787; +} + +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 5px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; + border-left: 2px solid #878787; +} + +/* Nav: second level (shown on .active) */ + +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-left: 16px; + font-size: 1.35rem; +} + +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 15px; +} + +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 15px; + font-weight: 500; + font-size: 1.35rem; +} + +/* orcid ------------------------------------------------------------------- */ + +.orcid { + font-size: 16px; + color: #A6CE39; + /* margins are required by official ORCID trademark and display guidelines */ + margin-left:4px; + margin-right:4px; + vertical-align: middle; +} + +/* Reference index & topics ----------------------------------------------- */ + +.ref-index th {font-weight: normal;} + +.ref-index td {vertical-align: top; min-width: 100px} +.ref-index .icon {width: 40px;} +.ref-index .alias {width: 40%;} +.ref-index-icons .alias {width: calc(40% - 40px);} +.ref-index .title {width: 60%;} + +.ref-arguments th {text-align: right; padding-right: 10px;} +.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} +.ref-arguments .name {width: 20%;} +.ref-arguments .desc {width: 80%;} + +/* Nice scrolling for wide elements --------------------------------------- */ + +table { + display: block; + overflow: auto; +} + +/* Syntax highlighting ---------------------------------------------------- */ + +pre { + word-wrap: normal; + word-break: normal; + border: 1px solid #eee; +} + +pre, code { + background-color: #f8f8f8; + color: #333; +} + +pre code { + overflow: auto; + word-wrap: normal; + white-space: pre; +} + +pre .img { + margin: 5px 0; +} + +pre .img img { + background-color: #fff; + display: block; + height: auto; +} + +code a, pre a { + color: #375f84; +} + +a.sourceLine:hover { + text-decoration: none; +} + +.fl {color: #1514b5;} +.fu {color: #000000;} /* function */ +.ch,.st {color: #036a07;} /* string */ +.kw {color: #264D66;} /* keyword */ +.co {color: #888888;} /* comment */ + +.message { color: black; font-weight: bolder;} +.error { color: orange; font-weight: bolder;} +.warning { color: #6A0366; font-weight: bolder;} + +/* Clipboard --------------------------*/ + +.hasCopyButton { + position: relative; +} + +.btn-copy-ex { + position: absolute; + right: 0; + top: 0; + visibility: hidden; +} + +.hasCopyButton:hover button.btn-copy-ex { + visibility: visible; +} + +/* headroom.js ------------------------ */ + +.headroom { + will-change: transform; + transition: transform 200ms linear; +} +.headroom--pinned { + transform: translateY(0%); +} +.headroom--unpinned { + transform: translateY(-100%); +} + +/* mark.js ----------------------------*/ + +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} + +/* vertical spacing after htmlwidgets */ +.html-widget { + margin-bottom: 10px; +} + +/* fontawesome ------------------------ */ + +.fab { + font-family: "Font Awesome 5 Brands" !important; +} + +/* don't display links in code chunks when printing */ +/* source: https://stackoverflow.com/a/10781533 */ +@media print { + code a:link:after, code a:visited:after { + content: ""; + } +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js new file mode 100644 index 0000000..7e7048f --- /dev/null +++ b/docs/pkgdown.js @@ -0,0 +1,108 @@ +/* http://gregfranko.com/blog/jquery-best-practices/ */ +(function($) { + $(function() { + + $('.navbar-fixed-top').headroom(); + + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); + }); + + $('[data-toggle="tooltip"]').tooltip(); + + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + // Ignore external links + if (links[i].host !== location.host) + continue; + + var nav_path = paths(links[i].pathname); + + var length = prefix_length(nav_path, cur_path); + if (length > max_length) { + max_length = length; + pos = i; + } + } + + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); + menu_anchor.parent().addClass("active"); + menu_anchor.closest("li.dropdown").addClass("active"); + } + }); + + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + + // Returns -1 if not found + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(-1); + + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 0 : -1); + } + + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } + + return(haystack.length); + } + + /* Clipboard --------------------------*/ + + function changeTooltipMessage(element, msg) { + var tooltipOriginalTitle=element.getAttribute('data-original-title'); + element.setAttribute('data-original-title', msg); + $(element).tooltip('show'); + element.setAttribute('data-original-title', tooltipOriginalTitle); + } + + if(ClipboardJS.isSupported()) { + $(document).ready(function() { + var copyButton = ""; + + $(".examples, div.sourceCode").addClass("hasCopyButton"); + + // Insert copy buttons: + $(copyButton).prependTo(".hasCopyButton"); + + // Initialize tooltips: + $('.btn-copy-ex').tooltip({container: 'body'}); + + // Initialize clipboard: + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { + text: function(trigger) { + return trigger.parentNode.textContent; + } + }); + + clipboardBtnCopies.on('success', function(e) { + changeTooltipMessage(e.trigger, 'Copied!'); + e.clearSelection(); + }); + + clipboardBtnCopies.on('error', function() { + changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); + }); + }); + } +})(window.jQuery || window.$) diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml new file mode 100644 index 0000000..06aaa82 --- /dev/null +++ b/docs/pkgdown.yml @@ -0,0 +1,7 @@ +pandoc: 2.11.4 +pkgdown: 1.6.1 +pkgdown_sha: ~ +articles: + MultiEWCE: MultiEWCE.html +last_built: 2021-11-10T11:38Z + diff --git a/docs/reference/RDA_assign_load.html b/docs/reference/RDA_assign_load.html new file mode 100644 index 0000000..7916aaf --- /dev/null +++ b/docs/reference/RDA_assign_load.html @@ -0,0 +1,172 @@ + + + + + + + + +Load RDA file and assign to specific variable +Can be useful, but sort of pointless now as we have decided to only use .rds — RDA_assign_load • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Load RDA file and assign to specific variable +Can be useful, but sort of pointless now as we have decided to only use .rds

    +
    + +
    RDA_assign_load(file)
    + +

    Arguments

    + + + + + + +
    file

    file path to rda <string>

    + +

    Value

    + +

    the data contained in the .rda file

    + +

    Examples

    +
    +if (FALSE) { +files = "results.rds" +RDA_assign_load(file)} + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png new file mode 100644 index 0000000..17a3580 Binary files /dev/null and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/ewce_para.html b/docs/reference/ewce_para.html new file mode 100644 index 0000000..45168fb --- /dev/null +++ b/docs/reference/ewce_para.html @@ -0,0 +1,218 @@ + + + + + + + + +EWCE parallel — ewce_para • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Runs EWCE in parallel on multiple gene lists.

    +
    + +
    ewce_para(
    +  list_names,
    +  gene_data,
    +  list_name_column = "Phenotype",
    +  gene_column = "Gene",
    +  results_directory,
    +  ctd_file,
    +  background_genes,
    +  bootstrap_reps,
    +  annotation_Level,
    +  genes_Species,
    +  ctd_Species,
    +  cores
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    list_names

    character vector of gene list names

    gene_data

    data frame of gene list names and genes (see ?get_gene_list)

    list_name_column

    The name of the gene_data column that has the gene list names

    gene_column

    The name of the gene_data column that contains the genes

    results_directory

    The desired output filepath for results to be saved

    ctd_file

    The cell type data object for EWCE analysis (see EWCE docs)

    background_genes

    The background geneset for EWCE analysis (see EWCE docs)

    bootstrap_reps

    The number of bootstrap reps <int> (e.g. 100000)

    annotation_Level

    The level of desired cell resolution from the CTD

    genes_Species

    The species of gene lists <string> "human" or "mouse"

    ctd_Species

    "human" or "mouse" <string>

    cores

    The number of cores to run in parallel (e.g. 8) <int>

    + +

    Value

    + +

    True if analysis was sucessful, +saves results at "<results_directory>/<list_name>.rds"

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/ewce_plot.html b/docs/reference/ewce_plot.html new file mode 100644 index 0000000..32a99c3 --- /dev/null +++ b/docs/reference/ewce_plot.html @@ -0,0 +1,171 @@ + + + + + + + + +Modification to ewce.plot function to automatically align the dendrogram — ewce_plot • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Modification to ewce.plot function to automatically align the dendrogram

    +
    + +
    ewce_plot(total_res, mtc_method = "bonferroni", ctd = NULL)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    total_res

    Results to be plotted ?

    mtc_method

    Multiple comparison adjustment method

    ctd

    Cell type data object <list>

    + +

    Value

    + +

    A bar chart with dendrogram of EWCE results in each cell type.

    + +

    Examples

    +
    if (FALSE) ewce.plot(results_dataframe,"bonferroni",CTD) +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/gen_results.html b/docs/reference/gen_results.html new file mode 100644 index 0000000..a9027c5 --- /dev/null +++ b/docs/reference/gen_results.html @@ -0,0 +1,264 @@ + + + + + + + + +Generate results — gen_results • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Generates EWCE results on multiple gene lists in parallel by calling +ewce_para. It allows you to stop the analysis and then continue later +from where you left off as it checks the results output directory for finished +gene lists and removes them from the input. It also excludes gene lists with +less than 4 unique genes (which cause errors in ewce analysis).

    +
    + +
    gen_results(
    +  ctd,
    +  gene_data,
    +  list_names,
    +  background_genes,
    +  list_name_column = "Phenotype",
    +  gene_column = "Gene",
    +  results_dir = "results",
    +  overwrite_past_analysis = FALSE,
    +  reps = 10,
    +  annotLevel = 1,
    +  genelistSpecies = "human",
    +  sctSpecies = "human",
    +  cores = 1,
    +  MergeResults = TRUE
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ctd

    The Cell type data file for EWCE analysis (see EWCE docs)

    gene_data

    The dataframe containing gene list names and associated genes +(see docs for get_gene_list for more info).

    list_names

    The names of each gene list (e.g. "Abnormality of nervous system +may be the name of a phenotype assocated gene list)

    background_genes

    A character vector of background genes (see EWCE docs)

    list_name_column

    The name of the column in gene_data that contains the +gene list names, (e.g. the column may be called "Phenotype" if dealing with +phenotype associated gene lists)

    gene_column

    The name of the column containing genes in the gene_data +dataframe. Typically this column is called "Gene"

    results_dir

    the desired direcory to save results (e.g. "results")

    overwrite_past_analysis

    overwrite previous results in the results dir <bool>

    reps

    The number of bootstrap reps for EWCE (see ewce docs) <int>

    annotLevel

    The level of cell specificity to select from the CTD, +See EWCE docs <int>

    genelistSpecies

    The species ("human"/"mouse") of the gene lists <string>

    sctSpecies

    The species ("human"/"mouse") of the CTD data

    cores

    The number of cores to run in parallel <int>

    MergeResults

    Save all results merged to single data.frame as a .rds. +Note: The function will return merged dataframe even if FALSE <bool>

    + +

    Value

    + +

    If MergeResults == TRUE, it will return all results as a datframe. If +FALSE nothing will be returned, but the individual results will still be saved +in the results directory.

    +

    Details

    + +

    The gene_data should be a data frame that contains a column of gene +list names (e.g. the column may be called "Phenotype"), and a column of +genes (e.g. "Gene"). For example:

    + + + + + + +
    PhenotypeGene
    "Abnormal heart"gene X
    "Abnormal heart"gene Y
    "Poor vision"gene Z
    "Poor vision"gene Y
    etc...
    + + + +

    For more information on this see docs for get_gene_list (?get_gene_list)

    +

    If MergeResutls == TURE, the function will return a dataframe of all results. +No multiple testing corrections are applied to this so it is recommended that +they are done after, for example: +all_results$q <- stats::p.adjust(all_results$p, method = "BH")

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/get_gene_list.html b/docs/reference/get_gene_list.html new file mode 100644 index 0000000..18902ee --- /dev/null +++ b/docs/reference/get_gene_list.html @@ -0,0 +1,210 @@ + + + + + + + + +get_gene_list — get_gene_list • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This returns a character vector of genes (a gene list). The gene_data should +be a data frame that contains a column of gene list names (e.g. the column +may be called "Phenotype"), and a column of genes (e.g. "Gene"). For example, +lets call the following data frame phenotype_to_genes:

    +
    + +
    get_gene_list(
    +  list_name,
    +  gene_data,
    +  list_name_column = "Phenotype",
    +  gene_column = "Gene"
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    list_name

    The name of the gene list of interest <string>

    gene_data

    The data frame of gene list names and associated +genes <data.frame>

    list_name_column

    The name of the column in gene_data that contains +gene list names <string>

    gene_column

    The name of the column in gene_data that contains +the genes <string>

    + +

    Value

    + +

    A charcter vector of genes associated with the selected list_name

    +

    Details

    + + + + + + + + + +
    PhenotypeGene
    "Abnormal heart"gene X
    "Abnormal heart"gene Y
    "Poor vision"gene Z
    "Poor vision"gene Y
    etc...
    + + + +

    In the example above, if we wanted to extract genes related to "Abnormal heart", +we would run the following example:

    + +

    Examples

    +
    if (FALSE) { +heart_genes <- get_gene_list(list_name = "Abnormal heart", + gene_data = phenotype_to_genes, + list_name_column = "Phenotype", + gene_column = "Gene") +} +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/get_unfinished_list_names.html b/docs/reference/get_unfinished_list_names.html new file mode 100644 index 0000000..aecd104 --- /dev/null +++ b/docs/reference/get_unfinished_list_names.html @@ -0,0 +1,177 @@ + + + + + + + + +Get unfinished list names — get_unfinished_list_names • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Gets the unfinished gene list names. It reads the file names in the results +directory and uses this to deduce which gene lists have already been analysed. +This means you can pause the analysis of multiple gene lists and it will not +re-analyse the already completed ones when you start again.

    +
    + +
    get_unfinished_list_names(list_names, results_dir)
    + +

    Arguments

    + + + + + + + + + + +
    list_names

    A char vector of gene list names

    results_dir

    The directory containing analysed results.

    + +

    Value

    + +

    A character vector of list_names that still need to be analysed.

    + +

    Examples

    +
    if (FALSE) { +list_names <- unique(data$phenotypes) +results_dir <- "output/" +get_unfinished_list_names(list_names,results_dir) +} +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/get_valid_gene_lists.html b/docs/reference/get_valid_gene_lists.html new file mode 100644 index 0000000..23559a1 --- /dev/null +++ b/docs/reference/get_valid_gene_lists.html @@ -0,0 +1,201 @@ + + + + + + + + +get valid gene lists — get_valid_gene_lists • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Gene lists for EWCE must have 4 or more genes. These genes must also be present +in the CTD file (see EWCE docs), and must be unique (occasionally a gene list +may contain the same gene repeated. This would cause an error).

    +
    + +
    get_valid_gene_lists(
    +  ctd,
    +  list_names,
    +  gene_data,
    +  list_name_column = "Phenotype",
    +  gene_column = "Gene"
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    ctd

    CTD (cell type data file) see EWCE docs

    list_names

    Vector of gene list names <character vector>

    gene_data

    data frame containing a gene column and a column of list_names

    list_name_column

    The name of the column that contains +gene list_names <string>

    gene_column

    The name of the gene column (e.g. "Gene") <string>

    + +

    Value

    + +

    A character vector of list_names that are associated with a valid +number of genes

    +

    Details

    + +

    This function gets gene lists that have atleast four unique genes that are also +present in the CTD file.

    + +

    Examples

    +
    if (FALSE) { +remove_invalid_gene_lists(ctd, + list_names, + gene_data, + list_names_column = "Phenotype", + gene_column = "Gene") +} +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html new file mode 100644 index 0000000..84b05e6 --- /dev/null +++ b/docs/reference/index.html @@ -0,0 +1,217 @@ + + + + + + + + +Function reference • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    All functions

    +

    +
    +

    ewce_para()

    +

    EWCE parallel

    +

    ewce_plot()

    +

    Modification to ewce.plot function to automatically align the dendrogram

    +

    gen_results()

    +

    Generate results

    +

    get_gene_list()

    +

    get_gene_list

    +

    get_unfinished_list_names()

    +

    Get unfinished list names

    +

    get_valid_gene_lists()

    +

    get valid gene lists

    +

    is_not_analysed()

    +

    Is not analysed?

    +

    merge_results()

    +

    merge results

    +

    RDA_assign_load()

    +

    Load RDA file and assign to specific variable +Can be useful, but sort of pointless now as we have decided to only use .rds

    +
    + + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/is_not_analysed.html b/docs/reference/is_not_analysed.html new file mode 100644 index 0000000..8f05a8d --- /dev/null +++ b/docs/reference/is_not_analysed.html @@ -0,0 +1,168 @@ + + + + + + + + +Is not analysed? — is_not_analysed • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Takes a gene list name and checks the output results directory to see if that +gene list has been analysed yet. The ewce_para function outputs the results +for each gene list in to the results directory with name format list_name.rds

    +
    + +
    is_not_analysed(list_name, results_dir)
    + +

    Arguments

    + + + + + + + + + + +
    list_name

    The name of a gene list e.g. "Phenotypic abnormality"

    results_dir

    The path to results directory

    + +

    Value

    + +

    True or false <bool>

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.6.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/reference/merge_results.html b/docs/reference/merge_results.html new file mode 100644 index 0000000..2ef906b --- /dev/null +++ b/docs/reference/merge_results.html @@ -0,0 +1,166 @@ + + + + + + + + +merge results — merge_results • MultiEWCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    merges individual .rds files from the results output directory into one +dataframe.

    +
    + +
    merge_results(results_dir = "results", list_name_column = "phenotype")
    + +

    Arguments

    + + + + + + + + + + +
    results_dir

    The filepath to results .rds files

    list_name_column

    The column name for gene list_names (e.g. phenotypes)

    + +

    Value

    + +

    dataframe

    + +
    + +
    + + + +
    + + + + + + + + diff --git a/vignettes/.gitignore b/vignettes/.gitignore index 097b241..391e1bf 100644 --- a/vignettes/.gitignore +++ b/vignettes/.gitignore @@ -1,2 +1,4 @@ *.html *.R +CTD_Descartes_withplot.rds +phenotype_to_genes.txt \ No newline at end of file diff --git a/vignettes/MultiEWCE.Rmd b/vignettes/MultiEWCE.Rmd index e80e423..10797a0 100644 --- a/vignettes/MultiEWCE.Rmd +++ b/vignettes/MultiEWCE.Rmd @@ -27,15 +27,15 @@ This package is useful in cases where you have a large number of related, but se This tutorial will require the MultiEWCE package and a few additional packages related to the particular dataset we will be using. Install and load these with the following R code: ```{r install, message = FALSE, warning = FALSE, eval = FALSE} -if (!require("devtools")) { - install.packages("devtools") -} +# if (!require("devtools")) { +# install.packages("devtools") +# } if (!require("HPOExplorer")) { devtools::install_github("ovrhuman/HPOExplorer") } -if (!require("MultiEWCE")) { - devtools::install_github("ovrhuman/MultiEWCE") -} +#if (!require("MultiEWCE")) { +# devtools::install_github("ovrhuman/MultiEWCE") +#} ``` # Loading Phenotype Associated Gene Lists from the HPO @@ -55,7 +55,7 @@ Now we will get a dataset like this from the HPO. ```{r get_HPO_data, message = FALSE, warning = FALSE, eval = FALSE} # Download phenotype associated gene data -HPOExplorer::download_phenotype_to_genes("phenotype_to_genes.txt") +#HPOExplorer::download_phenotype_to_genes("phenotype_to_genes.txt") # Load data into the environment gene_data <- HPOExplorer::load_phenotype_to_genes("phenotype_to_genes.txt") @@ -118,8 +118,8 @@ The `gen_results` function calls the EWCE `bootstrap_enrichment_test` function. # Run analysis Now we have set up all our desired inputs, we can run the analysis. -```{r run, warning = FALSE, message = FALSE, eval = FALSE} -all_results <- gen_results(ctd, +```{r run, warning = FALSE, message = FALSE, eval = FALSE} +all_results <-MultiEWCE::gen_results(ctd, gene_data, list_names, background_genes, @@ -177,7 +177,7 @@ print(plot1) If you have a results directory of individual EWCE results but do not have the merged dataframe of all results, you can call the `merge_results` function manually. The `results_dir` argument is the path to your results directory and the `list_name_column` argument is the name of the column containing gene list names. In this case we used "Phenotype" as this column name when we generated the results. ```{r merge, eval = FALSE} -all_results_2 <- merge_results(results_dir = "results", +all_results_2 <- MultiEWCE::merge_results(results_dir = "results", list_name_column = "Phenotype") ``` @@ -197,7 +197,7 @@ cat(paste("5 genes associated with poor eye contact:",paste(eye_contact_genes[1: This function is used to find which gene lists you have not yet analysed ```{r get_unfinished, eval = FALSE} -unfinished <- get_unfinished_list_names(list_names = unique(gene_data$Phenotype)[1:15], +unfinished <- MultiEWCE::get_unfinished_list_names(list_names = unique(gene_data$Phenotype)[1:15], results_dir = "results") cat(paste0("Gene lists not yet analysed:\n",paste(unfinished, collapse = ",\n"))) ```