Search code examples
matlabmatlab-figurebioinformaticsmatlab-guide

Labels not working for volcano plot in Matlab


I am a complete newbie to MATLAB and the first task I have is to create a volcano plot. I have been using the documentation to understand about it and get started.

I am using the following dummy data to get started -

Fer1l6  0   0.116815    3.39E-07
Selenoo 0.231255    2.104358    3.17E-06
Myh9    0   0   3.52E-05
SCARNA8 0   0   5.90E-05
7SK 0.4105501   1.593424    7.53E-05
Cnksr1  0.2652796   0.276202    0.000142596
Kcng3   0   0.947934    0.0003170
Acaa1b  0.97177 2.25452 0.0003906
adsf    0.44    0.35    0.3

Here, the first column stands for the gene_name, second column for gene expression values for condition 1, third column for gene expression values for condition 2, and the last column for the P-value. I have this data in an Excel file.

Now, to create the volcano plot, I wrote the following code -

filename='quant_data_for_volcano.xlsx';

youngdata=xlsread(filename,'B:B')
olddata=xlsread(filename,'A:A')
pvalues=xlsread(filename,'C:C')
gene_labels=xlsread(filename,'D:D')
SigStructure = mavolcanoplot(youngdata, olddata, pvalues, 'LogTrans', true, 'Labels', gene_labels)

My understanding is that the 'Labels' argument takes the labels for the various genes (gene_names in this case). However, when I run this code, it does not give me the gene_name labels in the GUI, rather it just gives me the row number as the gene labels - which is what it is supposed to do when I don't provide any labels!

I have attached the output GUI as a picture - as you can see the labels for the genes are just numbers (which correspond to the row number).

The manual says that the labels should be a Cell Array, 'i am not sure if that is important, and if it is, then how to implement it. Any help would be great!

enter image description here


Solution

  • Since, as you've figured out, mavolcanoplot() requires a cell array, you'll want xlsread() to return a cell array instead of a matrix:

    [num, gene_labels]=xlsread(filename,'D:D') % (num is a matrix while gene_labels is a cell array)