From f2e25133c53321b8d63bfff183c38d4c62fd105d Mon Sep 17 00:00:00 2001 From: Mackenzie Ian Frew Date: Wed, 8 Feb 2023 10:12:32 -0500 Subject: [PATCH] Fix COLOC2 null check to be more extensive --- coloc2/functions_coloc_likelihood_summary_integrated2.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coloc2/functions_coloc_likelihood_summary_integrated2.R b/coloc2/functions_coloc_likelihood_summary_integrated2.R index a2ef1e5..92791ac 100644 --- a/coloc2/functions_coloc_likelihood_summary_integrated2.R +++ b/coloc2/functions_coloc_likelihood_summary_integrated2.R @@ -434,7 +434,7 @@ if (!file.exists(outfolder)) dir.create(outfolder) rsq_filter = 0.6 #Imputation quality filter applied to datasets ### -if (!is.null(biom.df$type) && unique(biom.df$type) == "cc") cc=TRUE else cc=FALSE +if (!is.na(biom.df$type) && !is.null(biom.df$type) && unique(biom.df$type[which(!is.na(biom.df$type) && !is.null(biom.df$type))]) == "cc") cc=TRUE else cc=FALSE maf.eqtl = ifelse("MAF" %in% names(eqtl.df), TRUE, FALSE) maf.biom = ifelse("MAF" %in% names(biom.df), TRUE, FALSE) @@ -976,7 +976,7 @@ if (!file.exists(outfolder)) dir.create(outfolder) rsq_filter = 0.6 #Imputation quality filter applied to datasets ### -if (!is.null(biom.df$type) && unique(biom.df$type) == "cc") cc=TRUE else cc=FALSE +if (!is.na(biom.df$type) && !is.null(biom.df$type) && unique(biom.df$type[which(!is.na(biom.df$type) && !is.null(biom.df$type))]) == "cc") cc=TRUE else cc=FALSE #if (all(c("CHR", "POS") %in% names(biom.df))) haveCHRPOS.biom=TRUE else haveCHRPOS.biom=FALSE #if (all(c("CHR", "POS") %in% names(eqtl.df))) haveCHRPOS.eqtl=TRUE else haveCHRPOS.eqtl=FALSE maf.eqtl = ifelse("MAF" %in% names(eqtl.df), TRUE, FALSE)