Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter BINDetect results based on volcano plot #82

Closed
KeyTals opened this issue Jul 2, 2021 · 4 comments
Closed

Filter BINDetect results based on volcano plot #82

KeyTals opened this issue Jul 2, 2021 · 4 comments

Comments

@KeyTals
Copy link

KeyTals commented Jul 2, 2021

Hello,

Thanks you for making very useful tool, I have question regarding excel and text file crated from BINDetect step, Is it possible to filter the "diff_results" files with only entries of TFs/motifs which are presented as up any condition from volcano plot ( which are colored red or green)?

I am aware of critetia of " -log10(p-value) above the 95% quantile and/or differential binding scores smaller/larger than the 5% and 95% quantiles (top 5% in each direction)" but still diff_results file list for individual motifs are very big then the motifs/TFs identified as up from volcano plot.

Thanks,
Keyur

@msbentsen
Copy link
Member

Hi Keyur,

Sorry no, there is no direct way other than maybe writing a small script to do so for each contrast. The information is located in the "bindetect_results.txt"-file.

If you are familiar with Python, you might use Pandas to read the text into a dataframe and then setup the criteria for each contrast. This will give you a "colored : yes/no" per TF per contrast. Then, based on the criteria, you can choose to only include TFs up/down in any of the contrasts. The change and pvalue columns are always named as <condition1>_<condition2>_change and <condition1>_<condition2>_pvalue, so it should not be too difficult to access the column data.

I am sorry I can't be of more help, and I hope you find a solution.

Best,
Mette

@DittmanC
Copy link

DittmanC commented Sep 2, 2021

is there any way to adjust the cut-off of the l2fc? I have been trying the --pesudo option, but it doesn't change

@msbentsen
Copy link
Member

is there any way to adjust the cut-off of the l2fc? I have been trying the --pesudo option, but it doesn't change

Unfortunately not, no. The --pseudo option only changes the pseudocount added before log2fc-calculation, but not the threshold for up/down-regulation. However, you might have a look within the bindetect_results.txt-file and set your own threshold from the <condition1>_<condition2>_change column. That way, you get a list of TFs that are either more/less strict depending on your application.

@Adrien-Evo
Copy link

Adrien-Evo commented Nov 25, 2021

Here is my code in R to change how the volcanoPlots looks:

library(ggplot2)
library(biomaRt)
library(ggrepel)

changelimit = 0.09
pvallimit = 100

topgenes = read.table(bindetect_results.txt, stringsAsFactor = FALSE, h=TRUE)
topgenes$diffexpressed <- rep("NO",length(topgenes$WT_KI_change))

topgenes$diffexpressed[topgenes$WT_KI_change > changelimit & -log10(topgenes$WT_KI_pvalue) > pvallimit] <- "UP"
topgenes$diffexpressed[topgenes$WT_KI_change < -changelimit & -log10(topgenes$WT_KI_pvalue) > pvallimit] <- "DOWN"

topgenes$labels <- rep(NA,length(topgenes$WT_KI_change))
topgenes$labels[topgenes$diffexpressed != "NO"] <- topgenes$name[topgenes$diffexpressed != "NO"]


topgenes$diffexpressed <- as.factor(topgenes$diffexpressed)

p <-ggplot(data=topgenes, aes(x=WT_KI_change, y=-log10(WT_KI_pvalue),label=labels)) + 
    geom_point(aes(colour = topgenes$diffexpressed))+ 
    theme_classic() + 
    geom_text_repel(aes(colour = diffexpressed),max.overlaps = Inf,show.legend = FALSE,size = 5) + 
    scale_colour_manual(values=c("red","grey","blue"),labels=c("Higher scores in CONE1", "No changes", "Higher scores in COND2")) +
    geom_vline(xintercept=c(-changelimit, changelimit),linetype = "dashed",  alpha=0.4) +
    geom_hline(yintercept=pvallimit, linetype = "dashed", alpha=0.4)  +
    theme(legend.position = c(0.8,0.2),legend.key.size = unit(0.4, "cm"),legend.text=element_text(size=20),axis.text.y = element_text(size = 15),axis.text.x = element_text(size = 15),axis.title=element_text(size=18)) + 
    labs(x ="Change", y = expression("Significance (-Log[10])")) + 
    expand_limits(x=c(-0.2,0.2)) + 
    guides(colour=guide_legend(title=NULL))

Just change the WT_KI_change to the name of your column

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants