Skip to content

Commit

Permalink
use camelcaps
Browse files Browse the repository at this point in the history
  • Loading branch information
tnaake committed Jun 13, 2018
1 parent 285a156 commit 9c879bf
Show file tree
Hide file tree
Showing 31 changed files with 799 additions and 787 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: MetNet
Type: Package
Title: Inferring metabolic networks from untargeted high-resolution mass spectrometry data
Version: 0.99.6
Version: 0.99.7
Date: 2018-06-12
Authors@R: c(person(given = "Thomas", family = "Naake",
email = "thomasnaake@googlemail.com",
Expand All @@ -16,7 +16,7 @@ Imports:
bnlearn (>= 4.3),
methods (>= 3.5),
mpmi (>= 0.42),
parallel (>= 3.4),
parallel (>= 3.5),
parmigene (>= 1.0.2),
ppcor (>= 1.1),
psych (>= 1.7.8),
Expand Down
16 changes: 8 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Generated by roxygen2: do not edit by hand

export(add_to_list)
export(addToList)
export(aracne)
export(bayes)
export(clr)
export(combine_structural_statistical)
export(consensus_network)
export(combineStructuralStatistical)
export(consensusAdjacency)
export(correlation)
export(create_statistical_network)
export(create_statistical_networks_list)
export(create_structural_network)
export(in_range_which)
export(createStatisticalAdjacency)
export(createStatisticalAdjacencyList)
export(createStructuralAdjacency)
export(inRangeWhich)
export(lasso)
export(randomForest)
export(threeDots_call)
export(threeDotsCall)
importFrom(bnlearn,arcs)
importFrom(bnlearn,fast.iamb)
importFrom(methods,formalArgs)
Expand Down
59 changes: 29 additions & 30 deletions R/combine.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
#' @name combine_structural_statistical
#' @aliases combine_structural_statistical
#' @title Combine structural and statistical network
#' @description The function \code{combine\_structural\_statistical} takes as
#' input the structural and statistical network, that were create in former
#' @name combineStructuralStatistical
#' @aliases combineStructuralStatistical
#' @title Combine structural and statistical adjacency matrix
#' @description The function \code{combineStructuralStatistical} takes as
#' input the structural and statistical adjacency matrix, created in former
#' steps, adds them together and will report a connection between metabolites
#' when the edge is reported in networks.
#' \code{combine\_structural\_statistical} returns this consensus matrix of
#' the structural and statistical network.
#' @usage combine_structural_statistical(structure, statistical, threshold = 1)
#' @param structure matrix containing structural network
#' @param statistical matrix containing statistical network
#' in the returned when the sum exceeds the \code{threshold} .
#' \code{combineStructuralStatistical} returns this consensus matrix supported
#' by the structural and statistical adjacency matrices.
#' @usage combineStructuralStatistical(structure, statistical, threshold=1)
#' @param structure matrix containing structural adjacency matrix
#' @param statistical matrix containing statistical adjacency matrix
#' @param threshold numeric, threshold value to be applied to define a
#' connection as present
#' @details \code{combine\_structural\_statistical} will call internally the
#' function \code{consensus\_network} to create the consensus network of the
#' statistical networks.
#' @return a matrix containing the consensus network as described above
#' harbouring connections reported by the structual network and statistcal
#' networks.
#' @details The matrices will be added and a unweighted connection will
#' be reported when the value exceeds a certain value.
#' @return a matrix containing the consensus adjacency matrix as described
#' above harbouring connections reported by the structual and
#' statistcal adjacency matrices.
#' @author Thomas Naake, \email{thomasnaake@@googlemail.com}
#' @examples
#' data("x_test", package = "MetNet")
#' data("x_test", package="MetNet")
#' x_test <- as.matrix(x_test)
#' functional_groups <- rbind(
#' c("Hydroxylation (-H)", "O", "15.9949146221"),
Expand All @@ -31,17 +30,17 @@
#' c("Glucuronic acid (-H2O)", "C6H8O6", "176.0320879894"),
#' c("Monosaccharide (-H2O)", "C6H10O5", "162.0528234315"),
#' c("Trisaccharide (-H2O)", "C18H30O15", "486.1584702945"))
#' functional_groups <- data.frame(group = functional_groups[,1],
#' formula = functional_groups[,2],
#' mass = as.numeric(functional_groups[,3]))
#' struct_net <- create_structural_network(x_test, functional_groups, ppm = 5)
#' stat_net <- create_statistical_network(x_test,
#' model = c("pearson", "spearman","bayes"),
#' correlation_adjust = "bonferroni")
#' combine_structural_statistical(struct_net[[1]], stat_net)
#' functional_groups <- data.frame(group=functional_groups[,1],
#' formula=functional_groups[,2],
#' mass=as.numeric(functional_groups[,3]))
#' struct_adj <- createStructuralAdjacency(x_test, functional_groups, ppm=5)
#' stat_adj <- createStatisticalAdjacency(x_test,
#' model=c("pearson", "spearman","bayes"),
#' correlation_adjust="bonferroni")
#' combineStructuralStatistical(struct_adj[[1]], stat_adj)
#' @export
combine_structural_statistical <- function(structure, statistical,
threshold = 1) {
combineStructuralStatistical <- function(structure, statistical,
threshold=1) {

if (!is.matrix(structure) & !is.numeric(structure))
stop("structure is not a numeric matrix")
Expand All @@ -52,8 +51,8 @@ combine_structural_statistical <- function(structure, statistical,
if (!all(colnames(structure) == colnames(statistical)))
stop("colnames are not identical")
if (!is.numeric(threshold)) stop("threshold is not numeric")
##l <- list(structure, statistical)
##consensus_mat <- consensus_network(statistical, ...)

## sum the matrices
consensus_mat <- structure + statistical
consensus_mat <- ifelse(consensus_mat > threshold, 1, 0)
return(consensus_mat)
Expand Down
Loading

0 comments on commit 9c879bf

Please sign in to comment.