From ce27f6ddc15a412e0166c51d81240e6aa59d8f85 Mon Sep 17 00:00:00 2001
From: Vincent  LAVILLE <vincent.laville@pasteur.fr>
Date: Fri, 1 Feb 2019 16:55:41 +0100
Subject: [PATCH] Update correlationMatrix.R

---
 R/correlationMatrix.R | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/R/correlationMatrix.R b/R/correlationMatrix.R
index 7bb78bc..0ec255f 100644
--- a/R/correlationMatrix.R
+++ b/R/correlationMatrix.R
@@ -138,7 +138,9 @@ getGenoCorMatrix <- function(lrsid, lchr, lpos, lrefall, pop, path = NULL, web =
         lind <- lind[lind$Paternal.ID == 0 & lind$Maternal.ID == 0, 2]
         
         testMat <- getAdditivelyCodedMatrix(genoMat,lind)
-        testMat <- testMat[-which(apply(testMat, 1, sd) == 0), ]
+        to_remove <- which(apply(testMat, 1, sd) == 0)
+        testMat <- testMat[-to_remove, ]
+        genoMap <- genoMap[-to_remove, ]
         to_remove <- NULL
         for (i in 1:nrow(testMat)) {
             if (!(rownames(testMat)[i] %in% lrsid)) {
-- 
GitLab