erilu / bulk-rnaseq-analysis

A complete guide for analyzing bulk RNA-seq data. Go from raw FASTQ files to mapping reads using STAR and differential gene expression analysis using DESeq2, using example data from Guo et al. 2019.
https://erilu.github.io/bulk-rnaseq-analysis
66 stars 18 forks source link

"There is some overlap between the data in top_genes and bottom_genes." #3

Open pandas-zwx opened 3 months ago

pandas-zwx commented 3 months ago

I think, in this part, top_genes and bottom_genes have some overlap. If you set nlabel ==20, and print the data of top_genes and bottom_genes, you can find the overlap. top_genes <- significant_genes %>% arrange(padj) %>% head(nlabel) bottom_genes <- significant_genes %>% filter (log2FoldChange < 0) %>% arrange(padj) %>% head (nlabel) so i rewrite this part: top_genes <- significant_genes %>% filter (log2FoldChange > 0) %>% arrange(padj) %>% head (nlabel) # arrange sort significant_genes in ascending order based padj value.

and when i draw volcano plot, i found there is no label of STC1 and PLOD2, so i checked these data and found the padj of these data is zero, i guessed that maybe this is the cause of this problem. Then i added some codes to change the padj of these data and try to ensure that STC1 and PLOD2 are visible within the plot and not at the edges , and found it worked. codes are belowed. res$padj <- ifelse(res$padj <= 0, 8.958917e-250, res$padj) # ifelse(condition, true_value, false_value) max_y <- max(-log(res$padj), na.rm = TRUE) + 1 top_genes$padj <- ifelse(top_genes$padj <= 0, 8.958917e-250, top_genes$padj) ggplot(res, aes(log2FoldChange, -log(padj))) + geom_point(aes(col=significance),size=0.5) + scale_y_continuous(limits = c(-1, max_y))+ scale_color_manual(values=c("red", "black")) + # padj<0.0005 map to red, padj>0.0005 map to black. ggrepel::geom_text_repel(data=top_genes, aes(label=head(Gene.name,nlabel)), size = 3)+ ggrepel::geom_text_repel(data=bottom_genes, aes(label=head(Gene.name,nlabel)), color = "#619CFF", size = 3)+ labs ( x = "Log2FoldChange", y = "-(Log normalized p-value)")+ geom_vline(xintercept = 0, linetype = "dotted")+ # The function geom_vline is used to add vertical reference lines to the plot:position:x=0,format:dotted theme_minimal() }

image

In the last but not least, you help me a lot . Thank you very much. You give me confidence to explore this field, thank you again.

pandas-zwx commented 3 months ago

@erilu

erilu commented 3 months ago

Hi @pandas-zwx, thanks for finding these bugs and for proposing fixes. I think your new code works better and improves the quality of the plots. The code you added to constrain the top_genes and fix the missing points makes sense and I agree with your approach.

I'm happy that you found my guide useful and wish you all the success as you gain more experience in this field.

pandas-zwx commented 2 months ago

hi, Erick! I have some confusion about your guide “ sc-RNA seq analysis”. I raise a question on GitHub to you about my confusion. Sorry to bother you. Looking forward to your early reply. Best, Zhao

Get Outlook for iOShttps://aka.ms/o0ukef


From: Erick Lu @.> Sent: Thursday, August 8, 2024 12:48:27 AM To: erilu/bulk-rnaseq-analysis @.> Cc: pandas-zwx @.>; Author @.> Subject: Re: [erilu/bulk-rnaseq-analysis] "There is some overlap between the data in top_genes and bottom_genes." (Issue #3)

Hi pandas-zwx, thanks for finding these bugs and for proposing fixes. I think your new code works better and improves the quality of the plots. The code you added to constrain the top_genes and fix the missing points makes sense and I agree with your approach.

I'm happy that you found my guide useful and wish you all the success as you gain more experience in this field.

— Reply to this email directly, view it on GitHubhttps://github.com/erilu/bulk-rnaseq-analysis/issues/3#issuecomment-2273896239, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJ3GGNTRFTORPJKI2PYQCXLZQJFVXAVCNFSM6AAAAABL2MSSNCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTHA4TMMRTHE. You are receiving this because you authored the thread.Message ID: @.***>