Error in using r
1
0
Entering edit mode
azhar • 0
@azhar-11661
Last seen 8.1 years ago

 

if 

I use this script I face Error like

gene_list=read.table("exm9.csv",header = T,sep=',')
 

str(P.value)
head(gene_list$gene)
head(gene_list$P.value)
gene_list=(data.frame(P.value))
with(gene_list, plot(log2Foldchange, -log10(P.value), pch=20, main="Volcano plot"

Error in plot(log2FOldchange, -log10(P.value), pch = 20, main = "Volcano plot",  : 
  object 'log2FOldchange' not found
 

>and I f I use

par(mar=c(3,3,2,1), mgp=c(2,.7,0), tck=-.01)
plot(gene_list$Foldchange, -log10(gene_list$P.Value),
xlim=c(-10, 10), ylim=c(0, 15), #Set limits
xlab="log2 fold change", ylab="-log10 p-value")#Set axis labels

Error

Error in log10(gene_list$P.Value) : 
  non-numeric argument to mathematical function

I have csv file with gene names.Foldchange,P.value I don't know what the problem I am new to r want to make volcano plot and also to show significant genes


 

 

microarray • 5.0k views
ADD COMMENT
0
Entering edit mode

Please, have a look on other codes, and forums before posting. Also these errors are not related to any Bioconductor package rather to R. Did you create an log2FOldchange? Also check if the gene_list$P.Value is character or numeric.

ADD REPLY
0
Entering edit mode
this is the out put 
​for you str(gene_list) you asked for 
str(gene_list)
'data.frame':	831 obs. of  3 variables:
 $ genes     : Factor w/ 722 levels "AK002857","AK004128",..: 147 144 408 408 650 4 622 305 419 420 ...
 $ Foldchange: num  6.75 6.69 6.54 6.54 6.21 ...
 $ P.value   : num  1.85e-02 3.58e-03 2.63e-04 2.63e-04 3.47e-07 ...

also

I used this code and got these errors I have no idea

 

gene_list$threshold = as.factor(abs(gene_list$Foldchange) > 2 & gene_list$P.Value < 0.05)

Error in `$<-.data.frame`(`*tmp*`, "threshold", value = integer(0)) : 
  replacement has 0 rows, data has 831

g = ggplot(data=gene_list, aes(x=Foldchange, y=-log10(P.value), colour=my_palette)) +
    geom_point(alpha=0.4, size=5) +
theme(legend.position = "none") +
xlim(c(-10, 10)) + ylim(c(0, 15)) +
xlab("log2 fold change") + ylab("-log10 p-value")
g

Error in Math.factor(P.value) : 憀og10?not meaningful for factors
Error in eval(expr, envir, enclos) : object 'my_palette' not found
ADD REPLY
0
Entering edit mode

How can I check that $p.value is numeric

 

ADD REPLY
0
Entering edit mode

I have used str P.value and its result is

str(gene_list$P.value)
 num [1:831] 1.85e-02 3.58e-03 2.63e-04 2.63e-04 3.47e-07 ...
ADD REPLY
0
Entering edit mode

The error message doesn't match the command you wrote you used, command states log2Foldchange, error states log2FOldchange. What is the output of str(gene_list)?

ADD REPLY
0
Entering edit mode
this is the out put 
​for you str(gene_list) you asked for 
str(gene_list)
'data.frame':	831 obs. of  3 variables:
 $ genes     : Factor w/ 722 levels "AK002857","AK004128",..: 147 144 408 408 650 4 622 305 419 420 ...
 $ Foldchange: num  6.75 6.69 6.54 6.54 6.21 ...
 $ P.value   : num  1.85e-02 3.58e-03 2.63e-04 2.63e-04 3.47e-07 ...

also

I used this code and got these errors I have no idea

 

gene_list$threshold = as.factor(abs(gene_list$Foldchange) > 2 & gene_list$P.Value < 0.05)

Error in `$<-.data.frame`(`*tmp*`, "threshold", value = integer(0)) : 
  replacement has 0 rows, data has 831

g = ggplot(data=gene_list, aes(x=Foldchange, y=-log10(P.value), colour=my_palette)) +
    geom_point(alpha=0.4, size=5) +
theme(legend.position = "none") +
xlim(c(-10, 10)) + ylim(c(0, 15)) +
xlab("log2 fold change") + ylab("-log10 p-value")
g

Error in Math.factor(P.value) : 憀og10?not meaningful for factors
Error in eval(expr, envir, enclos) : object 'my_palette' not found
ADD REPLY
2
Entering edit mode

So you are trying to plot a column which doesn't exist. Your command specifies "log2Foldchange" but in the output of str() I see the name of the column is Foldchange.

 

It might be useful to first follow some basic R tutorials.

ADD REPLY
0
Entering edit mode

 

 

you right I am new to R can you help me to find out the problem

xlab("log2 fold change") + ylab("-log10 p-value")

g

I change this as well but still the error g object is not fiund

 

 

 

 

ADD REPLY
0
Entering edit mode

Please read a tutorial on R or ask your advisor or colleges for basic R problems.

ADD REPLY
0
Entering edit mode

can you suggest me some relvant helpful tutrioal cz I am in pure life science lab I have no help

ADD REPLY
0
Entering edit mode

See this page for example  but you can search for others, like this or this other, I hope this helps. I would also advise to search your programming problems in Stack Overflow, there you can find almost all the errors you can encounter.

ADD REPLY
0
Entering edit mode

 

hi

with(res, plot(Foldchange, -log10(P.value), pch=20, main="Volcano plot", xlim=c(-5,5)))
with(subset(res, padj<.05 ), points(Foldchange, -log10(P.value), pch=20, col="red"))

with(subset(res, abs(Foldchange)>1), points(Foldchange, -log10(P.value), pch=20, col="orange"))

with(subset(res, padj<.05 & abs(Foldchange)>1), points(Foldchange, -log10(P.value), pch=20, col="green"))

# Label points with the textxy function from the calibrate plot

library(calibrate)

with(subset(res, padj<.05 & abs(Foldchange)>1), textxy(Foldchange, -log10(P.value), labs=Gene, cex=.8))

I have used this graph

it worked but still a problem it says

Error in eval(expr, envir, enclos) : object 'padj' not found

 

but it produces the graph with black and orange colour which means the lines which have object padj does not work? is padj is any defulat object cz I changed its name but still it does not work if its deault object so what sthe solution ? 

ADD REPLY
0
Entering edit mode
@02c00601
Last seen 2.4 years ago
Hong Kong

maybe you can use "as.numberic" this value.but i use it,i find the plot is wrong,finnally i know my file has problems.when i fix my file,it's OK

ADD COMMENT

Login before adding your answer.

Traffic: 692 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6