Skip to content
Snippets Groups Projects
Commit 89f00738 authored by Vincent  LAVILLE's avatar Vincent LAVILLE
Browse files

Update correlationMatrix.R - Handling NAs

parent cf510282
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,18 @@ getGenoCorMatrix <- function(lrsid, lchr, lpos, lrefall, pop, path = NULL, web = ...@@ -147,6 +147,18 @@ getGenoCorMatrix <- function(lrsid, lchr, lpos, lrefall, pop, path = NULL, web =
testMat <- testMat[-to_remove, ] testMat <- testMat[-to_remove, ]
genoMap <- genoMap[-to_remove,] genoMap <- genoMap[-to_remove,]
} }
to_remove <- NULL
for (i in 1:length(lrsid)) {
if (!(lrsid[i] %in% rownames(testMat))) {
to_remove <- c(to_remove, i)
}
}
if (!is.null(to_remove)) {
lrsid <- lrsid[-to_remove]
lpos <- lpos[-to_remove]
lchr <- lchr[-to_remove]
lrefall <- lrefall[-to_remove]
}
testMat <- changeCoding(testMat, as.character(lrefall) == genoMap$REF) testMat <- changeCoding(testMat, as.character(lrefall) == genoMap$REF)
colnames(testMat) <- lind colnames(testMat) <- lind
cormat = stats::cor(t(testMat)) cormat = stats::cor(t(testMat))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment