<?xml version="1.0" encoding="UTF-8" ?>
<!-- RSS generated by PHPBoost on Wed, 13 May 2026 07:48:41 +0200 -->

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Easy Guides]]></title>
		<atom:link href="https://www.sthda.com/english/syndication/rss/wiki/13" rel="self" type="application/rss+xml"/>
		<link>https://www.sthda.com</link>
		<description><![CDATA[Last articles of the category: Microarray data]]></description>
		<copyright>(C) 2005-2026 PHPBoost</copyright>
		<language>en</language>
		<generator>PHPBoost</generator>
		
		
		<item>
			<title><![CDATA[EDA for microarray data]]></title>
			<link>https://www.sthda.com/english/wiki/eda-for-microarray-data</link>
			<guid>https://www.sthda.com/english/wiki/eda-for-microarray-data</guid>
			<description><![CDATA[<!-- START HTML -->
          
  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#eda-for-microarray-data">EDA for Microarray data</a><ul>
<li><a href="#histogram">Histogram</a></li>
<li><a href="#density-curves">density curves</a></li>
<li><a href="#correlation-between-samples">Correlation between samples</a></li>
<li><a href="#scatter-plot">Scatter plot</a></li>
<li><a href="#ma-plot">MA plot</a></li>
</ul></li>
<li><a href="#licence">Licence</a></li>
<li><a href="#references">References</a></li>
</ul>
</div>

<hr />
<pre class="warning"><code>This analysis was performed using R (ver. 3.1.0).</code></pre>
<div id="eda-for-microarray-data" class="section level2">
<h2>EDA for Microarray data</h2>
<p>Exploratory data analysis (EDA) can be used to get an idea of what your data looks like. Here we are analyzing microarray data from 8 samples: two groups of four. A first step in any analysis of genomics data is to learn its general properties and search for problematic samples.</p>
<div id="histogram" class="section level3">
<h3>Histogram</h3>
<p>By viewing the data from the first sample we immediately notice that over 90% of data is below 1,000 and the remaining 10% spans values up to 40,000. By taking the log we get a better picture of the distribution. We use base 2 because memorizing the powers of 2 is easy. It gives us a friendly range: 4-16.</p>
<pre class="r"><code># library(devtools)
# install_github("dagdata","genomicsclass")
library(dagdata)
#load data
data(SpikeInEDA)
#histogramm of the first array: not very informative in linear scale
hist(int[,1])
#Better picture using log2 scale
hist(log2(int[,1]))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-histogram1.png" title="plot of chunk histogram" alt="plot of chunk histogram" width="288" /><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-histogram2.png" title="plot of chunk histogram" alt="plot of chunk histogram" width="288" /></p>
</div>
<div id="density-curves" class="section level3">
<h3>density curves</h3>
<p>Next we look at all eight histograms simultaneously. To facilitate this we introduce the <em>density estimator</em> or <em>smooth histogram</em>. Basically we create a histogram, draw a smooth curve through the top of the bars, and keep that curve. This permits us to put several histograms on the same page:</p>
<pre class="r"><code>for(i in 1:ncol(int))
  if(i==1) plot(density(log2(int[,i])),col=(i==4)+1, main=NULL) else lines(density(log2(int[,i])),col=(i==4)+1)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-density-curve.png" title="plot of chunk density-curve" alt="plot of chunk density-curve" width="384" /></p>
<pre class="warning"><code>Note that one histogram (we highlighted it by making it red) looks different: it has a different shape from the rest. Is this sample different from the rest in any significant way? If we compute the correlation between this sample and the rest it is not very different and all very high.</code></pre>
</div>
<div id="correlation-between-samples" class="section level3">
<h3>Correlation between samples</h3>
<pre class="r"><code>signif(cor(int),2)</code></pre>
<pre><code>##                 2353m99hpp_av08 2353n99hpp_av08 2353o99hpp_av08
## 2353m99hpp_av08            1.00            0.99            0.99
## 2353n99hpp_av08            0.99            1.00            0.99
## 2353o99hpp_av08            0.99            0.99            1.00
## 2353p99hpp_av08            0.99            0.99            0.99
## 2353q99hpp_av08            0.98            0.98            0.98
## 2353r99hpp_av08            0.98            0.98            0.98
## 2353s99hpp_av08            0.98            0.98            0.98
## 2353t99hpp_av08            0.98            0.98            0.98
##                 2353p99hpp_av08 2353q99hpp_av08 2353r99hpp_av08
## 2353m99hpp_av08            0.99            0.98            0.98
## 2353n99hpp_av08            0.99            0.98            0.98
## 2353o99hpp_av08            0.99            0.98            0.98
## 2353p99hpp_av08            1.00            0.98            0.98
## 2353q99hpp_av08            0.98            1.00            0.99
## 2353r99hpp_av08            0.98            0.99            1.00
## 2353s99hpp_av08            0.98            0.99            0.99
## 2353t99hpp_av08            0.98            0.99            0.99
##                 2353s99hpp_av08 2353t99hpp_av08
## 2353m99hpp_av08            0.98            0.98
## 2353n99hpp_av08            0.98            0.98
## 2353o99hpp_av08            0.98            0.98
## 2353p99hpp_av08            0.98            0.98
## 2353q99hpp_av08            0.99            0.99
## 2353r99hpp_av08            0.99            0.99
## 2353s99hpp_av08            1.00            0.99
## 2353t99hpp_av08            0.99            1.00</code></pre>
</div>
<div id="scatter-plot" class="section level3">
<h3>Scatter plot</h3>
<p>The problem is not immediately obvious from a scatter plot.</p>
<pre class="r"><code>##we don&amp;#39;t need to show all the points so we take random samples
#of size 10000
library(rafalib)
splot<-function(x,y,...){
  ind<-sample(length(x),10000)
  x=x[ind];y=y[ind] 
  plot(x,y,...)
}  
#scatterplot between sample 1 and 2
splot(log2(int[,1]),log2(int[,2]), 
      main="sample 1 and 2") 
#Scatterplot between sample 1 and 4
splot(log2(int[,1]),log2(int[,4]),
      main="sample 1 and 4")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-scatterplot1.png" title="plot of chunk scatterplot" alt="plot of chunk scatterplot" width="288" /><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-scatterplot2.png" title="plot of chunk scatterplot" alt="plot of chunk scatterplot" width="288" /></p>
<pre class="warning"><code>Note that samples 1 through 4 are replicates and should produce the same values up to measurement error. Scatterplots and correlation are not the best tools to detect problems. For example 1,2,3,4 and 100,200,300,400 two lists with very different values have perfect correlation. A better measure is the differences between the values and therefore a better plot is a rotation of the scatter plot containing the differences (log ratios) on the y-axis and the averages (in the log scale) on the x-axis. This plot is a refereed to as an MA-plot (plot of difference versus the average). </code></pre>
</div>
<div id="ma-plot" class="section level3">
<h3>MA plot</h3>
<pre class="r"><code>maplot<- function(x,y,...) splot((x+y)/2,y-x,...)

maplot(log2(int[,1]),log2(int[,2]),xlab="A",ylab="M", main="Sple 1 and 2", ylim=c(-2,2))
maplot(log2(int[,1]),log2(int[,3]),xlab="A",ylab="M",main="Sple 1 and 3",ylim=c(-2,2))
maplot(log2(int[,1]),log2(int[,4]),xlab="A",ylab="M", main="Sple 1 and 4", ylim=c(-2,2))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-ma-plot1.png" title="plot of chunk ma-plot" alt="plot of chunk ma-plot" width="288" /><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-ma-plot2.png" title="plot of chunk ma-plot" alt="plot of chunk ma-plot" width="288" /><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-ma-plot3.png" title="plot of chunk ma-plot" alt="plot of chunk ma-plot" width="288" /></p>
<pre class="success"><code>Now the problem is obvious. It turns out this samples comes from an array for which a spatial problem can be detected at the original image level. We actually have the grid locations for these measurements and can recreate the image.</code></pre>
<pre class="r"><code>##we are doing this for two arrays 1 and 4
library(matrixStats) ##need rowMedians
library(RColorBrewer)
for(i in c(1,4)){
  r=log2(int[,i])-rowMedians(log2(int)) 
  ## r are residuals from median array
  ## to avoind outliers taking over colors of image
  ### define a MAX
  MAX<-1
  r[r>MAX]<-MAX
  r[r< -MAX] <- -MAX
  ##we now that every other column is skipped
  mat=matrix(NA,max(locations[,1]),max(locations[,2]+1)/2)
  for(j in 1:nrow(locations)){
     mat[locations[j,1],(locations[j,2]+1)/2]<-r[j]
  }
  image(mat,col=brewer.pal(11,"RdBu"))
}</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-image-problem1.png" title="plot of chunk image-problem" alt="plot of chunk image-problem" width="288" /><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/eda-for-microarray-data-image-problem2.png" title="plot of chunk image-problem" alt="plot of chunk image-problem" width="288" /></p>
<pre class="success"><code>On the second image we can clearly see the spatial pattern (blue are positive residuals, red are negative)</code></pre>
</div>
</div>
<div id="licence" class="section level2">
<h2>Licence</h2>
<p><a href="https://www.sthda.com/english/english/wiki/mit-licence">Licence</a></p>
</div>
<div id="references" class="section level2">
<h2>References</h2>
<p><a href="https://github.com/genomicsclass">https://github.com/genomicsclass</a></p>
</div>

<script>jQuery(document).ready(function () {jQuery('h1,h2,h3,h4').addClass('formatter-title');});//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->
<!-- END HTML -->]]></description>
			<pubDate>Thu, 25 Sep 2014 11:29:34 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Agilent data]]></title>
			<link>https://www.sthda.com/english/wiki/agilent-data</link>
			<guid>https://www.sthda.com/english/wiki/agilent-data</guid>
			<description><![CDATA[<!-- START HTML -->
 <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#download-raw-data">Download raw data</a></li>
<li><a href="#read-agilent-data">Read Agilent data</a></li>
<li><a href="#normalization">Normalization</a></li>
<li><a href="#ma-plot">MA plot</a></li>
<li><a href="#array-image">Array image</a></li>
<li><a href="#licence">Licence</a></li>
<li><a href="#references">References</a></li>
</ul>
</div>

<hr />
<pre class="warning"><code>This analysis was performed using R (ver. 3.1.0).</code></pre>
<div id="download-raw-data" class="section level2">
<h2>Download raw data</h2>
<p><span class="success"> The raw data files for this lab are in the <code>rawdata</code> repository, available here:<br/> <a href="https://github.com/genomicsclass/rawdata">https://github.com/genomicsclass/rawdata</a>.<br/> Click Download ZIP in order to download all the files, unzip this file which should result in a <code>rawdata-master</code> folder. Rename this folder to <strong>rawdata</strong>. </span></p>
</div>
<div id="read-agilent-data" class="section level2">
<h2>Read Agilent data</h2>
<p>Agilent data is a two color arrays. For two-color arrays it’s slightly more complicated, because you have a pairing of files (red and green channels). Different scanners spit out different formats for this. So the <strong>target</strong> information will be a little bit different. <strong>limma package</strong> is used to read the files. The <strong>readTargets</strong> function tells you what’s in the red and the green channels.</p>
<p>The function <strong>read.maimages</strong>(microarray images) is used to read the data. You have to tell it what software produced the images. There’s different software for that, although these days, there’s a default that works pretty broadly. So all we’re doing now is telling it where the files are. We tell it what imaging software was used to produce these files (<strong>“genepix”</strong>). The function <strong>read.maimages</strong>, stores red and green separately.</p>
<pre class="r"><code>library(limma)
library(rafalib)#installed from github
#Define a base directory
basedir <- "~/hubiC/Documents/R/doc/english/genomics/rawdata/agilent"
setwd(basedir)
#Read sample information table : it tells you what&amp;#39;s in the red channel and the green channel
targets <- readTargets("TargetBeta7.txt")
#Read microarray files : Red and green are stored separately
RG <- read.maimages(targets$FileName, source="genepix")</code></pre>
<pre><code>## Read 6Hs.195.1.gpr 
## Read 6Hs.168.gpr 
## Read 6Hs.166.gpr 
## Read 6Hs.187.1.gpr 
## Read 6Hs.194.gpr 
## Read 6Hs.243.1.gpr</code></pre>
</div>
<div id="normalization" class="section level2">
<h2>Normalization</h2>
<p>Data are normalized using <strong>MA.RG</strong> function. It stores the information as the log ratio– that’s the M– and the average of the logs, which is the A.</p>
<pre class="r"><code>#Normalization
MA <- MA.RG(RG,bc.method="none")</code></pre>
</div>
<div id="ma-plot" class="section level2">
<h2>MA plot</h2>
<p>Just to give you a quick idea of what you can do with this. You can do an <strong>MA plot</strong>. You just plot the A versus the M.</p>
<pre class="r"><code>#Normalization
MA <- MA.RG(RG,bc.method="none")
#MA plot
plot(MA$A[,1],MA$M[,1])#MA plot for the first sample</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/agilent-data-ma-plot.png" title="plot of chunk ma-plot" alt="plot of chunk ma-plot" width="336" /></p>
</div>
<div id="array-image" class="section level2">
<h2>Array image</h2>
<p>Another nice feature is to make images pretty quickly.</p>
<pre class="r"><code>#Array image
imageplot(MA$M[,2], RG$printer, zlim=c(-3,3))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/genomics/agilent-data-array-image.png" title="plot of chunk array-image" alt="plot of chunk array-image" width="288" /></p>
<pre class="warning"><code>This is a nice example where we see an image where there seems to be a little bit of a problem. If you look at the edge, you see that it&amp;#39;s quite green, compared to the middle, which is redder. Then you have too much red on the left. So we&amp;#39;re detecting that there&amp;#39;s somewhat of a problem in this file.</code></pre>
</div>
<div id="licence" class="section level2">
<h2>Licence</h2>
<p><a href="https://www.sthda.com/english/english/wiki/mit-licence">Licence</a></p>
</div>
<div id="references" class="section level2">
<h2>References</h2>
<p><a href="https://github.com/genomicsclass">https://github.com/genomicsclass</a></p>
</div>

<script>jQuery(document).ready(function () {jQuery('h1,h2,h3,h4').addClass('formatter-title');});//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->

<!-- END HTML -->]]></description>
			<pubDate>Thu, 25 Sep 2014 11:27:55 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Affymetrix CEL files]]></title>
			<link>https://www.sthda.com/english/wiki/affymetrix-cel-files</link>
			<guid>https://www.sthda.com/english/wiki/affymetrix-cel-files</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#download-raw-data">Download raw data</a></li>
<li><a href="#read-affymeterix-cel-files">Read Affymeterix CEL files</a></li>
<li><a href="#normalization">Normalization</a></li>
<li><a href="#licence">Licence</a></li>
<li><a href="#references">References</a></li>
</ul>
</div>

<hr />
<pre class="warning"><code>This analysis was performed using R (ver. 3.1.0).</code></pre>
<div id="download-raw-data" class="section level2">
<h2>Download raw data</h2>
<p><span class="success"> The raw data files for this lab are in the <code>rawdata</code> repository, available here: <a href="https://github.com/genomicsclass/rawdata">https://github.com/genomicsclass/rawdata</a> Click Download ZIP in order to download all the files, unzip this file which should result in a <code>rawdata-master</code> folder. Rename this folder to <strong>rawdata</strong>. </span></p>
</div>
<div id="read-affymeterix-cel-files" class="section level2">
<h2>Read Affymeterix CEL files</h2>
<p>We start by reading in the sample information table. This is usually created by the person who performed the experiment.</p>
<pre class="r"><code>#Set working directory to the the celfiles
basedir <- "~/hubiC/Documents/R/doc/english/genomics/rawdata/celfiles"
setwd(basedir)
library(affy)

#Sample information table : it has file names and data from spiking experiment (spiking concentration)
tab <- read.delim("sampleinfo.txt",check.names=FALSE,as.is=TRUE)
rownames(tab) <- tab$filenames
tab[1:6, 1:3]</code></pre>
<pre><code>##                                       filenames 37777_at 684_at
## 1521a99hpp_av06.CEL.gz   1521a99hpp_av06.CEL.gz     0.00   0.25
## 1532a99hpp_av04.CEL.gz   1532a99hpp_av04.CEL.gz     0.00   0.25
## 2353a99hpp_av08.CEL.gz   2353a99hpp_av08.CEL.gz     0.00   0.25
## 1521b99hpp_av06.CEL.gz   1521b99hpp_av06.CEL.gz     0.25   0.50
## 1532b99hpp_av04.CEL.gz   1532b99hpp_av04.CEL.gz     0.25   0.50
## 2353b99hpp_av08r.CEL.gz 2353b99hpp_av08r.CEL.gz     0.25   0.50</code></pre>
<pre class="r"><code>#list all the .cel files that are in the current directory.
fns <- list.celfiles()
fns</code></pre>
<pre><code>## [1] "1521a99hpp_av06.CEL.gz"  "1521b99hpp_av06.CEL.gz" 
## [3] "1532a99hpp_av04.CEL.gz"  "1532b99hpp_av04.CEL.gz" 
## [5] "2353a99hpp_av08.CEL.gz"  "2353b99hpp_av08r.CEL.gz"</code></pre>
<pre class="r"><code>#Check whether the filenames are the same in the directory and in the sample info tab
fns %in% tab[,1] ##check</code></pre>
<pre><code>## [1] TRUE TRUE TRUE TRUE TRUE TRUE</code></pre>
<pre class="r"><code>#Read cel files in the current directory
ab <- ReadAffy(phenoData=tab)</code></pre>
<pre class="success"><code>ReadAffy function creates an AffyBatch object which object contains the information you need.</code></pre>
<pre class="r"><code>#Extract the perfect match probe-level intensities
dim(pm(ab))</code></pre>
<pre><code>## [1] 201807      6</code></pre>
<pre class="r"><code>#Phenotypic data : sample information 6X17
dim(pData(ab))</code></pre>
<pre><code>## [1]  6 17</code></pre>
<pre class="r"><code>#Plateform used for gene information
annotation(ab)</code></pre>
<pre><code>## [1] "hgu95a"</code></pre>
</div>
<div id="normalization" class="section level2">
<h2>Normalization</h2>
<p>The last thing to do here is to turn probe-level information into gene-level information. You can preprocess this probe-level information in many ways. One way you can do it is using this algorithm called <strong>rma</strong>. It’s going to turn probe-level data into gene-level data, quantile normalization and also background correction.</p>
<pre class="r"><code>e <- rma(ab)</code></pre>
<pre><code>## Background correcting
## Normalizing
## Calculating Expression</code></pre>
<pre class="r"><code>dim(e)</code></pre>
<pre><code>## Features  Samples 
##    12626        6</code></pre>
<pre class="success"><code>You notice that this information is smaller, it&amp;#39;s only 12,000 by 6. It&amp;#39;s been summarized now.</code></pre>
<p>If you are not interested in probe level data you could use this function :</p>
<pre class="r"><code>setwd(basedir)
ejust <- justRMA(filenames=tab[,1],phenoData=tab)
dim(ejust)</code></pre>
</div>
<div id="licence" class="section level2">
<h2>Licence</h2>
<p><a href="https://www.sthda.com/english/english/wiki/mit-licence">Licence</a></p>
</div>
<div id="references" class="section level2">
<h2>References</h2>
<p><a href="https://github.com/genomicsclass">https://github.com/genomicsclass</a></p>
</div>

<script>jQuery(document).ready(function () {jQuery('h1,h2,h3,h4').addClass('formatter-title');});//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->

<!-- END HTML -->]]></description>
			<pubDate>Thu, 25 Sep 2014 11:25:34 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Microarray data]]></title>
			<link>https://www.sthda.com/english/wiki/microarray-data</link>
			<guid>https://www.sthda.com/english/wiki/microarray-data</guid>
			<description><![CDATA[-=-]]></description>
			<pubDate>Thu, 25 Sep 2014 11:24:42 +0200</pubDate>
			
		</item>
		
	</channel>
</rss>
