Skip to content

Commit

Permalink
Proper documentations
Browse files Browse the repository at this point in the history
Linking each entry
  • Loading branch information
noriakis committed Apr 15, 2024
1 parent 18e7451 commit 1020c92
Show file tree
Hide file tree
Showing 76 changed files with 524 additions and 167 deletions.
1 change: 0 additions & 1 deletion R/alliance.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#' @examples
#' geneList <- c("DDX41","PNKP","ERCC1","IRF3","XRCC1")
#' \dontrun{alliance(geneList)}

alliance <- function (geneList,
alliancePath="GENE-DESCRIPTION-TSV_HUMAN.tsv",
keyType="SYMBOL",
Expand Down
34 changes: 26 additions & 8 deletions R/biotextgraph.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#' biotextgraph
#'
#' wrapper for functions refseq, pubmed, enzyme, and bugsigdb
#' @description wrapper for functions refseq, pubmed, enzyme, and bugsigdb
#' @details The function calls the various types of databases (refseq, pubmed, ...)
#' for summarizing the textual data.
#'
#' @param target "pubmed", "bugsigdb", "refseq", "ec"
#' @param argList passed to each function
Expand Down Expand Up @@ -152,7 +154,9 @@ setMethod("plot",

#' plotNet
#'
#' Plot the network changing the visualization parameters
#' @description Plot the network stored in the biotext object with changing the visualization parameters.
#' @details The function accepts the already calculated biotext object and outputs the visualization based on
#' the specified parameters.
#'
#' @rdname plotnet
#' @param x biotextgraph object
Expand Down Expand Up @@ -183,6 +187,11 @@ setMethod("plot",
#' @param scaleRange scale for label and node size in the network.
#' @param autoScale scale the label and node size automatically for the large network.
#' @export
#' @examples
#' library(ggraph)
#' geneList <- c("DDX41","PNKP","ERCC1","IRF3","XRCC1")
#' test <- refseq(geneList)
#' plotNet(test, asis=TRUE)
#' @return biotext object with network visualization changed
setGeneric("plotNet",
function(x, layout="nicely", edgeLink=TRUE,
Expand Down Expand Up @@ -291,8 +300,9 @@ setMethod("plotNet", "biotext",

#' plotWC
#'
#' plot the wordcloud changing the visualization parameters
#'
#' @description Plot the wordcloud changing the visualization parameters.
#' @details The function accepts the already calculated biotext object and outputs the visualization based on
#' the specified parameters.
#' @rdname plotwc
#' @param x biotext object
#' @param tagPalette tag palette when `tag` is TRUE. It is also used for dependency network
Expand All @@ -310,6 +320,10 @@ setMethod("plotNet", "biotext",
#' @param asis plot the original network (default to FALSE)
#' @param fontFamily font family to use, default to "sans".
#' @export
#' @examples
#' geneList <- c("DDX41","PNKP","ERCC1","IRF3","XRCC1")
#' test <- refseq(geneList, plotType="wc")
#' plotWC(test, asis=TRUE)
#' @return wordcloud visualization
setGeneric("plotWC",
function(x, tagPalette=NULL, madeUpper=c("dna","rna"),
Expand Down Expand Up @@ -453,7 +467,8 @@ setMethod("plotWC", "biotext",

#' getSlot
#'
#' get the slot value from biotext object
#' @description get the slot value from biotext object
#' @details get the slot value from biotext object
#'
#' @param x biotext object
#' @param slot slot name
Expand All @@ -464,10 +479,10 @@ setMethod("plotWC", "biotext",
#' @return attribute value
setGeneric("getSlot",
function(x, slot) standardGeneric("getSlot"))

#' getSlot
#'
#' get the slot value from biotext object
#' @description get the slot value from biotext object
#' @details get the slot value from biotext object
#'
#' @param x biotext object
#' @param slot slot name
Expand All @@ -482,7 +497,10 @@ setMethod("getSlot", "biotext",

#' plotORA
#'
#' plot volcano-plot like plot for ORA results
#' @description plot volcano-plot like plot for ORA results
#' @details Plot the volcano-plot like plot for the ORA results
#' using the biotext object. The ORA should be performed beforehand
#' by specifying ora option to TRUE.
#'
#' @param x biotext object
#' @param thresh hline to draw in plot
Expand Down
9 changes: 7 additions & 2 deletions R/compareWordNet.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#' compareWordNet
#'
#' compare two gene clusters based on words
#' @description Compare multiple networks based on words
#' @details The function accepts list (named) of biotext object, and
#' plot the merged network highlighting the intersection of the network
#' and identified clusters.
#'
#' @param listOfNets list consisting results of wc* functions (plotType="network")
#' @param titles title to be shown on plot
Expand Down Expand Up @@ -264,7 +267,9 @@ compareWordNet <- function(listOfNets, titles=NULL,

#' plotDynamic
#'
#' list network of words using graphlayouts::layout_as_dynamic
#' @description List network of words using graphlayouts::layout_as_dynamic
#' @details The function accepts the list of biotext object storing inferred networks.
#' The networks are aligned by the specific layout and plotted.
#'
#' @param listOfNets list consisting results of wc* functions (plotType="network")
#' @param concat "union" or "intersection"
Expand Down
11 changes: 6 additions & 5 deletions R/enzyme.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#' enzyme
#'
#' Query the Enzyme Comission number and obtain description,
#' @description Text mining the enzyme information.
#'
#' @details Query the Enzyme Comission number and obtain description,
#' and search pubmed for these enzymes and make word cloud and
#' correlation network. Need "enzyme.dat" from ExPASy
#' (https://enzyme.expasy.org/).
#' correlation network. Need to specify the path to "enzyme.dat"
#' downloaded from from ExPASy (https://enzyme.expasy.org/).
#'
#' @param file file downloaded from expasy
#' @param ecnum candidate ecnum, like those obtained from eggNOG-mapper
Expand All @@ -22,8 +24,7 @@
#' file <- "enzyme.dat"
#' \dontrun{enzyme(file, ecnum="1.2.1.1")}
#' @export
#'

#' @seealso generalf
enzyme <- function(file, ecnum, onlyTerm=FALSE, onlyDf=FALSE, target="abstract",
taxec=FALSE, taxFile=NULL, candTax=NULL, argList=list(),
apiKey=NULL) {
Expand Down
10 changes: 5 additions & 5 deletions R/exportWCNetwork.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' exportWCNetwork
#'
#' export the wordcloud network provided the gene cluster network
#' Node size will be the number of genes in the cluster
#' By default use cola layout, and see below for the parameters
#' https://github.com/cytoscape/cytoscape.js-cola
#'
#' @description Export wordcloud networks to Cytoscape.js
#' @details The function exports the wordcloud network provided the gene cluster network.
#' Node size will be the number of genes in the cluster.
#' By default use cola layout, and see below for the parameters of the layout.
#' (https://github.com/cytoscape/cytoscape.js-cola)
#' If "strength" attribute is in the edge of igraph object,
#' the parameter is used to size the edge width.
#'
Expand Down
6 changes: 4 additions & 2 deletions R/external.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

#' refseqWGCNA
#'
#' Return the list of biotext class object per cluster for the blockwise module results in WGCNA
#' @description Text mining WGCNA results
#' @details Return the list of biotext class object per cluster for the blockwise module results in WGCNA
#'
#' @param wgcna results of blockwiseModules()
#' @param keyType key type of gene
Expand All @@ -26,7 +27,8 @@ refseqWGCNA <- function(wgcna, keyType="ENSEMBL", argList=list()) {

#' refseqDESeq2
#'
#' Return the biotext class object by specified filter in DESeq2 results object
#' @description Text mining DESeq2 results
#' @details Return the biotext class object by specified filter in DESeq2 results object
#'
#' @param res results of DESeq2::results()
#' @param condition filtering condition
Expand Down
19 changes: 15 additions & 4 deletions R/geom_sc_wordcloud.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

#' obtainMarkersWC
#'
#' obtain wordclouds of cluster markers identified in Seurat
#'
#' @description obtain wordclouds of cluster markers identified in Seurat
#' @details Using the results of marker gene identification such as `FindAllMarkers` from Seurat,
#' Recursively summarize the textual information of markers and output the wordclouds.
#' @rdname obtainMarkersWC
#' @param markers marker data frame
#' @param cols list of colors
#' @param wcArgs arguments for ggwordcloud
Expand Down Expand Up @@ -61,7 +63,11 @@ obtainMarkersWC <- function(markers,


#' obtainMarkersWCScran
#' make gene wordcloud from scran::findMarkers() results
#'
#' @description Make gene wordcloud from scran::findMarkers() results
#' @details using the results of marker gene identification such as `findMarkers` from scran,
#' Recursively summarize the textual information of markers and output the wordclouds.
#' @rdname obtainMarkersWCScran
#' @param markers marker list
#' @param cols list of colors
#' @param wcArgs arguments for ggwordcloud
Expand Down Expand Up @@ -127,7 +133,9 @@ obtainMarkersWCScran <- function(markers,
}

#' ggplot_add.geom_sc_wordcloud
#' use ggplot_add to populate single-cell plot with textual information
#' @description Use ggplot_add to populate single-cell plot with textual information
#' @details Use layered approach to add wordclouds to the dimension reduction plots
#' from single cell transcriptomics data. Use with `ggsc`.
#' @param object An object to add to the plot
#' @param plot The ggplot object to add object to
#' @param object_name The name of the object to add
Expand Down Expand Up @@ -290,6 +298,9 @@ ggplot_add.geom_sc_wordcloud <- function(object, plot, object_name) {
}

#' geom_sc_wordcloud
#' @description Use ggplot_add to populate single-cell plot with textual information
#' @details Use layered approach to add wordclouds to the dimension reduction plots
#' from single cell transcriptomics data. Use with `ggsc`.
#' @param markers FindAllMarkers() results
#' @param show_markers candidate clusters to be appear in plot, default to NULL,
#' which means all the clusters are plotted
Expand Down
16 changes: 11 additions & 5 deletions R/getWordsOnDendro.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#' plotEigengeneNetworksWithWords
#'
#' plot an eigengene dendrogram with word annotation
#'
#' @description Plot an eigengene dendrogram with word annotation
#' @details The function accepts the module eigengene (ME) data.frame and
#' named vector of genes with ME information and returns the dendrogram with
#' textual information. The input is the typical output of WGCNA.
#'
#' @param MEs module eigengene data (data.frame of row as sample and col as gene cluster IDs)
#' @param colors named vector of cluster
Expand Down Expand Up @@ -236,7 +238,10 @@ plotEigengeneNetworksWithWords <- function (MEs, colors, nboot=100,

#' getWordsOnDendro
#'
#' Get grobs to plot on the dendrogram with the position information
#' @description Get grobs to plot on the dendrogram with the position information
#' @details The function accepts the dendrogram and named vector of genes with associated clusters
#' and returns the list of plots with the positional information. Used internally in
#' `plotEigengeneNetworksWithWords`.
#'
#' @param dhc dendrogram
#' @param geneVec gene-named vector of node names in dendrogram
Expand Down Expand Up @@ -505,8 +510,9 @@ getWordsOnDendro <- function(dhc, geneVec, geneNumLimit=1000,

#' returnPyramid
#'
#' Return pyramid plots
#'
#' @description Return pyramid plots
#' @details Returns the pyramid plots of text frequencies between clusters.
#' Used internally in getWordsOnDendro.
#'
#' @param L genes in the cluster
#' @param R genes in the other cluster
Expand Down
2 changes: 1 addition & 1 deletion R/manual.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' manual
#'
#' Produce networks using manual input
#' Produce networks using manual input.
#'
#' @rdname generalf
#' @examples
Expand Down
1 change: 1 addition & 0 deletions R/pubmed.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' pubmed
#'
#' make word cloud or correlation network from PubMed
#'
#' @rdname generalf
#' @export
#' @examples \dontrun{pubmed("DDX41")}
Expand Down
5 changes: 4 additions & 1 deletion R/refseq.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#' refseq, alliance, pubmed, manual, bugsigdb
#'
#' Text mining RefSeq description, PubMed, BugSigDB and the other manually curated data
#' @description Text mining RefSeq description, PubMed, BugSigDB and the other manually curated data.
#' @details The main functions of the `biotextgraph` package. The functions accepts
#' a character vector of biological entities and returns the summarized statistics and visualization
#' contained in `biotext` object.
#'
#' @param geneList gene ID list
#' @param queries query ID list
Expand Down
24 changes: 18 additions & 6 deletions R/sc.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#' TextMarkers
#'
#' Take results of Seurat::FindAllMarkers as input,
#' and plot wordcloud or network for all the clusters.
#'
#' @description Take results of `Seurat::FindAllMarkers` as input and plot wordcloud or network for all the clusters.
#' @details Using the results of marker gene identification such as `FindAllMarkers` from Seurat,
#' Recursively summarize the textual information of markers and output the visualizations.
#' @seealso obtainMarkersWC
#' @param df result of FindAllMarkers()
#' @param keyType keytype
#' @param type wc or network
Expand Down Expand Up @@ -96,10 +97,12 @@ TextMarkers <- function(df, keyType="SYMBOL",type="wc", genePlot=TRUE,


#' TextMarkersScran
#' @description Make gene wordcloud from scran::findMarkers() results
#'
#' Take results of scran::findMarkers as input,
#' and plot wordcloud or network for all the clusters.
#' @details using the results of marker gene identification such as `findMarkers` from scran,
#' Recursively summarize the textual information of markers and output the visualizations.
#'
#' @seealso obtainMarkersWCScran
#' @param res result of findMarkers()
#' @param keyType keytype
#' @param type wc or network
Expand Down Expand Up @@ -216,6 +219,11 @@ TextMarkersScran <- function(res,

#' plotReducedDimWithTexts
#'
#' @description Directly output the dimension reduction plot with textual information.
#' @details The function accepts the SingleCellExperiment object and marker gene information
#' and output the reduced dimension plot with the textual information.
#' @rdname plotReducedDimWithTexts
#' @seealso DimPlotWithTexts
#' @param sce sce object
#' @param marker.info results of findMarkers()
#' @param colour_by colorize by this label
Expand Down Expand Up @@ -416,7 +424,11 @@ plotReducedDimWithTexts <- function(sce, marker.info,


#' DimPlotWithTexts
#'
#' @description Directly output the dimension reduction plot with textual information.
#' @details The function accepts the Seurat object and marker gene information
#' and output the reduced dimension plot with the textual information.
#' @seealso plotReducedDimWithTexts
#' @rdname DimPlotWithTexts
#' @param seu Seurat object
#' @param markers results of FindAllMarkers()
#' @param label plot label or not
Expand Down
Loading

0 comments on commit 1020c92

Please sign in to comment.