YoannPa/methview.qc

snp.heatmap() function error

Closed this issue · 1 comments

the SNP heatmap is neither returned by this function nor by the command to generate all available methview.qc plots. Seems to also throw an internal error

> snp.heatmap<-snp.heatmap(RnBSet = result,
+                          annot.grps = list("Donors" = result@pheno$PID),
+                          annot.pal = pal_npg("nrc", alpha = 1)(10))
Error in if (all.equal(target = annot.pal, current = grDevices::rainbow(n = ncol(data)))) { : 
  argument is not interpretable as logical
In addition: Warning message:
In if (all.equal(target = annot.pal, current = grDevices::rainbow(n = ncol(data)))) { :
  the condition has length > 1 and only the first element will be used

I have found the error you report, but it shouldn't be the one you get when executing the code you give in the issue.

Here is the error you should get from executing the snp.heatmap code line:
Error: could not find function "pal_npg".

To fix the issue mentionned right before:
install.packages("ggsci")
Then in your script, do:
library(ggsci)

Then comes the issue you reported:
The bug was coming from the check.annotation() function of BiocompR and is now fixed.
Please install the latest version of BiocompR from the Github repository linked above.

plot.all.qc() had the same error message arising, but for different reasons.

Finally, your code has an issue:
Your color palette has to be of the same length as the levels of annotations you provide.
Here your palette pal_npg("nrc", alpha = 1)(10) has only 10 colors. And your annotation "Donors" = result@pheno$PID has many more PIDs than 10.

So, now that the bug is fixed, you will get another error describing exactly that issue.