<p>In cancer genomics experiments often involve sequencing a large number of tumour samples, but few or no matched normals. This is partly due to financial constraints, but also due to ethical ones: it is easy to get ethical approval for tumour tissue, which is removed as a matter of course in a patient's care anyway, whereas it is hard to get approval for normal tissue, which would not normally be removed and would require an additional procedure.</p>

<p>However, this presents a problem. Most of the procedures we use in standard gene expression analysis involve comparing one group to another after suitable normalisations of the data. But here we have no suitable comparison group. To get around this problem in cancer RNA-seq analysis we do something called outlier detection. That is, we assume that for a given gene, the majority of the patients have "normal" expression, and look for the few patients that don't look like the rest. We do this with the Z-score.</p>

<p>To calculate the Z-score for an observation we subtract the mean of all observations and divide by the standard deviation. Thus the Z score of an observation is how many standard deviations an observation is from the mean of all observations - or how unusual it is. </p>

<p>Thus for Gene A in Patient 1, we calculate how many standard deviations Gene A is from the mean of Gene A across all patients. A very big (or small/negative) value tells us that the expression of Gene A is unusual in patient 1 compared to the other patients. </p>

<p>(NB: in some cancer studies they use the median and median absolute deviation rather than the mean and standard deviation to compute a "robust Z-score" as the data is unlikely to be normally distributed). </p>

CC BY-SA 3.0
2017-08-04T09:38:53.140Z
Interesting and well explained. Thanks. About the use of the median, I would add that this makes the results less sensitive to outliers.
bli
CC BY-SA 3.0
2017-07-31T09:09:58.577Z
2017-07-31T09:09:58.577Z
Ian Sudbery
<p>It depends on what test or analysis you want to do, whether you need intensities (expression values) or z-scores.</p>

<p>If you want to do statistical analysis, such as finding differentially expressed genes between groups of patients (e.g., with limma), you don't want to use z-scores. But you use normalized intensities (for microarrays) or start with raw counts for RNAseq. Then follow the user guide (limma has a great user guide, also for starters).</p>

<p>For visualization in heatmaps or for other clustering (e.g., k-means, fuzzy) it is useful to use z-scores. Z-scores are a form of transformation (scaling), where every genes is sort of "reset" to the mean of all samples, using also the standard deviation. If you want to know exactly what a z-score is, a simple google search can tell you the details. </p>

<p>In R you can use the scale function for z-score transformation. Be aware that the function works on columns though. Which means you have to transpose your matrix first if genes are in the rows, and then transpose them back after transformation.</p>

CC BY-SA 3.0
2017-07-31T11:51:41.470Z
Rather than transposing the matrix I’d suggest using `apply` with `scale`.
Konrad Rudolph
CC BY-SA 3.0
2017-07-30T08:57:43.057Z
2017-07-30T08:57:43.057Z
benn
<p>I'm very new to bioinformatics in general, and I'm trying to understand some basic concepts.</p>

<p>I have RNAseq data, and bioinformatics people tell me that intensities cannot be compared across patients. So there are all of these pipelines to compare intensities to Z scores--are those as simple as just plugging data into a bioconductor package?</p>

<p>It would be great to get some overview description of why Z values are important/why you can't compare intensities across patients, and/or some pointers towards any resources that I can read to learn more.</p>

<p>Thanks much for your time!</p>

CC BY-SA 3.0
2017-07-29T06:50:33.537Z
Your wording suggests that you have microarray data rather than RNAseq, is this correct? Z values are rarely used in RNAseq, rather counts per gene/feature or TPMs are typically used.
Devon Ryan
CC BY-SA 3.0
2017-07-30T03:08:03.680Z
I have some of both--even though I think I've seen Z-scores from TCGA illumna sets? Or perhaps I was mistaken.
julianstanley
<rna-seq><bioconductor><python><normalization>
RNAseq: Z score, Intensity, and Resources
# RNAseq: Z score, Intensity, and Resources

(Asked by: username_0 on 2017-07-29)

I'm very new to bioinformatics in general, and I'm trying to understand some basic concepts.

I have RNAseq data, and bioinformatics people tell me that intensities cannot be compared across patients. So there are all of these pipelines to compare intensities to Z scores--are those as simple as just plugging data into a bioconductor package?

It would be great to get some overview description of why Z values are important/why you can't compare intensities across patients, and/or some pointers towards any resources that I can read to learn more.

Thanks much for your time!

**Tags:** rna-seq, bioconductor, python, normalization
> **Comments:**
> **username_1**: Your wording suggests that you have microarray data rather than RNAseq, is this correct? Z values are rarely used in RNAseq, rather counts per gene/feature or TPMs are typically used.  
> **username_0**: I have some of both--even though I think I've seen Z-scores from TCGA illumna sets? Or perhaps I was mistaken.  

---

## 2 answers

### Answer by username_4 on 2017-07-30. Score: 4 | Accepted answer

It depends on what test or analysis you want to do, whether you need intensities (expression values) or z-scores.

If you want to do statistical analysis, such as finding differentially expressed genes between groups of patients (e.g., with limma), you don't want to use z-scores. But you use normalized intensities (for microarrays) or start with raw counts for RNAseq. Then follow the user guide (limma has a great user guide, also for starters).

For visualization in heatmaps or for other clustering (e.g., k-means, fuzzy) it is useful to use z-scores. Z-scores are a form of transformation (scaling), where every genes is sort of "reset" to the mean of all samples, using also the standard deviation. If you want to know exactly what a z-score is, a simple google search can tell you the details.

In R you can use the scale function for z-score transformation. Be aware that the function works on columns though. Which means you have to transpose your matrix first if genes are in the rows, and then transpose them back after transformation.

> **Comments:**
> **username_5**: Rather than transposing the matrix I’d suggest using `apply` with `scale`.  

---

### Answer by username_2 on 2017-07-31. Score: 2

In cancer genomics experiments often involve sequencing a large number of tumour samples, but few or no matched normals. This is partly due to financial constraints, but also due to ethical ones: it is easy to get ethical approval for tumour tissue, which is removed as a matter of course in a patient's care anyway, whereas it is hard to get approval for normal tissue, which would not normally be removed and would require an additional procedure.

However, this presents a problem. Most of the procedures we use in standard gene expression analysis involve comparing one group to another after suitable normalisations of the data. But here we have no suitable comparison group. To get around this problem in cancer RNA-seq analysis we do something called outlier detection. That is, we assume that for a given gene, the majority of the patients have "normal" expression, and look for the few patients that don't look like the rest. We do this with the Z-score.

To calculate the Z-score for an observation we subtract the mean of all observations and divide by the standard deviation. Thus the Z score of an observation is how many standard deviations an observation is from the mean of all observations - or how unusual it is.

Thus for Gene A in Patient 1, we calculate how many standard deviations Gene A is from the mean of Gene A across all patients. A very big (or small/negative) value tells us that the expression of Gene A is unusual in patient 1 compared to the other patients.

(NB: in some cancer studies they use the median and median absolute deviation rather than the mean and standard deviation to compute a "robust Z-score" as the data is unlikely to be normally distributed).

> **Comments:**
> **username_3**: Interesting and well explained. Thanks. About the use of the median, I would add that this makes the results less sensitive to outliers.  

---

