text: user907: I am a complete newbie to MATLAB and the first task I have is to create a volcano plot. I have been using this link to understand about it and get started.
  I tried to run it on dummy values - 
  a=[1 2 3]
  
  b=[4.6 2.7 4.5]
  
  c=[0.05 0.33 0.45]
  
  And then I ran - 
  SigStructure = mavolcanoplot(a, b, c)
  
  My understanding is that a represents the gene expression values for condition 1, b for condition 2, and c is the list of p-values for the 3 data points in a and b.
  However running this code gives me the error - 
  Index exceeds matrix dimensions.
  
  Error in mavolcanoplot (line 127)
  appdata.effect = X(paramStruct.goodVals) - Y(paramStruct.goodVals);
  
  Error in volc (line 4)
  SigStructure = mavolcanoplot(a, b, c)
  
  Can anyone explain where I am going wrong?
  
  user787: so while I am not so familiar with MATLAB, in the definition of the volcano plot it specifies that PValues is supposed to be a column vector or a DataMatrix object. Your c vector is a row vector, and this confuses MATLAB.
  
  user39: Is there a reason why you are doing this in MATLAB instead of R?
  In R with the ggplot2 package you can make a volcano plot pretty easily using something like this (may be errors as it is off the top of my head and untested):
  # load libraries
  library(ggplot2)
  library(data.table)
  
  # create a dataframe/data.table of the data
  a = c(1,2,3)
  b = c(4.6, 2.7, 4.5)
  c = c(0.05, 0.33, 0.45)
  dt = data.table(A=a,B=b,pval=c)
  
  # add column to calculate log2 fold change between a/b
  dt[,log2Diff := (log2(A)-log2(B))]
  # add column to transform pvalue to -log scale
  dt[,logPval := -log10(pval)]
  
  #make the plot
  ggplot(dt, aes(x=log2Diff,y=logPval))+geom_point()
  
  
  user1568: I'm not sure if nowadays matlab is still a good option for informatics. I would rather go for a R script to make a volcano plot. If you don't want to have fancy code but functional one, you can even make the foldchange calculations and log2 transformation in excel and just plot the log2 fold change in x axis and the -log10 transform of the p/q values on the y axis.
  If you need it, I could provide one of my own scripts.
  
  Update: here is the actual script:
  #load data into the 'res' variable
  res <- read.table("genes.txt", header=TRUE)
  head(res)
  
  # Make a basic volcano plot with grey dots
  with(res, plot(log2FoldChange, -log10(qvalue), pch=19, col="#4A4E4D", xlab="Log2 Fold Change", xlim=c(-8,8)))
  
  # Add colored points: "indianred" if padj<0.0001, orange of log2FC>2, green if both)
  with(subset(res, qvalue<.0001 ), points(log2FoldChange, -log10(qvalue), pch=19, col="#17B090"))
  with(subset(res, abs(log2FoldChange)>2), points(log2FoldChange, -log10(qvalue), pch=19, col="#F89538"))
  with(subset(res, qvalue<.0001 & abs(log2FoldChange)>2), points(log2FoldChange, -log10(qvalue), pch=19, col="#FA6367"))
  
  
original_text: 907: <p>I am a complete newbie to MATLAB and the first task I have is to create a volcano plot. I have been using <a href="https://www.mathworks.com/help/bioinfo/ref/mavolcanoplot.html" rel="nofollow noreferrer">this link</a> to understand about it and get started.</p>
  
  <p>I tried to run it on dummy values - </p>
  
  <pre><code>a=[1 2 3]
  
  b=[4.6 2.7 4.5]
  
  c=[0.05 0.33 0.45]
  </code></pre>
  
  <p>And then I ran - </p>
  
  <pre><code>SigStructure = mavolcanoplot(a, b, c)
  </code></pre>
  
  <p>My understanding is that <code>a</code> represents the gene expression values for condition 1, <code>b</code> for condition 2, and <code>c</code> is the list of p-values for the 3 data points in <code>a</code> and <code>b</code>.</p>
  
  <p>However running this code gives me the error - </p>
  
  <pre><code>Index exceeds matrix dimensions.
  
  Error in mavolcanoplot (line 127)
  appdata.effect = X(paramStruct.goodVals) - Y(paramStruct.goodVals);
  
  Error in volc (line 4)
  SigStructure = mavolcanoplot(a, b, c)
  </code></pre>
  
  <p>Can anyone explain where I am going wrong?</p>
   787: <p>so while I am not so familiar with MATLAB, in the definition of the volcano plot it specifies that <em>PValues</em> is supposed to be a column vector or a DataMatrix object. Your <em>c</em> vector is a row vector, and this confuses MATLAB.</p>
   39: <p>Is there a reason why you are doing this in MATLAB instead of R?</p>
  
  <p>In R with the ggplot2 package you can make a volcano plot pretty easily using something like this (may be errors as it is off the top of my head and untested):</p>
  
  <pre><code># load libraries
  library(ggplot2)
  library(data.table)
  
  # create a dataframe/data.table of the data
  a = c(1,2,3)
  b = c(4.6, 2.7, 4.5)
  c = c(0.05, 0.33, 0.45)
  dt = data.table(A=a,B=b,pval=c)
  
  # add column to calculate log2 fold change between a/b
  dt[,log2Diff := (log2(A)-log2(B))]
  # add column to transform pvalue to -log scale
  dt[,logPval := -log10(pval)]
  
  #make the plot
  ggplot(dt, aes(x=log2Diff,y=logPval))+geom_point()
  </code></pre>
   1568: <p>I'm not sure if nowadays matlab is still a good option for informatics. I would rather go for a R script to make a volcano plot. If you don't want to have fancy code but functional one, you can even make the foldchange calculations and log2 transformation in excel and just plot the log2 fold change in x axis and the -log10 transform of the p/q values on the y axis.
  If you need it, I could provide one of my own scripts.</p>
  
  <p><a href="https://i.stack.imgur.com/ymohs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ymohs.png" alt="enter image description here"></a></p>
  
  <p>Update: here is the actual script:</p>
  
  <pre><code>#load data into the 'res' variable
  res &lt;- read.table("genes.txt", header=TRUE)
  head(res)
  
  # Make a basic volcano plot with grey dots
  with(res, plot(log2FoldChange, -log10(qvalue), pch=19, col="#4A4E4D", xlab="Log2 Fold Change", xlim=c(-8,8)))
  
  # Add colored points: "indianred" if padj&lt;0.0001, orange of log2FC&gt;2, green if both)
  with(subset(res, qvalue&lt;.0001 ), points(log2FoldChange, -log10(qvalue), pch=19, col="#17B090"))
  with(subset(res, abs(log2FoldChange)&gt;2), points(log2FoldChange, -log10(qvalue), pch=19, col="#F89538"))
  with(subset(res, qvalue&lt;.0001 &amp; abs(log2FoldChange)&gt;2), points(log2FoldChange, -log10(qvalue), pch=19, col="#FA6367"))
  </code></pre>
  