Home > database >  Is it possible to only label the genes that are only positive or up regulated ones?
Is it possible to only label the genes that are only positive or up regulated ones?

Time:02-02

ggmaplot(diff_express, main = expression("Group 1" %->% "Group 2"),
         fdr = 0.05, fc = 2, size = 0.4, 
         genenames = as.vector(diff_express$name),
         ggtheme = ggplot2::theme_minimal(),
         top = 0, label.select = c("BUB1", "CD83")
         )

The figure that is generated this.

I want only to put labels which are unregulated or red marked not the down ones. One way to achieve is I can do this only for up regulated genes by using this

label.select = c("BUB1", "CD83")

But instead of doing this where I have to add label manually can do it other way or methods

Any suggestion or help would be really appreciated

enter image description here

CodePudding user response:

The question is about subsetting the data, see below example and adapt as needed:

# log2FoldChange more than 5
myGenes <- diff_express[ diff_express$log2FoldChange > 5, ]
# rank them by Pvalue, get top 5
myGenes <- myGenes[ rank(myGenes$padj) <= 5, "name"]
# some genes do not have a name, exclude
myGenes <- myGenes[ !is.na(myGenes) & myGenes != ""]

ggmaplot(diff_express, main = expression("Group 1" %->% "Group 2"),
         fdr = 0.05, fc = 2, size = 0.4, 
         genenames = as.vector(diff_express$name),
         ggtheme = ggplot2::theme_minimal(),
         top = 0, label.select = myGenes)

enter image description here

  •  Tags:  
  • Related