chr1swallace/coloc

Add check for for variant naming consistency

Opened this issue · 0 comments

An idea to add check for variant naming consistency. Otherwise coloc.susie errors out with a data.table error which was a bit tricky to debug:

Error in `:=`(idx1, cs1$cs_index[idx1]) : 
  Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").

coloc/R/susie.R

Lines 91 to 94 in 3cf19c4

bf1=s1$lbf_variable[idx1,,drop=FALSE]
bf2=s2$lbf_variable[idx2,,drop=FALSE]
ret=coloc.bf_bf(bf1,bf2,...)

 bf1=s1$lbf_variable[idx1,,drop=FALSE] 
 bf2=s2$lbf_variable[idx2,,drop=FALSE] 
 if (identical(intersect(colnames(bf1), colnames(bf2)), character(0))) {stop("There are no variants in common between the datasets, check that the naming is consistent (e.g., check 'colnames(S3$lbf_variable)' and 'colnames(S4$lbf_variable)'")}
 ret=coloc.bf_bf(bf1,bf2,...)