chr1swallace / coloc

Repo for the R package coloc
144 stars 44 forks source link

Add check for for variant naming consistency #170

Open oborisov opened 2 months ago

oborisov commented 2 months ago

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(":=").

https://github.com/chr1swallace/coloc/blob/3cf19c4306b18d090c675ab1a579ec1cf3b91898/R/susie.R#L91-L94

 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,...)