get_grouped_IMON: get IMON with SNP and or all network vertices coloured by...

View source: R/get_grouped_IMON.R

get_grouped_IMONR Documentation

get IMON with SNP and or all network vertices coloured by group variables (either studies or phenotypes)

Description

This function constructs an IMON (Integrated Multi-Omic Network) with SNPs/or whole network coloured by selected categorical levels (either studies or phenotypes)

Usage

get_grouped_IMON(
  dataframe,
  groupby = c("studies", "traits"),
  ego = 5,
  save_file = c(FALSE, TRUE),
  export_type = c("igraph", "edge_list", "graphml", "gml"),
  directory = c("wd", "choose"),
  colour_groups = c(FALSE, TRUE),
  progress_bar = c(TRUE, FALSE)
)

Arguments

dataframe

A dataframe including 3 columns in the following order and with the following names: snps, studies, traits (all character vectors)

groupby

Choose whether to group SNP and or network colouring by either studies or traits

ego

This dictates what length order ego-centred network should be constructed. If set to 5 (default and recommended), an IMON with the first layer of the connected metabolome will be returned. If set above 5, the corresponding extra layer of the metabolome will be returned. If set to 0 (not recommended) the fully connected metabolome will be returned. Note, this cannot be set between 0 and 5.

save_file

Boolean (default = FALSE) argument that indicates whether or not the user wants to save the graph as an exported file in their current working directory

export_type

This dictates the network data structure saved in your working directory. By default this outputs an igraph object, however, you can choose to export and save an edge list, graphml or GML file.

directory

If set to "choose" this argument allows the user to interactively select the directory of their choice in which they wish to save the constructed IMON, else the file will be saved to the working directory "wd" by default

colour_groups

Boolean (default = FALSE) chooses whether or not to colour the whole network by grouping variables

progress_bar

Boolean (default = TRUE) argument that controls whether or not a progress bar for calculations/KEGGREST API GET requests should be printed to the console

Value

An igraph object containing the constructed IMON with coloured SNPs/and or whole network by selected grouping variable

Examples

##getting GWAS Catalog association tsv file and cleaning up using
##GWAS_catalog_tsv_to_dataframe function:
path <- system.file("extdata",
  "gwas-association-downloaded_2021-09-13-EFO_1000649.tsv",
   package="PanViz")
df <- PanViz::GWAS_data_reader(file = path,
  snp_col = "SNPS",
  study_col = "STUDY",
  trait_col = "DISEASE/TRAIT")
##creating uncoloured IMON:
G <- PanViz::get_grouped_IMON(dataframe = df,
  groupby = "studies",
  ego = 5,
  save_file = FALSE,
  colour_groups = FALSE)
##creating IMON where vertices/edges are coloured by the variable study:
G <- PanViz::get_grouped_IMON(dataframe = df,
  groupby = "studies",
  ego = 5,
  save_file = FALSE,
  colour_groups = TRUE)


LucaAnholt/PanViz documentation built on April 17, 2022, 7:28 a.m.