Skip to content

Commit

Permalink
separate KGExplorer funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
bschilder committed Jan 22, 2024
1 parent d5770c7 commit c5041cb
Show file tree
Hide file tree
Showing 202 changed files with 1,902 additions and 5,989 deletions.
Binary file added .DS_Store
Binary file not shown.
32 changes: 12 additions & 20 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: HPOExplorer
Title: Analysis and Visualisation of the Human Phenotype Ontology
Version: 0.99.12
Version: 1.0.0
Authors@R:
c(
person(given = "Brian",
Expand All @@ -18,25 +18,21 @@ Authors@R:
role = c("aut"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-6807-3180")))
Description: HPOExplorer contains useful functions for working with
the Human Phenotype Ontology (HPO).
It allows you to create interactive phenotype network plots,
which can be useful for making web applications.
It also has functions for finding ontology level
(n generations of terms below the selected term),
and getting term definitions from HPO API.
Description: Import, annotate and visualise the 18k+ hierarchically structured
clinical phenotypes across the Human Phenotype Ontology.
License: GPL-3
URL: https://github.com/neurogenomics/HPOExplorer
BugReports: https://github.com/neurogenomics/HPOExplorer/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
Depends:
R (>= 4.1.0)
Imports:
KGExplorer,
simona,
ggplot2,
plotly,
ontologyIndex,
plotly,
utils,
stats,
methods,
Expand All @@ -45,31 +41,27 @@ Imports:
tools,
data.table,
stringr,
EnsDb.Hsapiens.v75,
ensembldb,
AnnotationFilter,
GenomicRanges,
AnnotationHub
GenomicRanges
Suggests:
rmarkdown,
knitr,
devtools,
BiocStyle,
rworkflows,
here,
httr,
jsonlite,
testthat (>= 3.0.0),
igraph,
pals,
Matrix,
MASS,
scales,
htmlwidgets,
R.utils,
piggyback,
patchwork,
BiocParallel
igraph,
tidygraph
Remotes:
github::neurogenomics/KGExplorer
VignetteBuilder: knitr
biocViews:
Genetics, Preprocessing, GeneTarget, SystemsBiology,
Expand Down
45 changes: 6 additions & 39 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
export(add_ancestor)
export(add_death)
export(add_disease)
export(add_disease_definition)
export(add_disease_genes)
export(add_evidence)
export(add_gene_frequency)
export(add_genes)
export(add_hpo_definition)
export(add_hpo_id)
export(add_hpo_synonym)
export(add_info_content)
export(add_mondo)
export(add_ndisease)
Expand All @@ -21,89 +19,58 @@ export(add_pheno_frequency)
export(add_prevalence)
export(add_severity)
export(add_tier)
export(adjacency_matrix)
export(annotate_phenos)
export(assign_tiers)
export(clear_cache)
export(convert_ontology)
export(example_phenos)
export(get_gencc)
export(filter_descendants)
export(get_gene_lists)
export(get_hpo)
export(get_hpo_id_direct)
export(get_monarch)
export(get_mondo)
export(get_ont_lvls)
export(get_ont_lvls2)
export(get_upheno)
export(get_version)
export(ggnetwork_plot)
export(gpt_annot_check)
export(gpt_annot_codify)
export(gpt_annot_plot)
export(gpt_annot_read)
export(harmonise_phenotypes)
export(hpo_api)
export(hpo_to_matrix)
export(kde_surface)
export(list_columns)
export(list_deaths)
export(list_onsets)
export(load_disease_genes)
export(load_phenotype_to_genes)
export(make_hoverboxes)
export(make_igraph_object)
export(make_network_object)
export(make_phenos_dataframe)
export(map_upheno)
export(map_upheno_data)
export(map_upheno_plot)
export(network_3d)
export(make_tiers)
export(map_phenotypes)
export(newlines_to_definition)
export(per_branch_plot)
export(phenos_to_granges)
export(search_hpo)
export(subset_descendants)
import(KGExplorer)
import(data.table)
import(ggplot2)
import(network)
import(simona)
importFrom(KGExplorer,map_mondo)
importFrom(data.table,":=")
importFrom(data.table,.EACHI)
importFrom(data.table,.N)
importFrom(data.table,.SD)
importFrom(data.table,as.data.table)
importFrom(data.table,copy)
importFrom(data.table,data.table)
importFrom(data.table,dcast.data.table)
importFrom(data.table,fcoalesce)
importFrom(data.table,fread)
importFrom(data.table,merge.data.table)
importFrom(data.table,rbindlist)
importFrom(data.table,setcolorder)
importFrom(data.table,setkey)
importFrom(data.table,setkeyv)
importFrom(data.table,setnafill)
importFrom(data.table,setnames)
importFrom(ggnetwork,geom_edges)
importFrom(ggnetwork,ggnetwork)
importFrom(methods,show)
importFrom(ontologyIndex,get_OBO)
importFrom(ontologyIndex,get_ancestors)
importFrom(ontologyIndex,get_descendants)
importFrom(ontologyIndex,get_term_descendancy_matrix)
importFrom(ontologyIndex,get_term_info_content)
importFrom(plotly,ggplotly)
importFrom(plotly,layout)
importFrom(stats,as.dist)
importFrom(stats,as.formula)
importFrom(stats,cor)
importFrom(stats,cutree)
importFrom(stats,hclust)
importFrom(stats,na.omit)
importFrom(stats,setNames)
importFrom(stats,terms)
importFrom(stringr,str_split)
importFrom(stringr,str_wrap)
importFrom(tools,R_user_dir)
importFrom(utils,data)
importFrom(utils,download.file)
Expand Down
43 changes: 40 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# HPOExplorer 1.0.0

## New features

* *MAJOR CHANGES*: Switched from `ontologyIndex` to `simona`,
which seems to be better written and has extensive analysis functions.
* *MAJOR CHANGES*: Moved most non-HPO data annotation to [`KnowledgeNets`](https://github.com/neurogenomics/KnowledgeNets)
- Functions to assess disease or phenotype prevalence (https://github.com/neurogenomics/RareDiseasePrioritisation/issues/34)
- `get_prevalence_orphanet`
- `get_prevalence_oard`
- Functions to assess the existence of models for phenotypes or diseases (https://github.com/neurogenomics/RareDiseasePrioritisation/issues/33)
- `map_upheno`
- `map_upheno_data`
- `map_upheno_plots`
- `map_upheno_heatmap`
- `map_upheno_rainplot`
- `map_upheno_scatterplot`
- `get_monarch`
- `get_monarch_models`

* New exported functions:
- Helper functions:
- `convert_hpo`
- Functions to map IDs across ontologies:
- `add_medgen`
- `add_omop`
- `add_prevalence`
- `add_prevalence_report`
* New internal functions:
- `dt_to_matrix`

## Bug fixes

* `add_mondo`
- Drastically improved cross-ontology mappings to MONDO (https://github.com/monarch-initiative/mondo/issues/6873)
- Add subfunction `map_mondo`

# HPOExplorer 0.99.12

## New features
Expand All @@ -11,7 +48,7 @@
- `load_phenotypes_to_genes`: new attribute.
- New exported helper function: `get_version`
- New exported helper function: `clear_cache`
* Add `make_hpo` internal function.
* Add `make_ontology` internal function.
* Ensure consistent function naming:
- `create_node_data` --> `make_node_data`
* `get_gencc`
Expand Down Expand Up @@ -179,7 +216,7 @@
* `hpo_tiers`:
- Found lots of typos, outdated phenotype names, and mismatched HPO IDs.
We through and manually re-curated all of these and checked that they match up with the
`harmonise_phenotypes` output.
`map_phenotypes` output.
- Add original `hpo_tiers` csv to *inst/extdata*.
* Delete `get_hpo_id` function in favor of `get_hpo_id_direct`
which is more reliable and comprehensive.
Expand Down Expand Up @@ -219,7 +256,7 @@
- `phenos_to_granges`
- `add_onset`
- `add_tier`
- `harmonise_phenotypes`
- `map_phenotypes`
- `get_gene_lists`
- `get_gene_lengths`
- `list_onsets`
Expand Down
Binary file added R/.DS_Store
Binary file not shown.
118 changes: 118 additions & 0 deletions R/_docs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#' @title Main functions
#'
#' @description
#' Main functions.
#' @param phenos A data.table containing HPO IDs and other metadata.
#' @param hpo Human Phenotype Ontology object,
#' loaded from \link[KGExplorer]{get_ontology}.
#' @param add_ont_lvl_absolute Add the absolute ontology level of each HPO term.
#' See \link[KGExplorer]{get_ontology_levels} for more details.
#' @param add_ont_lvl_relative Add the relative ontology level of each HPO term.
#' See \link[KGExplorer]{get_ontology_levels} for more details.
#' @param add_description Whether to get the phenotype descriptions as
#' well (slower).
#' @param add_info_content Add information content column for each phenotype.
#' @param add_disease_data Add all disease metadata columns.
#' This will expand the data using \code{allow.cartesian=TRUE}.
#' @param add_ndiseases Add the number of diseases per phenotype.
#' @param add_pheno_frequencies Add the frequency of each phenotype in
#' each disease.
#' @param add_tiers Add severity Tiers column using
#' \link[HPOExplorer]{add_tier}.
#' @param add_severities Add severity column using
#' \link[HPOExplorer]{add_severity}.
#' @param add_hoverboxes Add hoverdata with
#' \link[KGExplorer]{add_hoverboxes}.
#' @param add_onsets Add age of onset columns using
#' \link[HPOExplorer]{add_onset}.
#' @param add_deaths Add age of death columns using
#' \link[HPOExplorer]{add_death}.
#' @param columns A named vector of columns in \code{phenos}
#' to add to the hoverdata via \link[KGExplorer]{add_hoverboxes}.
#' @param add_disease_definitions Add disease definitions.
#' @param include_mondo Add \href{https://mondo.monarchinitiative.org/}{MONDO}
#' IDs, names, and definitions to each disease.
#' @param interactive Make the plot interactive.
#' @family main
#' @returns Data.
#' @import data.table
#' @import KGExplorer
#' @name main
NULL


#' @title Get functions
#'
#' @description
#' Functions to get data objects and extract elements.
#' @param term One or more ontology IDs.
#' @family get_
#' @param force_new Force a new download or creation of a data resource.
#' @param lvl How many levels deep into the ontology to get ancestors from.
#' For example:
#' \itemize{
#' \item{1: }{"All"}
#' \item{2: }{"Phenotypic abnormality"}
#' \item{3: }{"Abnormality of the nervous system"}
#' \item{4: }{"Abnormality of nervous system physiology"}
#' \item{5: }{"Neurodevelopmental abnormality" or "Behavioral abnormality"}
#' }
#' @inheritParams main
#' @inheritParams make_
#' @returns Data.
#' @name get_
NULL

#' @title Add functions
#'
#' @description
#' Functions to add metadata to data.table objects.
#' @family add_
#' @param agg_by Column to aggregate metadata by.
#' @param add_definitions Add disease definitions using \link{add_mondo}.
#' @inheritParams main
#' @inheritParams make_
#' @inheritParams get_
#' @inheritParams data.table::merge.data.table
#' @returns Annotated data.
#' @name add_
NULL


#' @title Filter functions
#'
#' @description
#' Functions to filter data.table objects.
#' @family filter_
#' @inheritParams main
#' @returns Filtered data.
#' @name filter_
NULL

#' @title Map functions
#'
#' @description
#' Functions to map IDs.
#' @family map_
#' @inheritParams main
#' @inheritParams KGExplorer::map_ontology_terms
#' @returns Mapped data.
#' @name map_
NULL


#' @title Make functions
#'
#' @description
#' Functions to make complex R objects.
#' @param as R object class to return output as.
#' @param phenotype_to_genes Output of
#' \link{load_phenotype_to_genes} mapping phenotypes
#' to gene annotations.
#' @param ancestor The ancestor to get all descendants of. If \code{NULL},
#' returns the entirely ontology.
#' @family make_
#' @inheritParams main
#' @returns R object.
#' @name make_
NULL
Loading

0 comments on commit c5041cb

Please sign in to comment.