{"id":13707701,"url":"https://github.com/frankkramer-lab/mully","last_synced_at":"2025-10-08T11:02:13.552Z","repository":{"id":56934534,"uuid":"99217359","full_name":"frankkramer-lab/mully","owner":"frankkramer-lab","description":"R package to create, modify and visualize graphs with multiple layers.","archived":false,"fork":false,"pushed_at":"2023-02-22T11:25:05.000Z","size":1883,"stargazers_count":45,"open_issues_count":1,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-11T02:18:15.455Z","etag":null,"topics":["big-networks","data-visualization","graph-theory","graphs","igraph","multilayer-networks","node-colored-graphs"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frankkramer-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-08-03T09:48:06.000Z","updated_at":"2024-03-31T14:18:03.000Z","dependencies_parsed_at":"2023-02-11T10:00:35.290Z","dependency_job_id":"99b886e8-feb6-4c16-b785-6dff757fc609","html_url":"https://github.com/frankkramer-lab/mully","commit_stats":{"total_commits":113,"total_committers":3,"mean_commits":"37.666666666666664","dds":0.04424778761061943,"last_synced_commit":"5c14a3ffa789dfa38b554b12f5608546416def0c"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankkramer-lab%2Fmully","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankkramer-lab%2Fmully/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankkramer-lab%2Fmully/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankkramer-lab%2Fmully/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frankkramer-lab","download_url":"https://codeload.github.com/frankkramer-lab/mully/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252271064,"owners_count":21721587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["big-networks","data-visualization","graph-theory","graphs","igraph","multilayer-networks","node-colored-graphs"],"created_at":"2024-08-02T22:01:40.378Z","updated_at":"2025-10-08T11:02:13.547Z","avatar_url":"https://github.com/frankkramer-lab.png","language":"HTML","readme":"# mully\n![alt text](https://github.com/frankkramer-lab/mully/blob/master/R/img/mully.png \"mully\")\n## Introduction\nNetwork theory has been used for many years in the modeling and analysis of complex systems, as epidemiology, biology and biomedicine . As the data evolves and becomes more heterogeneous and complex, monoplex networks become an oversimplification of the corresponding systems. This imposes a need to go beyond traditional networks into a richer framework capable of hosting objects and relations of different scales, called Multilayered Network\n**Mully**, **mul**ti**l**a**y**er networks, is an R package that provides a multilayer network framework.\nUsing this package, the user can create, modify and visualize graphs with multiple layers. This package is an extension to the [igraph package](https://github.com/igraph/rigraph) that provides a monolayer graph framework.\nThe package is implemented as a part of [the Multipath Project](https://www.sys-med.de/en/junior-research-groups/multipath/)  directed by [Dr. Frank Kramer](https://www.uni-augsburg.de/de/fakultaet/fai/informatik/prof/misit/mitarbeiter/) .\n## Publication\nMore information and references can be found in the mully paper:\n\nhttps://www.mdpi.com/2073-4425/9/11/519\n\n## Installation\n\n### Installation from CRAN\n\nmully is now available on CRAN !! \n\n[mully on CRAN](https://CRAN.R-project.org/package=mully)\n\n### Installation via Github\n\n```R\nrequire(devtools)\ninstall_github(\"frankkramer-lab/mully\")\nlibrary(mully)\n```\n## Test the package\nIn this section, we provide a demo to test the package by calling some of the function. After running this script, you will have a graph g with 3 layers and 8 nodes. the graph can also be modified by calling other functions. Please refer to help to see the available functions.\n### Create new mully graph\n```R\n  g \u003c- mully(\"MyFirstMully\",direct = F)\n```\n### Add Layers\n```R\n  g \u003c- addLayer(g, c(\"Gene\", \"Drug\", \"Drug\", \"Disease\"))\n```\n### Add/print Nodes\n```R\n  g=addNode(g,\"d1\",\"disease\",attributes=list(type=\"t1\"))\n  print(\"Node d1 added as disease\")\n  \n  g=addNode(g,\"d2\",\"disease\",attributes=list(type=\"t1\"))\n  print(\"Node d2 added as disease\")\n  \n  g=addNode(g,\"d3\",\"disease\",attributes=list(type=\"t1\"))\n  print(\"Node d3 added as disease\")\n  \n  g=addNode(g,\"dr1\",\"drug\",attributes=list(effect=\"strong\"))\n  print(\"Node dr1 added as drug\")\n  \n  g=addNode(g,\"dr2\",\"drug\",attributes=list(effect=\"strong\"))\n  print(\"Node dr2 added as drug\")\n  \n  g=addNode(g,\"dr3\",\"drug\",attributes=list(effect=\"moderate\"))\n  print(\"Node dr3 added as drug\")\n  \n  g=addNode(g,\"g1\",\"gene\",attributes=list(desc=\"AF\"))\n  print(\"Node g1 added as gene\")\n  \n  g=addNode(g,\"g2\",\"gene\",attributes=list(desc=\"BE\"))\n  print(\"Node g2 added as gene\")\n\n  #See vertices attributes\n  print(getNodeAttributes(g))\n  \n  #The Result:\n  # name n type   effect desc\n  #   1   d1 3   t1     \u003cNA\u003e \u003cNA\u003e\n  #   2   d2 3   t1     \u003cNA\u003e \u003cNA\u003e\n  #   3   d3 3   t1     \u003cNA\u003e \u003cNA\u003e\n  #   4  dr1 2 \u003cNA\u003e   strong \u003cNA\u003e\n  #   5  dr2 2 \u003cNA\u003e   strong \u003cNA\u003e\n  #   6  dr3 2 \u003cNA\u003e moderate \u003cNA\u003e\n  #   7   g1 1 \u003cNA\u003e     \u003cNA\u003e   AF\n  #   8   g2 1 \u003cNA\u003e     \u003cNA\u003e   BE\n\n```\n### Add/print/remove Edges\n```R\n  g=addEdge(g,\"dr1\",\"d2\",list(name=\"treats\"))\n  g=addEdge(g,\"dr1\",\"d2\",list(name=\"extraEdge\"))\n  g=addEdge(g,\"d2\",\"g1\",list(name=\"targets\"))\n  g=addEdge(g,\"g2\",\"dr3\",list(name=\"mutates and causes\"))\n  g=addEdge(g,\"dr3\",\"d3\",list(name=\"treats\"))\n  \n  print(getEdgeAttributes(g)\n  \n  #The Result:\n  #      V1  V2               name\n  #   1  d2 dr1             treats\n  #   2  d2 dr1          extraEdge\n  #   3  d2  g1            targets\n  #   4 dr3  g2 mutates and causes\n  #   5  d3 dr3             treats\n  \n  removeEdge(g,\"d2\",\"dr1\",multi=T)\n  \n```\n### Merge two graphs\n```R\n  #Create a Second graph\n  g1=mully()\n\n  g1=addLayer(g1,c(\"protein\",\"drug\",\"gene\"))\n\n  g1=addNode(g1,\"dr4\",\"drug\",attributes=list(effect=\"strong\"))\n  g1=addNode(g1,\"dr5\",\"drug\",attributes=list(effect=\"strong\"))\n  g1=addNode(g1,\"dr6\",\"drug\",attributes=list(effect=\"moderate\"))\n\n  g1=addNode(g1,\"p1\",\"protein\")\n  g1=addNode(g1,\"p2\",\"protein\")\n  g1=addNode(g1,\"p3\",\"protein\")\n\n  g1=addNode(g1,\"g3\",\"gene\")\n  g1=addNode(g1,\"g4\",\"gene\")\n\n\n  g1=addEdge(g1,nodeStart = \"p2\",nodeDest = \"p3\",attributes = list(name=\"interacts\"))\n  g1=addEdge(g1,nodeStart = \"dr6\",nodeDest = \"g4\",attributes = list(name=\"targets\"))\n\n  #Merge both graphs\n  g12=merge(g,g1)\n\n  #Print the graph\n  print(g12)\n  \n  # Printing this graph gives this result:\n  #   mully --  MyFirstMully\n  # 4 Layers:\n  #     ID    Name NameLower\n  #   1  1    Gene      gene\n  #   2  2    Drug      drug\n  #   3  3 Disease   disease\n  #   4  4 protein   protein\n  # \n  # 16 Nodes:\n  #     name n type   effect desc\n  #   1    d1 3   t1     \u003cNA\u003e \u003cNA\u003e\n  #   2    d2 3   t1     \u003cNA\u003e \u003cNA\u003e\n  #   3    d3 3   t1     \u003cNA\u003e \u003cNA\u003e\n  #   4   dr1 2 \u003cNA\u003e   strong \u003cNA\u003e\n  #   5   dr2 2 \u003cNA\u003e   strong \u003cNA\u003e\n  #   6   dr3 2 \u003cNA\u003e moderate \u003cNA\u003e\n  #   7    g1 1 \u003cNA\u003e     \u003cNA\u003e   AF\n  #   8    g2 1 \u003cNA\u003e     \u003cNA\u003e   BE\n  #   9   dr4 2 \u003cNA\u003e   strong \u003cNA\u003e\n  #   10  dr5 2 \u003cNA\u003e   strong \u003cNA\u003e\n  #   11  dr6 2 \u003cNA\u003e moderate \u003cNA\u003e\n  #   12   p1 4 \u003cNA\u003e     \u003cNA\u003e \u003cNA\u003e\n  #   13   p2 4 \u003cNA\u003e     \u003cNA\u003e \u003cNA\u003e\n  #   14   p3 4 \u003cNA\u003e     \u003cNA\u003e \u003cNA\u003e\n  #   15   g3 1 \u003cNA\u003e     \u003cNA\u003e \u003cNA\u003e\n  #   16   g4 1 \u003cNA\u003e     \u003cNA\u003e \u003cNA\u003e\n  #   \n  # 7 Edges:\n  #      V1  V2               name\n  #   1  d2 dr1             treats\n  #   2  d2 dr1          extraEdge\n  #   3  d2  g1            targets\n  #   4 dr3  g2 mutates and causes\n  #   5  d3 dr3             treats\n  #   6  p2  p3          interacts\n  #   7 dr6  g4            targets\n\n```\n### Visualization\n```R\n  plot(g12,layout = \"scaled\")\n```\n  \u003cspan style=\"display:block;text-align:center\"\u003e![alt text](https://github.com/frankkramer-lab/mully/blob/master/R/img/2DVisualizer_Scaled.png \"2D Visualization Scaled\")\u003c/span\u003e\n\n  ```R\n  plot3d(g12)\n```\n\n  \u003cspan style=\"display:block;text-align:center\"\u003e![alt text](https://github.com/frankkramer-lab/mully/blob/master/R/img/3DVisualizer.png \"3D Visualization\")\u003c/span\u003e\n\n## Available Functions\nmully functions are divided into different files depending on their functionnality range:\n[Constructor](https://github.com/frankkramer-lab/mully/blob/master/R/mully_constructor.R) ,\n[Layers Functions](https://github.com/frankkramer-lab/mully/blob/master/R/mully_layer.R) ,\n[Node Functions](https://github.com/frankkramer-lab/mully/blob/master/R/mully_node.R) ,\n[Edge Functions](https://github.com/frankkramer-lab/mully/blob/master/R/mully_edge.R) ,\n[Merge Function](https://github.com/frankkramer-lab/mully/blob/master/R/mully_merge.R) ,\n[Visualization Functions](https://github.com/frankkramer-lab/mully/blob/master/R/mully_visualization.R) ,\n[Import Functions](https://github.com/frankkramer-lab/mully/blob/master/R/mully_import.R) ,\n[Export Functions](https://github.com/frankkramer-lab/mully/blob/master/R/mully_export.R) ,\n[Demo](https://github.com/frankkramer-lab/mully/blob/master/R/mully_demo.R).\n\n\n| Function |Description|\n| --------------- |-----------|\n|`mully(name,direct)`|Constructor Function, Create an empty multilayered graph|\n|`print(g)`|Print function|\n|`addLayer(g, nameLayer)`| Add a layer or a set of layers to a graph|\n|`removeLayer(g, name,trans)`|Delete a layer or a set of layers from a graph|\n|`isLayer(g, name)`|Verify if the layer exists in a graph|\n|`getLayersCount(g)`|Get the number of layers in a graph|\n|`getLayer(g, nameLayer)`|Get the nodes on a layer in a graph|\n|`getNode(g,nameNode)`|Get a node from a graph|\n|`getIDNode(g,nameNode)`|Get the id of a node|\n|`addNode(g, nodeName, layerName, attributes)`|Add a node with assigned layer and attributes to a graph|\n|`removeNode(g, name,trans)`|Delete a node or a set of nodes from a graph|\n|`getNodeAttributes(g,nameNode)`|Get the attributes of one or all nodes|\n|`addEdge(g, nodeStart, nodeDest, attributes)`|Add an edge|\n|`removeEdge(g, nodeStart, nodeDest,attributes, multi)`|Delete an edge|\n|`getEdgeAttributes(g,nodeStart,nodeDest)`|Get the attributes of the edges connecting two nodes or all the edges in the graph|\n|`getIDEdge(g,nodeStart,nodeDest)`|Get the ids of the edges connecting two nodes|\n|`merge(g1,g2)`|Merge or unite two graphs|\n|`plot(g,layout)`|Plot the graph in 2D|\n|`plot3d(g)`|Plot the graph in 3D using rgl|\n|`importGraphCSV(name,direct,layers,nodes,edges)`|Import a mully graph from csv files|\n|`importLayersCSV(g,file)`|Import layers to a mully graph from a CSV file|\n|`importNodesCSV(g,file)`|Import nodes to a mully graph from a CSV file|\n|`importEdgesCSV(g,file)`|Import edges to a mully graph from a CSV file|\n\n","funding_links":[],"categories":["HTML"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankkramer-lab%2Fmully","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrankkramer-lab%2Fmully","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankkramer-lab%2Fmully/lists"}