Entering edit mode
5.4 years ago
Nicky
•
0
hi guys, I am making a volcano plot and so far have this: (I am new in R, just a couple of days of experience so excuse me if I made something silly).
setwd("Gene_R_coding")
padj<- RNAseq[RNAseq$padj<=0.01,]
FC<- subset(padj,abs(log2FoldChange)>=1)
write.csv(FC,file="CMP_FC.csv")
plot<- with(RNAseq,plot(RNAseq$log2FoldChange,-log10(RNAseq$padj),
main="VolcanoPlot",
xlab="Effect size: fold-change (Log[2])",
ylab="-Log[10] (adj.p-value)",
ylim=c(0,90),
pch=20,
abline(h=-log10(0.01),
col="blue",
lty="1343",
lwd="2",
abline(v=c(-2,2),
col="blue",
lty= "1343",
lwd= "2",
abline(v=c(0),
col="blue",
lty= "1343",
)))))
with(subset(RNAseq,padj<0.01),points(log2FoldChange,-log10(padj),pch=20,col="red"))
with(subset(RNAseq,padj<0.01 & abs(log2FoldChange)<2),points(log2FoldChange,-log10(padj),pch=20,col="lightgrey"))
with(subset(RNAseq,padj<0.01 & log2FoldChange>2),points(log2FoldChange,-log10(padj),pch=20,col="green3"))
with(subset(RNAseq,padj>0.01),points(log2FoldChange,-log10(padj),pch=20,col="lightgrey"))
hgnc_symbol <- abs(RNAseq$log2FoldChange) > 5 & RNAseq$padj<0.001
text(RNAseq$log2FoldChange[hgnc_symbol],
-log10(RNAseq$padj)[hgnc_symbol],
lab=rownames(RNAseq)[hgnc_symbol], cex=0.5)
for some reasons the volcano plot do not display the subscript even after brakets addition in log[2] and log[10] any idea why?
the other problem is that the volcano plot does not display the hgnc_symbol, it gave me numbers instead!
my data set has the following headers
ensembl HGNC.ID NCBI.gene.ID Predicted.HGNC.symbol hgnc_symbol baseMean log2FoldChange lfcSE stat pvalue padj
Nicky
Try this for subscript issues:
For hgnc_symbol, looking at the df structure may help.
Hi, thank you very much,
The subscript actually worked!
I haven't been lucky to get the gene name, what do you mean by "looking at the df structure"
thanks again
try printing this:
rownames(RNAseq)[hgnc_symbol]
andstr(rownames(RNAseq)[hgnc_symbol])