get_marker_correlation_coefficients_table: Get the marker correlation coefficients (also known as 'r')...

View source: R/get_marker_correlation_coefficients_table.R

get_marker_correlation_coefficients_tableR Documentation

Get the marker correlation coefficients (also known as r) from genetic data in a table

Description

Similar to PLINK, the correlation coefficients are measured for markers on the same chromosome

Usage

get_marker_correlation_coefficients_table(
  data,
  ld_window_r2 = 0.2,
  plink_options = create_plink_options(),
  temp_folder = plinkr::get_plinkr_tempfilename(),
  verbose = FALSE
)

Arguments

data

the data source, which can be:

  • PLINK text data, as created by create_plink_text_data.

  • PLINK binary data, as created by create_plink_bin_data.

  • PLINK2 binary data, as created by create_plink2_bin_data.

  • PLINK text filenames, as created by create_plink_text_filenames.

  • PLINK binary filenames, as created by create_plink_bin_filenames.

  • PLINK2 binary filenames, as created by create_plink2_bin_filenames.

  • data to be used by assoc, as created by create_assoc_data

  • data to be used by assoc_qt, as created by create_assoc_qt_data

ld_window_r2

the minimal squared correlation coefficient (also known as r^2) between markers. This parameter is named after the --ld_window_r2 flag, as documented at https://www.cog-genomics.org/plink/1.9/ld.

plink_options

options to run PLINK, as created by create_plink_options

temp_folder

temporary folder to store results in

verbose

the verbosity of a function. Set to TRUE for more output. Use check_verbose to detect if this argument is valid.

Value

an ld_table, see read_plink_ld_file

Author(s)

Richèl J.C. Bilderbeek

See Also

use get_marker_correlation_coefficients to only get the marker correlation coefficients

Examples

if (is_plink_installed()) {
  # Create example PLINK text data
  assoc_qt_data <- create_demo_assoc_qt_data()
  # PLINK checks for LD on markers on the same chromosome
  assoc_qt_data$data$map_table$CHR <- 1

  # PLINK uses a default value of ld_window_r2 = 0.2,
  # which, in this examples, does not give a result
  get_marker_correlation_coefficients_table(
    assoc_qt_data$data
  )

  # Show all values
  get_marker_correlation_coefficients_table(
    assoc_qt_data$data,
    ld_window_r2 = 0.0
  )

  # PLINK binary data
  assoc_qt_data$data <- convert_plink_text_data_to_plink_bin_data(
    assoc_qt_data$data
  )
  get_marker_correlation_coefficients_table(
    assoc_qt_data$data,
    ld_window_r2 = 0.0
  )
}

richelbilderbeek/plinkr documentation built on March 25, 2024, 3:18 p.m.