Open TianyiShi2001 opened 1 year ago
Currently, when we have selectLab and labCol with multiple values, the order of the colors is not consistent with selectLab. An example (extended from the first example in the vignette):
selectLab
labCol
library('DESeq2') library(EnhancedVolcano) library(airway) data(airway) dds <- DESeqDataSet(airway, design = ~ cell + dex) dds <- DESeq(dds, betaPrior=FALSE) res <- results(dds, contrast = c('dex','trt','untrt')) res <- lfcShrink(dds, contrast = c('dex','trt','untrt'), res=res, type = 'normal') EnhancedVolcano(res, lab = rownames(res), x = 'log2FoldChange', y = 'pvalue', selectLab = c('ENSG00000125148', 'ENSG00000000419'), labCol = c('brown', 'gray'))
This PR resolves this issue by reordering the toptable subset according to the order of selectLab before plotting the labels.
Also I did some refactoring to minimize repetitions.
Currently, when we have
selectLab
andlabCol
with multiple values, the order of the colors is not consistent withselectLab
. An example (extended from the first example in the vignette):This PR resolves this issue by reordering the toptable subset according to the order of selectLab before plotting the labels.
Also I did some refactoring to minimize repetitions.