Question: EnhancedVolcano Package Inputing Data Format
gravatar for Nate
12 months ago by
Nate10 wrote:

Hi all,

I want to use enhancedvolcanoes package to produce volcanoes plot, but the example is so confusing with its input data in 'S4' type, obj oriented. I have been looking for an example that shows simple data format that I need to have before inputing them in and use the package. Nowhere to be found!

I just have an excel sheet with 3 columns: Gene, log2FoldChange, pvalue

When input into R as VC_data, can we seen as:

My code is as following:

                lab = VC_data$Gene,
                x = 'log2FoldChange',
                y = 'pvalue',
                xlim = c(-5, 8))

I keep getting this error saying that

'Error in EnhancedVolcano(VC_data, lab = VC_data$Gene, x = "log2FoldChange",  : 
  log2FoldChange is not numeric!'

When I did is.numeric(VC_data$log2FoldChange), I get true.

I am very frustrated. Please help!

enhancedvolcano • 868 views
ADD COMMENTlink modified 12 months ago • written 12 months ago by Nate10

Please embed images properly ( How to add images to a Biostars post ) and use the code option to highlight code, data examples and error messages. I made the changes for you this time.

enter image description here

ADD REPLYlink modified 12 months ago • written 12 months ago by ATpoint34k

look at colnames(VE_data) to make sure that excel hasn't added any whitespace.

ADD REPLYlink written 12 months ago by andrew.j.skelton735.9k
gravatar for ATpoint
12 months ago by
ATpoint34k wrote:

Seems to be an issue with your input being a tibble:

tb <- tibble(log2fc = c(2,3), pval = c(0.01, 0.007))

## this returns the error you have:
EnhancedVolcano(toptable = tb, x = 'log2fc', y = 'pval', lab = "foo")

## this one does it properly:
EnhancedVolcano(toptable = data.frame(tb), x = 'log2fc', y = 'pval', lab = "foo")

=> Convert tibble to data.frame

Edit: The way EnhancedVolcano checks if data are numeric is (source code line 76-78):

if(!is.numeric(toptable[,x])) {
  stop(paste(x, " is not numeric!", sep=""))

Problem is that e.g. tb[,1] does not automatically reduces dimensions to directly access the data but returns:

> tb[,1]
# A tibble: 2 x 1
1      2
2      3


[1] 2 3

returns the numeric data.

ADD COMMENTlink modified 12 months ago • written 12 months ago by ATpoint34k

You are amazing, thank you very much for the help! It works now, couldn't have done it with your help!

ADD REPLYlink written 12 months ago by Nate10

Just to add a comment: in the next version (v1.4), support for Tibbles is provided.

ADD REPLYlink written 9 months ago by Kevin Blighe59k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1589 users visited in the last hour