This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Using the Enhanced Volcano plot results in a "subscript out of bounds" error

Hi

I previously posted a question about the Enhanced Volcano package and now have a different issue with a separate dataset. I'm getting a "subscript out of bounds" error. If I understand correctly this results from an index overflow error for a matrix but I have no idea how to fix this.

My code is

attached_rd <- read.csv("C:/PETER PROJECT/3d. Mass Spec Processing/Results of R Analysis/DE Gene Lists/Effect of Serum/WCL Analysis/0% Attached v 5% Attached/DE Cutoff equal 1.2/DE 1-2 Attached Cells DE Gene IDs WCL Apr19 Serum Removal.csv")
 attached_CHO <- distinct(attached_rd, HGNC_Symbol, .keep_all= TRUE)

 volcano_attached <- data.frame(attached_CHO$HGNC_Symbol, attached_CHO$v5.max_fold_change, attached_CHO$v5.Anova..p)
 names(volcano_attached)[1] <- "HGNC_Symbol"
 names(volcano_attached)[2] <- "Log2FC"
 names(volcano_attached)[3] <- "pvalue"
 volcano_attached <- as.numeric(volcano_attached$Log2FC)
str(volcano_attached)

'data.frame':   1757 obs. of  3 variables:
 $ HGNC_Symbol: chr  "ENO1 " "ANXA1 " "TALDO1 " "LTA4H " ...
 $ Log2FC     : num  2.89 4.84 3.1 2.89 3.46 ...
 $ pvalue     : num  4.30e-08 6.39e-08 6.86e-08 8.78e-08 8.84e-08 ...

   EnhancedVolcano(volcano_attached,
     lab = 'volcano_attached$HGNC_Symbol',
     x = 'log2FC',
     y = 'pvalue',
     xlim = c(-10, 10))

if anybody has any suggestions that would be really appreciated.

enhancedvolcano package r

This is not reproducible, if you post this over at Bioc (or stay here since it is most likely not a technical issue that requires the developers expertise) then please add details. Show what is in volcano_attached. Your file path is full of whitespaces, this is something you should avoid by the way.

Updating the post here as per @ATpoint's reply.

The comment about whitespace made me realise that the HGNC_Symbol column had white spaces and while cleaning that up I realised the line

volcano_attached <- as.numeric(volcano_attached$Log2FC)

was wrong. it should be

volcano_attached$Log2FC <- as.numeric(volcano_attached$Log2FC)

However, I now get a different error which is

Error in EnhancedVolcano(volcano_attached, lab = "volcano_attached$HGNC_Symbol",  : 
  log2FC is not numeric!

running str(volcano_attached) to check if the column Log2FC is numeric gives

data.frame':    1757 obs. of  3 variables:
 $ HGNC_Symbol: chr  "ENO1" "ANXA1" "TALDO1" "LTA4H" ...
 $ Log2FC     : num  2.89 4.84 3.1 2.89 3.46 ...
 $ pvalue     : num  4.30e-08 6.39e-08 6.86e-08 8.78e-08 8.84e-08 ...

So I'm still stuck. If you can spot any other error that would be great.

1 answer

It seems that the issue is lowercase 'l' versus uppercase 'L' on Log2FC

Please accept the answer if it solved the issue by clicking the checkmark symbol on the left of his answer.

Log in to answer this question.