RNA-seq Sample Swap Detection: How to Choose
By Dr. Zubair Khalid, DVM, MS, PhD ·

RNA-seq sample swap detection comes down to one distinction: genotype-based methods compare inherited SNP alleles, which are identical across every data type generated from the same person, while expression-based methods compare gene-expression patterns, which shift with tissue, disease state, and batch. The rule of thumb is simple. If every RNA sample has matched DNA, an exome, or a SNP array, use genotype concordance checking. If you only have RNA, use an RNA-informative SNP panel such as SMaSH, and treat expression clustering as a coarse screen rather than proof of identity.
This article walks through the practical options, compares them on the criteria that actually decide a choice, gives worked scenarios, and lays out a troubleshooting workflow for the day a swap shows up in your data.
Why Swaps Hide in RNA-seq
A sample swap means the file labeled Patient_A_tumor actually contains RNA from a different donor, a different tissue, or a different time point than the metadata claims. Swaps are a real threat to data quality in any medium to large scale omics study, and RNA-seq pipelines are where they most often slip through unnoticed [1].
Several features of RNA-seq make this true:
- Expression is tissue-specific by design. A liver sample and a tumor sample are supposed to look different, so an unexpected expression profile often gets interpreted as biology instead of a mistake.
- RNA degrades easily. Degraded libraries produce weaker, noisier signal, which can mask the fingerprints that reveal a mismatch.
- Swaps happen upstream of the sequencer. Tube mix-ups during extraction, rotated plate layouts, and mislabeled cryovials all produce perfectly clean-looking FASTQ files from the wrong source.
- Index hopping and barcode collisions add a second failure mode. Even a correctly loaded flow cell can leak a small fraction of reads between adjacent libraries, which mimics mild cross-contamination.
A swap is the one major rna seq error you can sometimes correct after the fact, because the reads themselves still carry the identity of the true source. That is exactly what sample identity tools exploit. The challenge is that RNA-seq libraries usually provide low to moderate coverage, so no single locus gives a confident answer. Evidence has to be integrated across many genomic positions at once, which is the design principle behind SNP-panel methods like SMaSH [1].
The stakes are concrete. A single swap in a paired-end differential expression experiment can move a sample into the wrong condition, inflate variance, and in a small cohort, create or destroy a finding. In multi-omics projects, a swap between RNA and DNA from different donors can corrupt every downstream integration analysis at once. Detection is cheap relative to the cost of an undetected swap.
The Core Distinction: Genotype Identity Versus Expression Similarity
Almost every method in this space falls into one of two families, and understanding the split is the fastest way to narrow your choice.
Genotype-based identity checking looks at positions in the genome where individuals differ. A single nucleotide polymorphism, or SNP, is a position where the reference base varies between people. Each person carries two alleles at an autosomal SNP, one from each parent, and that pair is called a genotype. Your genotype at a SNP is the same whether the assay reads DNA, RNA, or methylated DNA fragments. Two libraries from the same person should show the same genotypes at nearly every informative SNP. Two libraries from different people should disagree at a predictable fraction of them. Because these signals are inherited rather than expressed, genotype methods work across data types. SMaSH, for example, establishes identity between exome, RNA-seq, and MethylCap-seq libraries, meaning it can confirm that a sequencing library from one modality and a library from another came from the same individual [1].
Expression-based similarity checking looks at how thousands of genes are expressed. Samples from the same tissue and condition cluster together in principal component space. When a sample sits far from its expected group and close to another group, that pattern can indicate a swap. Expression methods need no genotype reference and work on any organism with a transcriptome. But they are indirect. A genuine biological difference, a batch effect, or a degraded library can all pull a sample away from its cluster, so an expression outlier is a reason to investigate, not a verdict.
A third, weaker family uses fixed biological facts, such as chromosomal sex markers or known clinical genotypes, as one-bit identity checks. These are cheap and useful, and they belong in every pipeline as a first pass.
RNA-seq Sample Swap Detection Options Compared
Option 1: SNP-panel identity matching with SMaSH
SMaSH (Sample Matching using SNPs in Humans) was built specifically for the problem RNA-seq poses. The tool selects about six thousand informative SNPs across the human genome and uses a Bayesian framework to combine evidence across all of them, because omics data often give only low to moderate coverage at any single position [1]. A Bayesian framework, in this context, means the tool weighs each SNP observation by how informative and how reliable it is, then accumulates evidence into a probability that two libraries share a source.
The two properties that matter for RNA-seq work are cross-modality matching and robustness to poor input. SMaSH was validated on a variety of datasets and can establish identity between different omics data types, including exome sequencing, RNA-seq, and MethylCap-seq, so you can compare an RNA library against a DNA library produced by a different assay and a different lab [1]. On the robustness side, identity detection degrades with sample quality and read coverage, but twenty million reads from a fairly low quality RNA-seq sample were still sufficient for reliable sample identification in the validation work [1]. That depth sits comfortably within the range of a standard bulk RNA-seq library, which means most experiments already generate enough data to run the check.
Operationally, SMaSH ships as a Nextflow pipeline, which makes it straightforward to drop into a standard workflow engine. You supply the sequencing files (FASTQ or BAM) and a metadata table describing which samples should match which, and the pipeline extracts reads overlapping the SNP panel, infers alleles, and reports match and mismatch calls with supporting statistics. You do not need matched DNA for every sample if you are comparing RNA libraries to each other, though the tool is most powerful when a genotype reference exists.
The main limitation is scope. The panel is drawn from the human genome, so this option applies to human studies. For model organisms you would need an equivalent panel of polymorphic sites for that species, or you fall back on the other options below.
Option 2: Concordance against matched DNA
When each RNA sample has a matched DNA resource, whole genome sequencing, exome sequencing, a SNP array, or a clinical genotyping panel, you can check the RNA calls against the DNA calls directly. The logic is the same as Option 1, but the reference is per-sample rather than a population panel, which makes the comparison sharper. Heterozygous sites, positions where the two alleles differ, are especially informative. At a heterozygous SNP, a correctly matched RNA library shows reads from both alleles, while a mismatched library tends to look homozygous for the other individual's allele.
Two widely used tools implement this pattern for sequence data:
- verifyBamID takes a BAM file plus a VCF of known genotypes and estimates both contamination and the match between the sample and its claimed genotype. Point it at each RNA BAM and the donor's genotyping VCF, and read the reported match statistic.
- Picard CrosscheckFingerprints compares two or more sequencing files and reports whether they are consistent with coming from the same source, using a haplotype map of the relevant SNPs:
picard CrosscheckFingerprints \
INPUT=rna_sample_A.bam \
INPUT=dna_sample_A.bam \
HAPLOTYPE_MAP_FILE=hg38.haplotype_map.txt \
OUTPUT=crosscheck_A_vs_A.txt
Run this for every RNA-to-DNA pair in the study, or feed all files at once and let the tool group them. The output is a per-pair verdict with a LOD-style score, which makes the result easy to triage programmatically.
The strengths of this option are high confidence, no reliance on a fixed SNP panel, and applicability to any organism for which you have matched DNA. The weaknesses are that it requires a matched DNA resource for every sample you want to certify, and that RNA coverage at heterozygous SNPs must be adequate, which degraded libraries sometimes fail to provide. In practice, if matched DNA exists, this is usually the best rna-seq sample swap detection choice available, because the genotypes act as an unambiguous barcode of the donor.
Option 3: Expression-based screens with PCA and clustering
Principal component analysis (PCA) is a dimensionality-reduction technique that projects the largest sources of variation in your expression matrix onto a few axes. In a well-behaved RNA-seq experiment, samples separate along the first axes by biology (condition, tissue, time point) and secondarily by batch. A swapped sample often sits in the cluster of its true source rather than its labeled source.
A minimal screen in R, using DESeq2 variance-stabilizing transformation:
library(DESeq2)
vsd <- vst(dds)
plotPCA(vsd, intgroup = c("condition", "batch"))
Pair this with a sample-to-sample distance heatmap:
d <- dist(t(assay(vsd)))
pheatmap(d)
Two patterns deserve attention. First, a sample that clusters with the replicate group it should not belong to is a candidate swap, especially if the misplacement is clean and complete. Second, in paired designs such as tumor and adjacent normal from the same patients, a swap between a patient's tumor and normal RNA is a classic failure. Expression screening alone cannot prove identity, because two samples from the same person can look alike for reasons unrelated to a swap, and different people can have similar expression in homogeneous tissue. What expression screening does well is flag candidates cheaply, on data you already have, before you invest in a definitive test.
Marker-gene checks sharpen this screen. Tissue identity genes (for example, high immunoglobulin expression pointing at a B-cell sample), known transgene expression in cell lines, or treatment-induced signatures can each confirm or contradict a label. These checks are organism-agnostic and cost nothing beyond plotting time.
Option 4: Sex markers, metadata, and plate-map audits
Chromosomal sex is the cheapest genotype check available. In a human study with mixed sexes, read depth across Y-linked genes such as SRY, DDX3Y, and ZFY separates male from female libraries cleanly:
samtools depth -r chrY rna_sample.bam | awk '{s+=$3} END {print s}'
Sum Y-chromosome coverage across a sufficient span, then compare the pattern against reported sex. A male-labeled sample with no Y signal, or a female-labeled sample with strong Y coverage, is either mislabeled or swapped. This check fails in designs where all samples share a reported sex, and it can be ambiguous with sex chromosome aneuploidy, so treat it as a filter for gross errors, not a universal test.
The metadata and plate-map audit belongs in the same tier. Pull the extraction manifests, the plate layouts, and the library preparation logs, and ask three questions. Do the plate positions recorded in the manifest match the positions recorded at library prep? Are the sample indices on the flow cell consistent with the sample sheet? Does any pair of samples sit in adjacent wells or adjacent index combinations where a pipetting or indexing error could plausibly explain a mismatch? A large fraction of real swaps, once found, can be traced to a single rotated plate or a shifted column, and the audit often reveals the physical event that produced the bioinformatics signal.
Option 5: Contamination and cross-talk checks, and why they are different
A sample swap replaces one library's content with another's. Contamination mixes a small fraction of foreign content into an otherwise correct library. Index hopping adds reads from a neighboring library at a low level. The distinction matters because the remedies differ. A swap calls for relabeling, reprocessing, or re-extraction. Contamination calls for assessment of whether the level is tolerable for the analysis.
The practical diagnostic is the pattern across the genome. At SNP positions where the claimed donor is homozygous, a small consistent fraction of reads supporting the other allele, spread across many sites, points to contamination or cross-talk. A full pattern of the wrong genotype across nearly all informative sites points to a swap. Tools in the verifyBamID family estimate contamination fractions directly, and the same SNP-panel machinery that powers identity checking powers this estimate. Run a contamination estimate on every library in a study where swaps have appeared, because the two problems co-occur when library handling is sloppy.
Side-by-Side Comparison
| Option | What it compares | Data required | Works from RNA alone | Cross-modality | Best use case | Main limitation |
|---|---|---|---|---|---|---|
| SNP panel (SMaSH) | Inferred alleles at ~6,000 human SNPs [1] | FASTQ or BAM, sample metadata | Yes | Yes, exome, RNA-seq, MethylCap-seq [1] | RNA-only cohorts, cross-omics identity checks | Human SNP panel, not portable to other species |
| Matched-DNA concordance (verifyBamID, Picard CrosscheckFingerprints) | RNA-derived alleles vs. donor genotypes | Per-sample DNA data plus RNA BAM | No | Yes, by construction | Cohorts with WGS, exome, or arrays | Requires matched DNA for every sample |
| Expression PCA and clustering | Genome-wide expression patterns | Gene count matrix you already have | Yes | Poor, across modalities expression is not comparable | First-pass screen, outlier triage | Biology and batch mimic swaps, no proof of identity |
| Sex markers and metadata audit | Y-chromosome depth, plate maps, sample sheets | BAM plus lab records | Yes | Limited | Cheap first pass, tracing the physical cause | One-bit check, fails in single-sex designs |
| Contamination and cross-talk estimates | Fraction of foreign alleles at homozygous sites | BAM plus genotype reference | Yes, with reference | Yes | Distinguishing swaps from contamination | Estimates a mixture, does not by itself assign identity |
How the Options Stack Up on the Criteria That Decide Real Choices
Accuracy and confidence. Genotype methods produce a defensible identity call with quantified evidence, because the underlying signal, inherited alleles, is stable and independent of the transcriptome. Expression methods produce a suspicion. When a result will trigger relabeling of archived data, retraction of a finding, or a conversation with a collaborator, you want the genotype call. The Bayesian accumulation of evidence across thousands of SNPs is what lets SMaSH make confident calls from low-coverage inputs [1].
Input burden. Expression and sex-marker checks need nothing beyond your existing count matrices and BAM files. Matched-DNA concordance needs a DNA resource per sample, which many RNA-seq-only studies lack. SMaSH needs only the sequencing data and metadata, which is why it fills the gap for RNA-only cohorts [1].
Cross-modality reach. Multi-omics projects need identity checks that survive a change of assay. Genotype comparisons do, because the genotypes are assay-independent, and SMaSH demonstrated this explicitly across exome, RNA-seq, and methylation-capture sequencing [1]. Expression comparisons do not, since expression profiles from different modalities or tissues are not on a shared scale.
Robustness to quality. All identity methods lose power as coverage drops and bases degrade. The validation work on SMaSH showed the degradation is gradual, and that even a fairly low quality RNA-seq sample at twenty million reads remained sufficient for reliable identification [1]. That result should shape expectations for FFPE-derived or partially degraded libraries, where you may want to confirm borderline calls with a second method.
Throughput and automation. For a 20-sample pilot, any option works by hand. For a 2,000-sample cohort, you need something scriptable. SNP-panel pipelines built on workflow engines and Picard-style batch tools both scale cleanly. Expression screens scale trivially since they are one PCA away. Plan for the cohort size you have, not the one you hope to have.
How to Choose: A Decision Path

Work through these questions in order.
- Do you have matched DNA, exome, or array data for the samples? If yes, run genotype concordance as the definitive check and keep the other methods as screens. If no, continue.
- Is this a human study? If yes, an RNA-informative SNP panel such as SMaSH gives you cross-modality identity checking from the RNA data itself, including from low-quality libraries at moderate depth [1]. If no, you are choosing between expression screens, species-appropriate genotype checks if matched DNA exists, and marker-based sanity checks.
- Is this a first-pass audit or a response to a suspected problem? For routine intake QC on a new cohort, run the cheap screens first (PCA, sex markers, metadata audit), then genotype checking on anything suspicious or on a random subset. For an active troubleshooting episode, go straight to genotype methods and the plate-map audit.
- Will the result justify a data correction? Any call that leads to relabeling or reanalysis should rest on genotype evidence, ideally with two independent genotype-based tools agreeing.
- How degraded is the RNA? For FFPE or otherwise poor libraries, expect weaker per-site evidence and lean on methods designed for that regime, and confirm borderline calls before acting.
Worked Scenarios
Scenario 1: A tumor-normal cohort with exome data for every patient
You have RNA-seq and exome-seq from the same 150 patients. This is the most favorable setup. Run Picard CrosscheckFingerprints on every RNA-to-DNA pair, or run verifyBamID against each patient's germline VCF. Any discordant pair gets a plate-map audit and, if needed, a re-extraction. Because the genotypes are unambiguous, you can certify the entire cohort's labels with high confidence and record the check in the analysis report.
Scenario 2: An RNA-only human cohort, no DNA
You have 400 bulk RNA-seq libraries at 30 to 40 million reads each, no matched genotypes. This is the case SMaSH was designed for. Build a metadata table mapping sample IDs to expected relationships (replicates that must match, tumor-normal pairs that must match), run the pipeline, and review the match and mismatch calls. Expect reliable calls at your depth, including for libraries with mediocre quality metrics, per the validation results on low-quality RNA [1]. As a first pass, run the PCA screen in parallel so that obvious expression-level outliers get flagged early, but let the SNP-panel calls drive any relabeling.
Scenario 3: A suspicious PCA outlier discovered during differential expression
Halfway through a differential expression analysis, one replicate of condition B clusters inside condition A. Resist the urge to delete it. First check the obvious rna seq error explanations: library size, mapping rate, gene-level QC, and batch columns. Then check identity. If matched DNA exists, run concordance. If not, and the organism is human, run SMaSH against the other samples. In many cases the outlier turns out to be biology, a missed annotation, or a swap whose direction you can now determine from the genotype evidence. Only after identity is settled should the sample be excluded, relabeled, or retained.
Scenario 4: A multi-omics integration project
You are combining RNA-seq, exome, and methylation data and want every omics layer for a given patient to genuinely come from that patient. Cross-modality identity checking is the requirement, and it is exactly what SMaSH was built and validated to do across exome, RNA-seq, and MethylCap-seq data [1]. Run the pairwise checks across modalities before integration. One swap discovered here can otherwise propagate silently into methylation-expression correlation analyses, allele-specific expression, and mutation-transcript associations.
Scenario 5: A mouse study with no matched genotypes
No human SNP panel applies, and there is no DNA. Your options narrow to expression clustering, sex-marker checks where mixed sexes exist, known genotype markers if strains or transgenes carry distinguishable alleles, and metadata audits. In inbred strains, expression-based swap detection loses most of its power, because genetically identical animals are genuinely hard to tell apart. Prevention, through barcode labeling and plate-map discipline, matters more than detection in this setting, and the realistic goal is catching gross errors such as a duplicated sample sheet row or a completely swapped condition group.
A Bioinformatics Troubleshooting Workflow for a Suspected Swap

When a colleague reports a result that makes no sense, or your own PCA shows an impossible pattern, work this sequence.
- Write down the expected relationships. Which samples should match (replicates, paired tissues) and which should not (different patients, different conditions). Every identity method needs this framing.
- Run the cheap screens. PCA on variance-stabilized counts, a sample-distance heatmap, sex-marker depth where applicable, and a scan for duplicated or shifted sample sheet rows. This step costs minutes and frequently finds plate-level errors directly.
- Run genotype-based identity checking on the candidates. Use matched-DNA concordance where available, or SMaSH for human RNA-only data. Generate pairwise match and mismatch calls for the candidate samples against their expected partners [1].
- Estimate contamination on the same libraries. A swap and contamination present differently at homozygous sites, and both can follow from the same handling failure. Knowing which you have determines the remedy.
- Audit the physical record. Take the bioinformatics finding to the extraction manifests and plate layouts. Look for rotations, shifted columns, adjacent wells, and index adjacency that explain the observed mismatch pattern.
- Resolve and document. Relabel the affected samples, correct downstream result files, and record the event, the evidence, and the correction in the project log. If the swap affects published or shared results, notify the affected parties with the genotype evidence in hand.
The discipline that makes this workflow work is refusing to act on a single line of evidence. An expression outlier plus a genotype mismatch plus a plate-map anomaly is a case. Any one of them alone is a question.
Common Mistakes and Limitations
- Treating an expression outlier as proof. Batch effects, cell-type composition shifts, and degraded RNA all move samples in PCA. Relabeling data on clustering evidence alone is how one swap gets replaced by a different error.
- Treating a normal-looking PCA as clearance. Samples from different donors with similar tissue and condition can cluster together, especially in homogeneous designs. Passing the screen does not certify identity, which is why cohort-level genotype checking matters for high-stakes studies.
- Confusing contamination with swaps. A 5 percent foreign-allele fraction at homozygous sites is a contamination signature, not a swap. Applying swap remedies (relabeling) to a contamination problem leaves the real issue untouched.
- Relying on sex markers as the only check. Sex markers catch gross errors in mixed-sex cohorts and nothing else. Same-sex swaps, same-patient tissue swaps, and swaps within a condition all sail past them.
- Ignoring coverage reality on degraded samples. Identity methods lose power as coverage and quality fall. Expect degraded calls to be less confident, confirm borderline cases with a second method, and remember that the demonstrated floor for reliable identification from low-quality RNA was twenty million reads in the SMaSH validation [1].
- Applying human tools to non-human data. The SMaSH panel is drawn from the human genome [1]. For other species, an equivalent panel must exist for that organism, otherwise you are limited to matched-DNA concordance, expression screens, and metadata audits.
- Assuming swaps only happen at the bench. Sample sheet errors during demultiplexing, ID collisions in the metadata, and wrong column joins during sample annotation produce swaps that exist only in the analysis. Audit the digital path, not just the wet lab.
- Fixing the label without fixing the cause. Relabeling a swapped sample and moving on leaves the handling failure in place. Trace the physical event, or the next cohort inherits the same problem.
- Skipping the check entirely on small studies. Small cohorts feel safe, but a single swap in a 12-sample experiment can dominate the result precisely because each sample carries so much weight.
A note on scope: these methods detect mismatches between libraries and their claimed identities. Individual project decisions, including whether a borderline sample is fit for a particular analysis, need review by the analysts and study leads responsible for that dataset.
Frequently Asked Questions
Can I detect a sample swap using RNA-seq data alone?
Yes. SNP-panel methods infer genotypes directly from RNA reads, and SMaSH was built and validated to identify matches from RNA-seq data without any matched DNA, including between different omics data types [1]. Expression-based screens also work from RNA alone, but they flag candidates rather than proving identity.
How much sequencing depth does identity checking need?
Enough to see reads across a panel of informative SNPs. In the SMaSH validation, twenty million reads from a fairly low quality RNA-seq sample were sufficient for reliable sample identification, which sits within the range of a typical bulk RNA-seq library [1]. Lower-depth or heavily degraded libraries give weaker evidence and may need confirmation by a second method.
Is a PCA outlier always a sample swap?
No. Batch effects, cell-composition differences, degradation, and genuine biology all produce outliers. Treat a suspicious PCA position as a prompt to run identity checking, not as a verdict.
What is the difference between contamination and a sample swap?
A swap means the library's content comes from the wrong source entirely. Contamination means a small fraction of foreign content is mixed into a correctly labeled library. The genomic pattern differs, with contamination showing a low, consistent foreign-allele fraction at homozygous sites and a swap showing the wrong genotype across nearly all informative sites.
Do sample swap detection methods work for species other than human?
The genotype-panel approach generalizes, but the specific SMaSH panel is drawn from human SNPs [1]. For other organisms, you need either matched DNA for concordance checking, a species-appropriate set of polymorphic markers, or expression and marker-based screens, which are less definitive.
What should I do after a swap is confirmed?
Relabel the affected samples in the metadata, reprocess the affected downstream results, trace the plate-map or sample-sheet event that caused it, and document the evidence and the correction in the project record. If shared or published analyses are affected, notify collaborators with the genotype evidence included.