Skip to content

Output Options for ldfast() #7

Description

@dcgerard

It would be great if

  1. ldfast() kept SNP names (as row and column names)
  2. ldfast() allowed for a return type of data.frame
  3. ldfast() had an option to keep SNP locations.

Thanks to Heather Tuttle for the suggestion.

As a workaround until I make this a feature, you can use:

library(updog)
library(ldsep)
library(reshape2)

## Get data and fit ldfast ----
data("uit", package = "ldsep")
gp <- format_multidog(x = uit, varname = paste0("Pr_", 0:4))
ldout <- ldfast(gp = gp, type = "r2")

## Format to data frame ----
colnames(ldout$ldmat) <- rownames(ldout$ldmat) <- dimnames(gp)$snp
ldout$ldmat[lower.tri(ldout$ldmat, diag = TRUE)] <- NA
lddf <- melt(ldout$ldmat, na.rm = TRUE)
lddf

You can then use a tool like merge() or dplyr::left_join() to add genomic positions to this data frame.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions