title: Correlation of two samples with replicates
body: <p>I have a expression values (log2) for 200 genes in two conditions treated and untreated and for each condition I have 20 replicates. I want to calculate the correlation between each condition for each gene and rank them from highest to lowest.</p>
  
  <p>This is more of a biostats problem, but still I think it is an important one for biologists/bio-programmers many of us encounter this.</p>
  
  <p>The dataset looks like this:</p>
  
  <pre><code>Gene    UT1            UT2            T1             T2  
  DDR1     8.111795978    7.7606511867   7.9362235824   7.5974674936
  RFC2    10.2418824097   9.7752152714  10.0085488406   9.5723427524
  HSPA6    6.5850239731   6.7916563534   6.6883401632   7.3659252344
  PAX8     9.2965160827   9.2031177653   9.249816924    8.667772504
  GUCA1A   5.4828021059   5.3797749957   5.4312885508   5.1297319374
  </code></pre>
  
  <p>I have shown only two replicates for each sample in the sample data.</p>
  
  <p>I am looking for a solution in R or python.
  cor function in R does not give me what i want.</p>