It would be great if
ldfast() kept SNP names (as row and column names)
ldfast() allowed for a return type of data.frame
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.
It would be great if
ldfast()kept SNP names (as row and column names)ldfast()allowed for a return type ofdata.frameldfast()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:
You can then use a tool like
merge()ordplyr::left_join()to add genomic positions to this data frame.