This is a test version of Biostars. For the public version, visit https://www.biostars.org.
LDheatmap will not accept LD matrix from Plink

I get error message "column 1 is not a genotype object" in LDheatmap in R when I load an LD matrix generated in Plink. Obviously, I am well aware that column 1 is not a genotype object, however I don't understand how I communicate this to R. The manual has some examples with genotype data, and frequently states that "For gdat, any square matrix with values between 0 and 1 inclusive can be passed, and the value above the diagonal will be plotted". however no examples include an LD matrix and none of the commands work.

Here, are the first columns and rows in the matrix:

1            0.001685     0.135168     0        0.003753
0.001685     1            0.170858     0        0.024787
0.135168     0.170858     1            0        0.079526
0            0            0            0        0
0.003753     0.024787     0.079526     0        1

Any help and advice is appreciated,

Cheers
Ingerid

genome snp r

Is this imputed data?

no, the data is not imputed. Where there are 0, there were originally 'nan'

I see, this is actual LD output values ranging 0-1. The LDHeatmap works with genotype data, e.g.:

rs4615512     rs2283089     rs1894731
T/C           C/C           A/A
T/C           C/T           A/A
T/C           C/C           A/A

Yes, but then why does the manual state that "The input data set can be a data frame containing SNP genotypes, a matrix of pairwise LD measurements, or an LDheatmap object returned by the function LDheatmap()". I have a matrix of pairwise LD measurements but clearly LDheatmap does not like it.

Yes, you are right, just tried a dummy matrix and it works, something must be wrong with your input matrix. Try this example:

LDheatmap(matrix(runif(100,0,1),nrow = 10))

Also, add your code that gives an error.

1 answer

Hi there,

I just ran into the same problem. When you load into R you have to specify

LD <-as.matrix(read.table(myLDdata.matrix))
LDheatmap(LD)

Hopefully this works!

Log in to answer this question.