Skip to content

Commit

Permalink
pkgdown
Browse files Browse the repository at this point in the history
  • Loading branch information
bobGSmith committed Nov 10, 2021
1 parent 37f23a2 commit c1f20b9
Show file tree
Hide file tree
Showing 34 changed files with 4,211 additions and 83 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
^LICENSE\.md$
^doc$
^Meta$
^_pkgdown\.yml$
^docs$
^pkgdown$
144 changes: 72 additions & 72 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -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 <bool>
#' @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",
Expand Down Expand Up @@ -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()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ inst/doc
/doc/
/Meta/
tests/testthat/data/

5 changes: 5 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
url: ~

template:
params:
bootswatch: cerulean
143 changes: 143 additions & 0 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c1f20b9

Please sign in to comment.