From f66823d0635655d53316505f7cb0e8d383befd90 Mon Sep 17 00:00:00 2001 From: Fabio Morgante Date: Thu, 10 Oct 2024 12:07:08 -0400 Subject: [PATCH 1/3] Fix bug when kernel has only one positive eigenvalues --- R/BGLR.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/BGLR.R b/R/BGLR.R index dbded8e..1a9c4a5 100644 --- a/R/BGLR.R +++ b/R/BGLR.R @@ -548,7 +548,7 @@ setLT.RKHS=function(LT,y,n,j,weights,saveAt,R2,nLT,rmExistingFiles,verbose) tmp= LT$d > LT$tolD LT$levelsU = sum(tmp) LT$d = LT$d[tmp] - LT$V = LT$V[, tmp] + LT$V = LT$V[, tmp, drop=FALSE] #Default degrees of freedom and scale parameter associated with the variance component for marker effect if (is.null(LT$df0)) From 93d80a4a6127799ab5dfb783c587ec29786f9805 Mon Sep 17 00:00:00 2001 From: fmorgante Date: Wed, 5 Mar 2025 12:08:48 -0500 Subject: [PATCH 2/3] Compute covariance matrix with flashier --- DESCRIPTION | 2 +- R/Multitrait.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c8fb832..768e1e9 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: BGLR -Version: 1.1.3 +Version: 1.1.4 Title: Bayesian Generalized Linear Regression Authors@R: c(person(given = "Gustavo", family = "de los Campos", diff --git a/R/Multitrait.R b/R/Multitrait.R index 85e4aad..d8dabf5 100644 --- a/R/Multitrait.R +++ b/R/Multitrait.R @@ -1284,8 +1284,8 @@ Multitrait<-function(y, n<-nrow(y) - #Compute sample variance covariance matrix - Sy<-cov(y,use="pairwise.complete.obs") + #Compute sample variance covariance matrix using flashier + Sy <- mr.mash.alpha:::compute_cov_flash(y) Sy[is.na(Sy)]=0 #Deep copy of y, DO NOT REPLACE with y.back<-y, it does not work, both objects From 414321469a0f526d40642bb3f3e38d75ff0befd5 Mon Sep 17 00:00:00 2001 From: fmorgante Date: Wed, 5 Mar 2025 12:22:46 -0500 Subject: [PATCH 3/3] Handle rows with all missing values --- R/Multitrait.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/Multitrait.R b/R/Multitrait.R index d8dabf5..3de89fb 100644 --- a/R/Multitrait.R +++ b/R/Multitrait.R @@ -1284,8 +1284,8 @@ Multitrait<-function(y, n<-nrow(y) - #Compute sample variance covariance matrix using flashier - Sy <- mr.mash.alpha:::compute_cov_flash(y) + #Compute sample variance covariance matrix using flashier (removing rows that have all NAs) + Sy <- mr.mash.alpha:::compute_cov_flash(y[rowSums(is.na(y)) != ncol(y), ]) Sy[is.na(Sy)]=0 #Deep copy of y, DO NOT REPLACE with y.back<-y, it does not work, both objects