From f80f60f39e1be1e7009359d85a01992143e8f620 Mon Sep 17 00:00:00 2001 From: Vincent LAVILLE <vincent.laville@pasteur.fr> Date: Mon, 4 Feb 2019 18:50:40 +0100 Subject: [PATCH] Update correlationMatrix.R --- R/correlationMatrix.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/R/correlationMatrix.R b/R/correlationMatrix.R index 0ec255f..c2bea09 100644 --- a/R/correlationMatrix.R +++ b/R/correlationMatrix.R @@ -138,9 +138,11 @@ 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) - to_remove <- which(apply(testMat, 1, sd) == 0) - testMat <- testMat[-to_remove, ] - genoMap <- genoMap[-to_remove, ] + to_remove <- which(apply(testMat, 1, sd) == 0)) + if (length(to_remove) > 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