setup_network_data: Convert phenotype dataframe to a data list that works with...

Description Usage Arguments Value Examples

View source: R/helpers_for_main_dashboard.R

Description

Helper functions related to the networks module Takes a subset of the individual data along with phewas results and returns a set of network data in the form of edges and vertices as required by network_plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
setup_network_data(
  data,
  phecode_info,
  inverted_codes = c(),
  case_size = 0.1,
  code_size = 0.3,
  no_copies = "#bdbdbd",
  one_copy = "orangered",
  two_copies = "red"
)

Arguments

data

A phenome dataframe with phecodes as columns and also with an IID column and a snp status column

phecode_info

Information about each codes results in phewas study in form of columns: code, category, color, tooltip.

inverted_codes

An array of codes that are inverted. Note that if a code is inverted that should also be reflected in data. This is only for visual modifications.

case_size

Size of nodes drawn for cases (default of 0.1)

code_size

Size of nodes drawn for phecodes (default of 0.3)

no_copies

Color of cases nodes with no minor allele copy (default grey)

one_copy

Color of cases nodes with one minor allele copy (default orangered)

two_copies

Color of cases nodes with two minor allele copies (default redish)

Value

A list containing two dataframes: vertices a dataframe containing each unique node in network (all unique IIDs and Phecodes) along with columns snp_status, name, color, size, selectable, id, tooltip which are all attributes used by the various network plotting functions included in library edges: a dataframe with columns source and target corresponding to the edges between each vertices according to the assigned interger id.

Examples

1
setup_network_data(data, phewas_results)

tbilab/meToolkit documentation built on June 23, 2020, 9:55 a.m.