R/modulePerProp.R

Defines functions modulePerProp

Documented in modulePerProp

#' Module Per Prop
#' 
#' List the modules organized by property name.  Thus, get a list of all modules that use a given property.
#' 
#' @param moduleInfo the lis returned by BioLockJ::moduleInfo(), or a similar object
#' @param moduleClasses a named character vector with values that match the names of moduleInfo elements and names to be applied to them
#'
#' @return a list of properties, each element is a vector of module names giving the modules that use that property
#'
modulePerProp <- function(moduleInfo=BioLockR::moduleInfo(), moduleClasses=NULL){
    if ( !BioLockR::hasReadableValue(moduleInfo) ) return( list() )
    if( is.null(moduleClasses)){
        moduleClasses = names(moduleInfo)
        names(moduleClasses) = moduleClasses
    }else if ( !BioLockR::hasReadableValue(moduleClasses) ) return( list() )
    useModuleInfo = moduleInfo[moduleClasses]
    names(useModuleInfo) = names(moduleClasses)
    a = lapply(useModuleInfo, function(mi){names(mi$properties)})
    d1=utils::stack(a)
    return(split(as.character(d1$ind), d1$values))
}
IvoryC/shinyBioLockJ documentation built on May 29, 2021, 7:40 a.m.