Skip to content

Sample Correlation — Does Each Sample Resemble Its Replicates?

In the app: QC & samples › Sample Correlation

Available on RNA projects with DESeq2 results and at least three samples.

Sample Correlation answers "how well does each sample correlate with its replicates, and which ones stand out?" Replicates of the same condition should correlate more closely with each other than with any other group. A sample that does not — because of a technical problem or a mislabelled tube — is flagged here, with the reason.

Sample Correlation — example output

Example output from the sample project.

Findings

A note first says which matrix was read — all.vst.tsv, or log2(normalised counts + 1) when VST is not available — and the three rules. A sample is flagged when:

  • its correlation to its own replicates is low (MAD z-score below −5, the nf-core mad_correlation cutoff) — judged on its best correlation to a replicate, so one bad sample does not drag its good replicates down;
  • it resembles another group more than its own replicates, while that other group is itself distinct;
  • it sits far from its group on PCA (PC1–PC2; modified z above 3.5, the same rule as Sample QC).

Then either "No sample stands apart on correlation or on PCA (N samples): every sample resembles its replicates at least as much as any other group.", or a warning listing each flagged sample and why — for example "more like group X (r = …) than its own replicates (r = …)" — ending "A flag is a reason to look, not to exclude."

On a single-cell project an extra note explains that pseudobulk samples correlate by cell type first, so groups are {celltype}-{group} and each sample is judged against the same cell type's replicates.

Filters

Correlation

Spearman (default) or Pearson. Spearman works on ranks and is robust to a few extreme genes; it is nf-core's default. Pearson matches Heatmap by Sample.

Genes

Top 500 by variance (default), Top 1000 by variance or All genes. Restricting to the most variable genes sharpens group structure, as DESeq2's plotPCA does.

Charts

Sample-to-Sample Spearman r (clustered)

A heatmap of the correlation between every pair of samples (the title names the method chosen), ordered by clustering, with each value printed in its cell when there is room. Replicates should form red blocks along the diagonal.

Hierarchical Clustering (average linkage, 1 − r)

A dendrogram built on 1 − r. Samples that join low in the tree are most alike; a replicate that joins its group only near the top, or joins another group, is the one to look at.

Median Correlation to the Other Samples

One bar per sample, coloured by group: the sample's median correlation to every other sample (Median r). In a study with a strong treatment effect these values can be low or negative for every sample, because each group differs from the others; what matters is a sample that is low compared with its own group.

PCA Outlier View

PC1 against PC2, one point per sample, labelled and coloured by group and by whether it was flagged (ok or flagged). It uses the pipeline's own PCA when one was delivered; otherwise the top 500 variable genes, centred (the title says which).

Raw data

Raw data — Per-sample summary

Column Meaning
Sample Sample name
Group The sample's group
Median r (all) Median correlation to every other sample
Best r (own replicates) Correlation to its most similar replicate (empty for a group of one)
Nearest other group The group of the most similar sample outside its own group
Best r (other group) Correlation to that sample
Modified z (own) Robust z-score of Best r (own replicates) across samples
PCA distance to group Distance in PC1–PC2 to its group's median
Flags Why the sample was flagged, if it was

Raw data — Correlation matrix

The full sample-by-sample correlation matrix in clustered order, with Download matrix.

Report settings that apply

None of the filter settings in the Report settings panel change this report. Appearance sets the plot size and styling (see Report Settings).

Reading it

  • A whole group that differs from the rest — the treatment working — correlates less with everything but no less with itself, so it is never flagged. The flags are about single samples.
  • In a group of two, a low correlation cannot say which sample is the odd one; the flag says so.
  • A flag is a reason to look, not to exclude. Check the sample in Sample QC and Read QC (depth, mapping, rRNA), confirm its label, and record any decision in the Sample QC sign-off.