The goal of modCluster is to visualize relationships beetwen modules in graphs.
For graphs with biological significance it is common for there to be “modules” associated with verticies. Some examples include sub-cellular location, co-expression module or GO-term. Modcluster stands for “cluster by module”, and groups modules together if they have an increased edge density together. With this package biologists will be able to get an idea which modules share highly significant communication through edges.
To download the package
#require("devtools")
#devtools::install_github("raywoo32/modCluster", dependencies=TRUE, vignettes = TRUE)
#library("modCluster")
To run the shinyApp:
#modCluster::modClusterShiny()
To view vignette please use the following command
#browseVignettes("modCluster")
modCluster will:
This initial pitch image will also provide more context for the package.
While there are many different ways to cluster modules extant in biological literature they do not have the same function as modCluster. While igraph already has a function to cluster_edge_betweenness(), it does not take into account some users may want to treat verticies as a unit. ModCluster allows the user to maintain module unity which represent important biological connections. While modCluster by no means replaces functions like cluster_edge_betweenness(), it allows the user to explore which modules have the most communication between them.
Below the functions in modCluster are listed and contributions from other packages are acknowledged. In all functions an igraph object is used to represent the graph, this is not indicated below since it would be redundant but other uses of igraph indicated.
clusterByModule() : This is a controller function. It calls other functions (from modCluster) to verify the format, group by module and visualize. It is hard to say how original it is by itself because it functions as a controller for the user.
checkValidInput() : This is the function that verifies the format, catches errors (original code) and makes the edges and verticies into an igraph object. Obviously igraph is used for this.
makeModuleGraphs() : Make module graphs uses an igraph function to create subgraphs for each module grouping. These subgraphs are placed into a dataframe along with the edge density. This is original although it uses an igraph function to make subgraphs because the subgraphs are not automated for modules. This code just allows for easy calculations downstream in future code.
edge_density() : Is called by makeModuleGraphs. Although adapted from igraph, this code is original because it implements a feature to calculate edge density based upon weight and not just presence absence as in igraph.
getAllPossibleGroups(): This is a unique function create all possible group combinations to later check if the grouping has a higher intra-edge density than the group alone. It also calculates the combined edge density of every group.
makeSortedCompare() : This function that combines the possible grouped modules with the original modules and sorts them in order of highest edge density. It is unique
chooseBestGroups() : This is a unique function that takes the sorted modules and chooses groupings.
getChosenMods() : Gets a df with module name, subgraph and density for the chosen optimal groupings. This function is unique and supported by the previous helper functions.
makeLayout() : makeLayout is unique in that it takes a unique data format from the previous workflow. However, it uses work previously done by igraph to choose the optimal layout for the modules and combine them. It is not totally unique as it is part of the visualization step.
makeCommunities() : make communities is reliant on igraph (it is a visualization step) it takes the previous optimally calculated groupings puts it into an igraph format for quick visualization and to use exisiting functionality.
visualizeCommunities() : uses the igraph communities function to create the plot. Again, it is somewhat unique in that it adapts my clustering in a manner that can use igraph visualizations.
visualizeGraphs() : similar to visualize communities this function also adapts my clustering in a manner that can use igraph visualization. The user can choose between the two functions by the flag in clusterByModule.
More information about the functions can also be found in the vignettes.
Please note references are also imbedded in code.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.