From 4219e6c4ca90cb388a119de6b38c5bba77183f98 Mon Sep 17 00:00:00 2001 From: Danielle Callan Date: Thu, 22 Feb 2024 11:43:23 -0500 Subject: [PATCH] update documentation --- NAMESPACE | 12 +++++++--- R/methods-Network.R | 8 +++---- man/KPartiteNetwork-class.Rd | 12 +++++++++- man/Link-class.Rd | 1 - man/Link.Rd | 22 ++++++++++++++++++ man/LinkList-class.Rd | 1 - man/LinkList.Rd | 23 ++++++++++++++++++ man/Network-class.Rd | 8 +++---- man/Node-class.Rd | 3 ++- man/Node.Rd | 32 ++++++++++++++++++++++++++ man/NodeId.Rd | 15 ------------ man/NodeIdList.Rd | 8 ++++--- man/NodeList-class.Rd | 1 - man/Partition-class.Rd | 4 ++-- man/Partitions-class.Rd | 2 +- man/Partitions.Rd | 2 +- man/getPartitionIndex.Rd | 17 ++++++++++++++ man/toJSON-KPartiteNetwork-method.Rd | 16 +++++++++++++ man/toJSON-Partitions-method.Rd | 16 +++++++++++++ man/writeJSON.Rd | 22 ++---------------- man/writeNetworkJSON-Network-method.Rd | 22 ++++++++++++++++++ man/writeNetworkJSON.Rd | 20 ++++++++++++++++ 22 files changed, 209 insertions(+), 58 deletions(-) create mode 100644 man/Link.Rd create mode 100644 man/LinkList.Rd create mode 100644 man/Node.Rd delete mode 100644 man/NodeId.Rd create mode 100644 man/getPartitionIndex.Rd create mode 100644 man/toJSON-KPartiteNetwork-method.Rd create mode 100644 man/toJSON-Partitions-method.Rd create mode 100644 man/writeNetworkJSON-Network-method.Rd create mode 100644 man/writeNetworkJSON.Rd diff --git a/NAMESPACE b/NAMESPACE index e9bab982..03e79f22 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,11 +16,9 @@ export(KPartiteNetwork) export(Link) export(LinkList) export(Network) -export(Node) export(NodeId) export(NodeIdList) export(NodeList) -export(Partition) export(Partitions) export(TwoByTwoTable) export(adjustToViewport) @@ -45,6 +43,7 @@ export(findViewport) export(fishersTest) export(getDuplicateLinks) export(getIsolatedNodes) +export(getPartitionIndex) export(getQuadrantValues) export(heatmap) export(heatmap.dt) @@ -76,8 +75,8 @@ export(sensitivity) export(smoothedMean) export(specificity) export(writeJSON) +export(writeNetworkJSON) exportClasses(ContingencyTable) -exportClasses(KPartiteNetwork) exportClasses(Link) exportClasses(LinkList) exportClasses(Network) @@ -87,6 +86,12 @@ exportClasses(NodeIdList) exportClasses(NodeList) exportClasses(Partitions) exportClasses(TwoByTwoTable) +exportMethods(KPartiteNetwork) +exportMethods(Link) +exportMethods(LinkList) +exportMethods(Network) +exportMethods(NodeIdList) +exportMethods(NodeList) exportMethods(allStats) exportMethods(chiSqResults) exportMethods(fishersTest) @@ -106,6 +111,7 @@ exportMethods(relativeRisk) exportMethods(sensitivity) exportMethods(specificity) exportMethods(toJSON) +exportMethods(writeNetworkJSON) import(data.table) import(veupathUtils) importFrom(S4Vectors,SimpleList) diff --git a/R/methods-Network.R b/R/methods-Network.R index 93051867..ad06098e 100644 --- a/R/methods-Network.R +++ b/R/methods-Network.R @@ -193,7 +193,7 @@ setMethod(toJSONGeneric, "Network", function(object, named = c(TRUE, FALSE)) { return(tmp) }) -#' Write json to tmp file +#' Write network json to tmp file #' #' This function returns the name of a json file which it has #' written an object out to. @@ -201,9 +201,9 @@ setMethod(toJSONGeneric, "Network", function(object, named = c(TRUE, FALSE)) { #' @param verbose boolean that declares if logging is desired #' @return character name of a tmp file w ext *.json #' @export -setGeneric("writeJSON", function(x, pattern = NULL, verbose = c(TRUE, FALSE)) standardGeneric("writeJSON")) +setGeneric("writeNetworkJSON", function(x, pattern = NULL, verbose = c(TRUE, FALSE)) standardGeneric("writeNetworkJSON")) -#' Write json to local tmp file +#' Write network json to local tmp file #' #' This function returns the name of a json file which it has #' written a Network object out to. @@ -213,7 +213,7 @@ setGeneric("writeJSON", function(x, pattern = NULL, verbose = c(TRUE, FALSE)) st #' @return character name of a tmp file w ext *.json #' @importFrom jsonlite toJSON #' @export -setMethod("writeJSON", "Network", function(x, pattern=NULL, verbose = c(TRUE, FALSE)) { +setMethod("writeNetworkJSON", "Network", function(x, pattern=NULL, verbose = c(TRUE, FALSE)) { net <- x verbose <- veupathUtils::matchArg(verbose) diff --git a/man/KPartiteNetwork-class.Rd b/man/KPartiteNetwork-class.Rd index c998bddc..021a0051 100644 --- a/man/KPartiteNetwork-class.Rd +++ b/man/KPartiteNetwork-class.Rd @@ -1,10 +1,20 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/class-KPartiteNetwork.R -\docType{class} \name{KPartiteNetwork-class} \alias{KPartiteNetwork-class} \alias{KPartiteNetwork} \title{k-Partite Network} +\usage{ +KPartiteNetwork( + object, + links, + nodes, + partitions = Partitions(), + linkColorScheme = "none", + variables = VariableMetadataList(), + ... +) +} \description{ The k-partite network class represents data in the form of a network with k distinct groups of nodes in which nodes connect only with nodes from the other groups. In other words, there are only inter-group diff --git a/man/Link-class.Rd b/man/Link-class.Rd index 78c8efa9..d1b742ed 100644 --- a/man/Link-class.Rd +++ b/man/Link-class.Rd @@ -3,7 +3,6 @@ \docType{class} \name{Link-class} \alias{Link-class} -\alias{Link} \title{Link} \description{ Represent one singular link. A link has a source, and a target. It may be directed or undirected. diff --git a/man/Link.Rd b/man/Link.Rd new file mode 100644 index 00000000..9342f273 --- /dev/null +++ b/man/Link.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class-Link.R +\name{Link} +\alias{Link} +\title{Link constructor} +\usage{ +Link(source, target, weight = 1, color = NULL, isDirected = FALSE) +} +\arguments{ +\item{source}{The source node identifier} + +\item{target}{The target node identifier} + +\item{weight}{The weight of the link} + +\item{color}{The color of the link} + +\item{isDirected}{Whether the link is directed} +} +\description{ +Link constructor +} diff --git a/man/LinkList-class.Rd b/man/LinkList-class.Rd index e5b8502d..efca0454 100644 --- a/man/LinkList-class.Rd +++ b/man/LinkList-class.Rd @@ -3,7 +3,6 @@ \docType{class} \name{LinkList-class} \alias{LinkList-class} -\alias{LinkList} \title{Link List} \description{ A class for representing links in a network diff --git a/man/LinkList.Rd b/man/LinkList.Rd new file mode 100644 index 00000000..ca7762ef --- /dev/null +++ b/man/LinkList.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class-Link.R +\name{LinkList} +\alias{LinkList} +\title{Generate a LinkList} +\usage{ +LinkList(object, linkColorScheme = c("none", "posneg")) +} +\arguments{ +\item{object}{Object containing data to be converted to a LinkList. Could be a SimpleList of Links or a data.frame +with columns source, target, and optionally weight and color.} + +\item{linkColorScheme}{Either 'none' or 'posneg'. If 'posneg', the link color will be based on the sign of the weight.} +} +\value{ +LinkList +} +\description{ +Generate a LinkList from an edgeList +} +\examples{ +LinkList(data.frame(source='a',target='b')) +} diff --git a/man/Network-class.Rd b/man/Network-class.Rd index ab773093..da6de68e 100644 --- a/man/Network-class.Rd +++ b/man/Network-class.Rd @@ -3,7 +3,6 @@ \docType{class} \name{Network-class} \alias{Network-class} -\alias{Network} \title{Network} \description{ A class for representing networks. A network is composed of nodes and links (edges, connections, etc.). A link is represented @@ -17,9 +16,10 @@ in case some nodes have no links. A network can also have properties such as dir \item{\code{nodes}}{NodeList object defining the nodes in the network. Some nodes may not have any links.} -\item{\code{linkColorScheme}}{string defining the type of coloring scheme the links follow. Options are 'none' (default) and 'posneg'.} - -\item{\code{variableMapping}}{veupathUtils::VariableMetadataList object defining the variable mappings in the network. +\item{\code{linkColorScheme}}{string defining the type of coloring scheme the links follow. Options are 'none' (default) and 'posneg'. +In the case of 'posneg', the links color slot will be set to 1 if the link is positive, and -1 if the link is negative. Use a method assignLinkColors() to assign colors to links and set this slot's value.} + +\item{\code{variableMapping}}{veupathUtils::VariableMetadataList object defining the variable mappings in the network.} }} diff --git a/man/Node-class.Rd b/man/Node-class.Rd index f62ec593..6a7727f1 100644 --- a/man/Node-class.Rd +++ b/man/Node-class.Rd @@ -3,7 +3,6 @@ \docType{class} \name{Node-class} \alias{Node-class} -\alias{Node} \title{Node} \description{ A class for representing nodes in a network @@ -20,5 +19,7 @@ A class for representing nodes in a network \item{\code{color}}{string or numeric that determines the color of the node. Optional.} \item{\code{weight}}{numeric value associated with the node, such as timestamp or other node-associated data. Optional.} + +\item{\code{degree}}{numeric value indicating the degree of the node} }} diff --git a/man/Node.Rd b/man/Node.Rd new file mode 100644 index 00000000..6a7fbc0d --- /dev/null +++ b/man/Node.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/constructors-Node.R +\name{Node} +\alias{Node} +\title{Create a Node} +\usage{ +Node( + id, + x = numeric(), + y = numeric(), + color = NULL, + weight = NULL, + degree = NULL +) +} +\arguments{ +\item{id}{string, NodeId or numeric: a unique identifier for the node} + +\item{x}{numeric value indicating the x coordinate of the node. Optional.} + +\item{y}{numeric value indicating the y coordinate of the node. Optional.} + +\item{color}{string or numeric that determines the color of the node. Optional.} + +\item{weight}{numeric value associated with the node, such as timestamp or other node-associated data. Optional.} + +\item{degree}{numeric value indicating the degree of the node. This only makes sense in the context of a network, +and should not be provided in other contexts like when working w an individual node.} +} +\description{ +Create a Node given a unique identifier as either string, NodeId or numeric. +} diff --git a/man/NodeId.Rd b/man/NodeId.Rd deleted file mode 100644 index f8d1b16e..00000000 --- a/man/NodeId.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class-Node.R -\name{NodeId} -\alias{NodeId} -\title{Create a Node Id} -\usage{ -NodeId(value) -} -\arguments{ -\item{value}{string a unique identifier for the node} -} -\description{ -Because typing `NodeId(id = 'foo')` is annoying, this function is provided -to make things easier. Now you can do `NodeId('foo')` -} diff --git a/man/NodeIdList.Rd b/man/NodeIdList.Rd index 6ddb4a35..aa51c894 100644 --- a/man/NodeIdList.Rd +++ b/man/NodeIdList.Rd @@ -1,13 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class-Node.R +% Please edit documentation in R/constructors-Node.R \name{NodeIdList} \alias{NodeIdList} \title{Create a NodeIdList} \usage{ -NodeIdList(nodeIds) +NodeIdList(object, uniquifyIds = c(TRUE, FALSE)) } \arguments{ -\item{nodeIds}{list of node ids} +\item{object}{Object containing list of node ids} + +\item{uniquifyIds}{Logical indicating whether to uniquify the node ids} } \description{ Create a NodeIdList diff --git a/man/NodeList-class.Rd b/man/NodeList-class.Rd index e02ead8e..76f945c9 100644 --- a/man/NodeList-class.Rd +++ b/man/NodeList-class.Rd @@ -3,7 +3,6 @@ \docType{class} \name{NodeList-class} \alias{NodeList-class} -\alias{NodeList} \title{NodeList} \description{ A class for representing a list of nodes. diff --git a/man/Partition-class.Rd b/man/Partition-class.Rd index 9ad0e46c..22fc7ad6 100644 --- a/man/Partition-class.Rd +++ b/man/Partition-class.Rd @@ -1,11 +1,11 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class-KPartiteNetwork.R +% Please edit documentation in R/class-Partitions.R \name{Partition-class} \alias{Partition-class} \alias{Partition} \title{Create a Partition} \usage{ -Partition(nodeIds) +NodeIdList(object, uniquifyIds = c(TRUE, FALSE)) } \description{ An alias to NodeIdList diff --git a/man/Partitions-class.Rd b/man/Partitions-class.Rd index 3745ab72..253448c7 100644 --- a/man/Partitions-class.Rd +++ b/man/Partitions-class.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class-KPartiteNetwork.R +% Please edit documentation in R/class-Partitions.R \docType{class} \name{Partitions-class} \alias{Partitions-class} diff --git a/man/Partitions.Rd b/man/Partitions.Rd index 1d49f22c..542eb3e6 100644 --- a/man/Partitions.Rd +++ b/man/Partitions.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class-KPartiteNetwork.R +% Please edit documentation in R/class-Partitions.R \name{Partitions} \alias{Partitions} \title{Create Partitions} diff --git a/man/getPartitionIndex.Rd b/man/getPartitionIndex.Rd new file mode 100644 index 00000000..d4c2200b --- /dev/null +++ b/man/getPartitionIndex.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class-Partitions.R +\name{getPartitionIndex} +\alias{getPartitionIndex} +\title{Get Partition index of a Node} +\usage{ +getPartitionIndex(partitions, node) +} +\arguments{ +\item{partitions}{Partitions} + +\item{node}{character, NodeId or Node object} +} +\description{ +Given a list of partitions and a node id, return the index +of the partition that the node belongs to. +} diff --git a/man/toJSON-KPartiteNetwork-method.Rd b/man/toJSON-KPartiteNetwork-method.Rd new file mode 100644 index 00000000..8eebafcd --- /dev/null +++ b/man/toJSON-KPartiteNetwork-method.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods-KPartiteNetwork.R +\name{toJSON,KPartiteNetwork-method} +\alias{toJSON,KPartiteNetwork-method} +\title{Convert KPartiteNetwork object to JSON} +\usage{ +\S4method{toJSON}{KPartiteNetwork}(object, named = c(TRUE, FALSE)) +} +\arguments{ +\item{object}{A KPartiteNetwork object} + +\item{named}{boolean that declares if names should be included} +} +\description{ +Converts a KPartiteNetwork object to JSON +} diff --git a/man/toJSON-Partitions-method.Rd b/man/toJSON-Partitions-method.Rd new file mode 100644 index 00000000..693c5e0c --- /dev/null +++ b/man/toJSON-Partitions-method.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods-KPartiteNetwork.R +\name{toJSON,Partitions-method} +\alias{toJSON,Partitions-method} +\title{Convert Partitions object to JSON} +\usage{ +\S4method{toJSON}{Partitions}(object, named = c(TRUE, FALSE)) +} +\arguments{ +\item{object}{A Partitions object} + +\item{named}{boolean that declares if names should be included} +} +\description{ +Converts a Partitions object to JSON +} diff --git a/man/writeJSON.Rd b/man/writeJSON.Rd index 539bffa6..87b63f8c 100644 --- a/man/writeJSON.Rd +++ b/man/writeJSON.Rd @@ -1,38 +1,20 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/methods-Network.R, R/utils-json.R +% Please edit documentation in R/utils-json.R \name{writeJSON} \alias{writeJSON} -\title{Write json to tmp file} +\title{Write json to local tmp file} \usage{ -writeJSON(.pd, evilMode, pattern = NULL, verbose = c(TRUE, FALSE)) - -writeJSON(.pd, evilMode, pattern = NULL, verbose = c(TRUE, FALSE)) - writeJSON(.pd, evilMode, pattern = NULL, verbose = c(TRUE, FALSE)) } \arguments{ \item{.pd}{a data.table to convert to json and write to a tmp file} \item{pattern}{optional tmp file prefix} - -\item{verbose}{boolean that declares if logging is desired} - -\item{x}{a data.table to convert to json and write to a tmp file} } \value{ -character name of a tmp file w ext *.json - -character name of a tmp file w ext *.json - character name of a tmp file w ext *.json } \description{ -This function returns the name of a json file which it has -written an object out to. - -This function returns the name of a json file which it has -written a Network object out to. - This function returns the name of a json file which it has written a data.table object out to. } diff --git a/man/writeNetworkJSON-Network-method.Rd b/man/writeNetworkJSON-Network-method.Rd new file mode 100644 index 00000000..18724370 --- /dev/null +++ b/man/writeNetworkJSON-Network-method.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods-Network.R +\name{writeNetworkJSON,Network-method} +\alias{writeNetworkJSON,Network-method} +\title{Write network json to local tmp file} +\usage{ +\S4method{writeNetworkJSON}{Network}(x, pattern = NULL, verbose = c(TRUE, FALSE)) +} +\arguments{ +\item{x}{a data.table to convert to json and write to a tmp file} + +\item{pattern}{optional tmp file prefix} + +\item{verbose}{boolean that declares if logging is desired} +} +\value{ +character name of a tmp file w ext *.json +} +\description{ +This function returns the name of a json file which it has +written a Network object out to. +} diff --git a/man/writeNetworkJSON.Rd b/man/writeNetworkJSON.Rd new file mode 100644 index 00000000..1f321277 --- /dev/null +++ b/man/writeNetworkJSON.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods-Network.R +\name{writeNetworkJSON} +\alias{writeNetworkJSON} +\title{Write network json to tmp file} +\usage{ +writeNetworkJSON(x, pattern = NULL, verbose = c(TRUE, FALSE)) +} +\arguments{ +\item{x}{an object to convert to json and write to a tmp file} + +\item{verbose}{boolean that declares if logging is desired} +} +\value{ +character name of a tmp file w ext *.json +} +\description{ +This function returns the name of a json file which it has +written an object out to. +}