Bead Counts and MFI QC
A Luminex export gives you a number for every well and analyte, and nothing in the file says which of those numbers to trust. This page checks a plate before any curve is fitted. It counts the beads behind each value, separates Median FI from Net MFI, sets the blanks beside the lowest standard, measures how well duplicate wells agree, and reads the two QC samples against the ranges on the kit sheet. The Luminex format page describes the export itself, and Experimental design covers the plate layout and the guidance behind these checks.
The plate and the kit sheet
Section titled “The plate and the kit sheet”The export has one row per well and analyte, with the seven columns of the format page and
an eighth, Bead Region. A blank, eight standards, two QC samples and 32 samples each fill
two adjacent wells. The kit sheet gives every analyte its bead region, its top standard,
the dilution step of the series and the acceptance range of each QC sample.
# drc attaches MASS, so load it before dplyr to keep dplyr's select().suppressPackageStartupMessages({ library(drc) library(dplyr) library(ggplot2) library(readr) library(tidyr)})
options(width = 100)data_dir <- "/opt/data/luminex_synthetic"plate <- read_csv( file.path(data_dir, "luminex_plate_export.csv"), show_col_types = FALSE)kit <- read_csv( file.path(data_dir, "luminex_kit_sheet.csv"), show_col_types = FALSE)well_types <- c("blank", "standard", "QC", "sample")
# The sample name says what a well holds.plate <- plate |> mutate(type = case_when( Sample == "Blank" ~ "blank", startsWith(Sample, "Std") ~ "standard", startsWith(Sample, "QC") ~ "QC", TRUE ~ "sample" )) |> mutate(type = factor(type, levels = well_types))cat(sprintf( "rows: %d, wells: %d, analytes: %d\n", nrow(plate), n_distinct(plate$Well), n_distinct(plate$Analyte)))wells <- plate |> distinct(Well, type) |> count(type, name = "wells")print(as.data.frame(wells), row.names = FALSE)
# Each analyte must sit on the bead region that the kit sheet gives it.regions <- plate |> distinct(Analyte, `Bead Region`) |> left_join(kit, by = c(Analyte = "analyte"))cat(sprintf( "analytes on a bead region the kit sheet does not give: %d\n", sum(regions$`Bead Region` != regions$bead_region)))kit_view <- select(kit, -units, -standard_points)print(as.data.frame(kit_view), row.names = FALSE)
metrics <- list( rows = nrow(plate), wells = n_distinct(plate$Well), region_mismatches = sum(regions$`Bead Region` != regions$bead_region))rows: 516, wells: 86, analytes: 6 type wells blank 2 standard 16 QC 4 sample 64analytes on a bead region the kit sheet does not give: 0 analyte bead_region top_standard dilution_step qc1_low qc1_high qc2_low qc2_high IL-6 19 10000 4 38 72 1120 2080 IL-8 54 10000 4 49 91 1470 2730 TNF-alpha 36 10000 4 31 58 980 1820 IL-10 56 10000 4 24 46 770 1430 IFN-gamma 21 10000 4 56 104 1680 3120 IL-1beta 39 10000 4 21 39 630 1170import jsonimport pathlib
import matplotlib.pyplot as pltimport numpy as npimport pandas as pdfrom matplotlib.colors import LinearSegmentedColormapfrom matplotlib.patches import Rectanglefrom scipy.optimize import least_squares
DATA_DIR = pathlib.Path("/opt/data/luminex_synthetic")WELL_TYPES = ["blank", "standard", "QC", "sample"]
plate = pd.read_csv(DATA_DIR / "luminex_plate_export.csv")kit = pd.read_csv(DATA_DIR / "luminex_kit_sheet.csv")
def well_type(sample): """Name the kind of well from its sample name.
Args: sample: A value of the Sample column, such as Blank, Std3 or Sample_07.
Returns: "blank", "standard", "QC" or "sample". """ if sample == "Blank": return "blank" if sample.startswith("Std"): return "standard" if sample.startswith("QC"): return "QC" return "sample"
plate["type"] = pd.Categorical( plate["Sample"].map(well_type), categories=WELL_TYPES)print( f"rows: {len(plate)}, wells: {plate['Well'].nunique()}, " f"analytes: {plate['Analyte'].nunique()}")wells = plate.drop_duplicates("Well")["type"].value_counts(sort=False)print(wells.rename("wells").to_frame().to_string())
# Each analyte must sit on the bead region that the kit sheet gives it.regions = plate.drop_duplicates("Analyte").merge( kit, left_on="Analyte", right_on="analyte")region_mismatches = int( (regions["Bead Region"] != regions["bead_region"]).sum())print( "analytes on a bead region the kit sheet does not give: " f"{region_mismatches}")print(kit.drop(columns=["units", "standard_points"]).to_string(index=False))
metrics = { "rows": len(plate), "wells": int(plate["Well"].nunique()), "region_mismatches": region_mismatches,}rows: 516, wells: 86, analytes: 6 wellstypeblank 2standard 16QC 4sample 64analytes on a bead region the kit sheet does not give: 0 analyte bead_region top_standard dilution_step qc1_low qc1_high qc2_low qc2_high IL-6 19 10000 4 38 72 1120 2080 IL-8 54 10000 4 49 91 1470 2730TNF-alpha 36 10000 4 31 58 980 1820 IL-10 56 10000 4 24 46 770 1430IFN-gamma 21 10000 4 56 104 1680 3120 IL-1beta 39 10000 4 21 39 630 1170The 516 rows are 86 wells read for six analytes. Every analyte sits on the bead region the kit sheet names, and every series starts at 10,000 pg/mL and steps down four-fold. A mismatch in the bead regions would mean that the export and the kit sheet describe different panels.
Median FI and Net MFI
Section titled “Median FI and Net MFI”Median FI is the median reporter fluorescence of the beads of one region in one well.
Net MFI subtracts a background from it. The code checks what that background is, counts
the rows that fall to zero or below, and sets the two blank wells of each analyte beside
Std8, the lowest standard.
# Net MFI is Median FI minus the mean of the blank wells of the analyte.blanks <- plate |> filter(type == "blank") |> group_by(Analyte) |> summarise(blank_mean = mean(`Median FI`), .groups = "drop")net_check <- plate |> left_join(blanks, by = "Analyte") |> mutate(gap = `Net MFI` - (`Median FI` - blank_mean))cat(sprintf( "largest gap between Net MFI and Median FI minus the blank: %.3f\n", max(abs(net_check$gap))))not_positive <- net_check |> filter(`Net MFI` <= 0) |> count(type, name = "rows", .drop = FALSE)cat("rows with Net MFI at or below zero:\n")print(as.data.frame(not_positive), row.names = FALSE)
# The blanks next to the lowest standard, Std8.blank_table <- plate |> filter(Sample %in% c("Blank", "Std8")) |> group_by(Analyte, Sample) |> summarise(mfi = mean(`Median FI`), .groups = "drop") |> pivot_wider(names_from = Sample, values_from = mfi) |> mutate(ratio = Std8 / Blank) |> arrange(match(Analyte, kit$analyte))blank_view <- mutate( blank_table, Blank = round(Blank, 2), Std8 = round(Std8, 2), ratio = round(ratio, 2))print(as.data.frame(blank_view), row.names = FALSE)
metrics$net_mfi_max_gap <- max(abs(net_check$gap))for (i in seq_len(nrow(blank_table))) { key <- gsub("-", "_", tolower(blank_table$Analyte[i])) metrics[[paste0("blank_mean_", key)]] <- blank_table$Blank[i] metrics[[paste0("std8_mean_", key)]] <- blank_table$Std8[i]}metrics$net_mfi_not_positive <- sum(net_check$`Net MFI` <= 0)largest gap between Net MFI and Median FI minus the blank: 0.050rows with Net MFI at or below zero: type rows blank 6 standard 2 QC 0 sample 2 Analyte Blank Std8 ratio IL-6 25.55 36.45 1.43 IL-8 28.30 49.50 1.75 TNF-alpha 23.65 23.20 0.98 IL-10 25.85 58.50 2.26 IFN-gamma 36.20 45.35 1.25 IL-1beta 21.90 25.35 1.16# Net MFI is Median FI minus the mean of the blank wells of the analyte.blank_mean = ( plate[plate["type"] == "blank"].groupby("Analyte")["Median FI"].mean())gap = plate["Net MFI"] - ( plate["Median FI"] - plate["Analyte"].map(blank_mean))print( "largest gap between Net MFI and Median FI minus the blank: " f"{gap.abs().max():.3f}")not_positive = plate[plate["Net MFI"] <= 0]["type"].value_counts(sort=False)print("rows with Net MFI at or below zero:")print(not_positive.rename("rows").to_frame().to_string())
# The blanks next to the lowest standard, Std8.edge = plate[plate["Sample"].isin(["Blank", "Std8"])]blank_table = edge.pivot_table( index="Analyte", columns="Sample", values="Median FI", aggfunc="mean").reindex(kit["analyte"])blank_table["ratio"] = blank_table["Std8"] / blank_table["Blank"]print(blank_table.round(2).to_string())
metrics["net_mfi_max_gap"] = float(gap.abs().max())for analyte, row in blank_table.iterrows(): key = analyte.lower().replace("-", "_") metrics[f"blank_mean_{key}"] = float(row["Blank"]) metrics[f"std8_mean_{key}"] = float(row["Std8"])metrics["net_mfi_not_positive"] = int((plate["Net MFI"] <= 0).sum())largest gap between Net MFI and Median FI minus the blank: 0.050rows with Net MFI at or below zero: rowstypeblank 6standard 2QC 0sample 2Sample Blank Std8 ratioanalyteIL-6 25.55 36.45 1.43IL-8 28.30 49.50 1.75TNF-alpha 23.65 23.20 0.98IL-10 25.85 58.50 2.26IFN-gamma 36.20 45.35 1.25IL-1beta 21.90 25.35 1.16The largest gap is 0.050, the rounding of two values written with one decimal, so Net MFI here is Median FI minus the mean of the two blank wells. Six blank rows, two standard rows and two sample rows have a Net MFI at or below zero. A log scale cannot hold those values. The next page therefore fits its curves to Median FI and lets the bottom of each curve absorb the background.
The blank table shows how far the lowest standard rises above an empty well. For IL-10, Std8 reads 2.26 times its blank. For TNF-alpha it reads 23.20 against a blank of 23.65, a ratio of 0.98. That standard carries no signal, so the bottom of the TNF-alpha curve rests on a point that noise alone placed.
Bead counts
Section titled “Bead counts”Each value in the export is a median over the beads that the instrument counted for that region in that well, and a median of a few beads moves more from well to well than a median of many. The MILLIPLEX tips and tricks guide from Merck recommends counting 50 beads. It adds that Luminex asks for at least 35 beads per region, since fewer can shift the MFI. In one experiment, Maecker et al. 2020 flagged wells below 35 beads and excluded wells below 20. This page flags rows below 35 beads.
min_beads <- 35counts <- plate$`Bead Count`cat(sprintf( "bead count: min %d, median %d, max %d\n", min(counts), as.integer(median(counts)), max(counts)))low <- plate |> filter(`Bead Count` < min_beads)cat(sprintf( "rows below %d beads: %d of %d\n", min_beads, nrow(low), nrow(plate)))print( as.data.frame(select(low, Well, Sample, Analyte, `Bead Count`)), row.names = FALSE)low_wells <- low |> count(Well, Sample, name = "analytes_low") |> arrange(desc(analytes_low), Well)cat(sprintf("wells with at least one low row: %d\n", nrow(low_wells)))print(as.data.frame(low_wells), row.names = FALSE)between <- sum(counts >= min_beads & counts < 50)cat(sprintf("rows from %d to 49 beads: %d\n", min_beads, between))
metrics$low_rows <- nrow(low)metrics$low_wells <- nrow(low_wells)metrics$rows_35_to_49 <- betweenfor (analyte in kit$analyte) { key <- gsub("-", "_", tolower(analyte)) metrics[[paste0("low_rows_", key)]] <- sum(low$Analyte == analyte)}bead count: min 13, median 97, max 150rows below 35 beads: 9 of 516 Well Sample Analyte Bead Count G02 Std6 IL-10 13 G06 Sample_12 IL-6 20 G06 Sample_12 IL-8 17 G06 Sample_12 TNF-alpha 15 G06 Sample_12 IL-10 17 G06 Sample_12 IFN-gamma 16 G06 Sample_12 IL-1beta 18 D07 Sample_17 IFN-gamma 14 E10 Sample_26 IL-6 21wells with at least one low row: 4 Well Sample analytes_low G06 Sample_12 6 D07 Sample_17 1 E10 Sample_26 1 G02 Std6 1rows from 35 to 49 beads: 0MIN_BEADS = 35counts = plate["Bead Count"]print( f"bead count: min {counts.min()}, median {int(counts.median())}, " f"max {counts.max()}")low = plate[plate["Bead Count"] < MIN_BEADS]print(f"rows below {MIN_BEADS} beads: {len(low)} of {len(plate)}")print(low[["Well", "Sample", "Analyte", "Bead Count"]].to_string(index=False))low_wells = ( low.groupby(["Well", "Sample"]).size().rename("analytes_low") .reset_index() .sort_values(["analytes_low", "Well"], ascending=[False, True]))print(f"wells with at least one low row: {len(low_wells)}")print(low_wells.to_string(index=False))between = int(((counts >= MIN_BEADS) & (counts < 50)).sum())print(f"rows from {MIN_BEADS} to 49 beads: {between}")
metrics["low_rows"] = len(low)metrics["low_wells"] = len(low_wells)metrics["rows_35_to_49"] = betweenfor analyte in kit["analyte"]: key = analyte.lower().replace("-", "_") metrics[f"low_rows_{key}"] = int((low["Analyte"] == analyte).sum())bead count: min 13, median 97, max 150rows below 35 beads: 9 of 516Well Sample Analyte Bead Count G02 Std6 IL-10 13 G06 Sample_12 IL-6 20 G06 Sample_12 IL-8 17 G06 Sample_12 TNF-alpha 15 G06 Sample_12 IL-10 17 G06 Sample_12 IFN-gamma 16 G06 Sample_12 IL-1beta 18 D07 Sample_17 IFN-gamma 14 E10 Sample_26 IL-6 21wells with at least one low row: 4Well Sample analytes_low G06 Sample_12 6 D07 Sample_17 1 E10 Sample_26 1 G02 Std6 1rows from 35 to 49 beads: 0Nine of the 516 rows fall below 35 beads, in four wells. Well G06, the second replicate of Sample_12, is short for all six analytes. A whole well short of beads points to the handling of that well rather than to one bead set, and the MILLIPLEX guide lists sample preparation, wash steps and the cleaning of the instrument among the fixes. The other three wells are short for one analyte each: Std6 for IL-10 in G02, Sample_17 for IFN-gamma in D07 and Sample_26 for IL-6 in E10.
No row falls between 35 and 49 beads, so the stricter 50-bead count would flag the same nine rows on this plate. The QC check below and the next page drop these rows and keep the other replicate, which leaves each affected sample and analyte resting on one well.
A plate map of bead counts
Section titled “A plate map of bead counts”A plate map draws the same counts by position, where a problem with an edge, a row or a column of the plate shows up as a pattern.
# One tile per well and analyte. Empty wells stay grey.grid <- expand_grid( row = LETTERS[1:8], column = 1:12, Analyte = kit$analyte) |> mutate(Well = sprintf("%s%02d", row, column))plate_map <- grid |> left_join(select(plate, Well, Analyte, `Bead Count`), by = c("Well", "Analyte")) |> mutate( Analyte = factor(Analyte, levels = kit$analyte), row = factor(row, levels = rev(LETTERS[1:8])) )low_tiles <- filter(plate_map, `Bead Count` < min_beads)
map_plot <- ggplot(plate_map, aes(column, row, fill = `Bead Count`)) + geom_tile(width = 1, height = 1, colour = "white", linewidth = 0.5) + geom_tile( data = low_tiles, width = 1, height = 1, colour = "#d03b3b", linewidth = 0.9 ) + geom_text(data = low_tiles, aes(label = `Bead Count`), size = 2.6, colour = "#0b0b0b") + scale_fill_gradient( low = "#cde2fb", high = "#0d366b", limits = c(0, 150), na.value = "#f0efec", name = "Bead count" ) + scale_x_continuous(breaks = 1:12, expand = c(0, 0)) + facet_wrap(~Analyte, ncol = 3) + coord_fixed() + labs( x = NULL, y = NULL, title = "Bead count per well, red outline below 35 beads" ) + theme_minimal(base_size = 10) + theme(panel.grid = element_blank())dir.create("outputs", showWarnings = FALSE)ggsave( "outputs/luminex-bead-qc_plate_map_r.png", map_plot, width = 9, height = 4.6, dpi = 120, bg = "white")
ROWS = list("ABCDEFGH")blues = LinearSegmentedColormap.from_list("blues", ["#cde2fb", "#0d366b"])blues.set_bad("#f0efec")
figure, axes = plt.subplots(2, 3, figsize=(9, 4.4), layout="constrained")for ax, analyte in zip(axes.flat, kit["analyte"]): subset = plate[plate["Analyte"] == analyte] grid = np.full((8, 12), np.nan) for well, count in zip(subset["Well"], subset["Bead Count"]): grid[ROWS.index(well[0]), int(well[1:]) - 1] = count mesh = ax.pcolormesh(np.ma.masked_invalid(grid), cmap=blues, vmin=0, vmax=150, edgecolors="white", linewidth=0.5) for row, column in zip(*np.nonzero(grid < MIN_BEADS)): ax.add_patch(Rectangle((column, row), 1, 1, fill=False, edgecolor="#d03b3b", linewidth=1.5)) ax.text(column + 0.5, row + 0.5, int(grid[row, column]), ha="center", va="center", fontsize=7, color="#0b0b0b") ax.set_aspect("equal") ax.invert_yaxis() ax.set_title(analyte, fontsize=10) ax.set_xticks(np.arange(12) + 0.5, range(1, 13), fontsize=7) ax.set_yticks(np.arange(8) + 0.5, ROWS, fontsize=7) ax.tick_params(length=0) ax.spines[:].set_visible(False)figure.colorbar(mesh, ax=axes, shrink=0.8, label="Bead count")figure.suptitle("Bead count per well, red outline below 35 beads", x=0.02, ha="left")pathlib.Path("outputs").mkdir(exist_ok=True)figure.savefig("outputs/luminex-bead-qc_plate_map_python.png", dpi=120)
The four short wells sit in columns 2, 6, 7 and 10, and no edge or column holds a run of low counts. G06 is the one well that is short in every panel, which is the pattern a single bad well leaves.
Duplicate CVs
Section titled “Duplicate CVs”Every sample fills two wells, so each pair gives a coefficient of variation: the standard deviation of the two Median FI values over their mean. The MILLIPLEX guide targets a CV below 15% for the standard points and for the samples within one assay. The blanks stay out, since the CV of noise around a background tells you nothing.
max_cv <- 15pairs <- plate |> filter(type != "blank") |> group_by(type, Sample, Analyte) |> summarise( mean_mfi = mean(`Median FI`), cv = 100 * sd(`Median FI`) / mean(`Median FI`), low_beads = any(`Bead Count` < min_beads), .groups = "drop" )cv_summary <- pairs |> group_by(type) |> summarise( pairs = n(), median_cv = median(cv), over_15 = sum(cv > max_cv), .groups = "drop" )print(as.data.frame(cv_summary), row.names = FALSE, digits = 3)high_cv <- pairs |> filter(cv > max_cv) |> arrange(desc(cv))print(as.data.frame(high_cv), row.names = FALSE, digits = 3)low_pairs <- filter(pairs, low_beads)cat(sprintf( "pairs with a well below %d beads: %d, over %d%%: %d\n", min_beads, nrow(low_pairs), max_cv, sum(low_pairs$cv > max_cv)))metrics$low_bead_pairs <- nrow(low_pairs)metrics$low_bead_pairs_over_15 <- sum(low_pairs$cv > max_cv)
for (i in seq_len(nrow(cv_summary))) { key <- tolower(cv_summary$type[i]) metrics[[paste0("pairs_", key)]] <- cv_summary$pairs[i] metrics[[paste0("median_cv_", key)]] <- cv_summary$median_cv[i] metrics[[paste0("over_15_", key)]] <- cv_summary$over_15[i]} type pairs median_cv over_15 standard 48 4.33 4 QC 12 3.99 0 sample 192 4.31 14 type Sample Analyte mean_mfi cv low_beads sample Sample_12 IL-8 359.4 29.8 TRUE sample Sample_02 IL-1beta 21.5 27.6 FALSE sample Sample_31 IL-1beta 46.1 24.5 FALSE sample Sample_18 IL-10 38.5 21.9 FALSE sample Sample_26 TNF-alpha 222.9 21.6 FALSE sample Sample_14 IL-10 172.9 21.3 FALSE standard Std8 IL-1beta 25.4 19.2 FALSE sample Sample_11 IL-6 358.8 19.0 FALSE sample Sample_18 IL-6 677.4 18.9 FALSE sample Sample_13 IL-1beta 39.8 18.5 FALSE sample Sample_28 IL-8 730.1 17.8 FALSE sample Sample_24 TNF-alpha 212.7 17.8 FALSE standard Std8 TNF-alpha 23.2 17.7 FALSE sample Sample_03 IL-1beta 28.8 16.7 FALSE sample Sample_16 IL-1beta 257.4 16.4 FALSE sample Sample_14 IL-8 188.8 15.6 FALSE standard Std6 IL-10 403.4 15.5 TRUE standard Std7 IL-1beta 46.2 15.1 FALSEpairs with a well below 35 beads: 9, over 15%: 2MAX_CV = 15
def count_over_limit(cv): """Count the duplicate CVs above the limit.
Args: cv: CVs in percent.
Returns: The number of CVs above MAX_CV. """ return int((cv > MAX_CV).sum())
replicates = plate[plate["type"] != "blank"].assign( low_beads=plate["Bead Count"] < MIN_BEADS)groups = replicates.groupby(["type", "Sample", "Analyte"], observed=True)pairs = groups.agg( mean_mfi=("Median FI", "mean"), sd_mfi=("Median FI", "std"), low_beads=("low_beads", "any"),).reset_index()pairs["cv"] = 100 * pairs["sd_mfi"] / pairs["mean_mfi"]cv_summary = pairs.groupby("type", observed=True).agg( pairs=("cv", "size"), median_cv=("cv", "median"), over_15=("cv", count_over_limit),)print(cv_summary.round(2).to_string())high_cv = pairs[pairs["cv"] > MAX_CV].sort_values("cv", ascending=False)columns = ["type", "Sample", "Analyte", "mean_mfi", "cv", "low_beads"]print(high_cv[columns].round(1).to_string(index=False))low_pairs = pairs[pairs["low_beads"]]low_over = count_over_limit(low_pairs["cv"])print( f"pairs with a well below {MIN_BEADS} beads: {len(low_pairs)}, " f"over {MAX_CV}%: {low_over}")metrics["low_bead_pairs"] = len(low_pairs)metrics["low_bead_pairs_over_15"] = low_over
for kind, row in cv_summary.iterrows(): key = kind.lower() metrics[f"pairs_{key}"] = int(row["pairs"]) metrics[f"median_cv_{key}"] = float(row["median_cv"]) metrics[f"over_15_{key}"] = int(row["over_15"]) pairs median_cv over_15typestandard 48 4.33 4QC 12 3.99 0sample 192 4.31 14 type Sample Analyte mean_mfi cv low_beads sample Sample_12 IL-8 359.4 29.8 True sample Sample_02 IL-1beta 21.5 27.6 False sample Sample_31 IL-1beta 46.1 24.5 False sample Sample_18 IL-10 38.4 21.9 False sample Sample_26 TNF-alpha 223.0 21.6 False sample Sample_14 IL-10 173.0 21.3 Falsestandard Std8 IL-1beta 25.4 19.2 False sample Sample_11 IL-6 358.8 19.0 False sample Sample_18 IL-6 677.4 18.9 False sample Sample_13 IL-1beta 39.8 18.5 False sample Sample_28 IL-8 730.1 17.8 False sample Sample_24 TNF-alpha 212.6 17.8 Falsestandard Std8 TNF-alpha 23.2 17.7 False sample Sample_03 IL-1beta 28.8 16.7 False sample Sample_16 IL-1beta 257.4 16.4 False sample Sample_14 IL-8 188.8 15.6 Falsestandard Std6 IL-10 403.4 15.5 Truestandard Std7 IL-1beta 46.2 15.1 Falsepairs with a well below 35 beads: 9, over 15%: 2The median CV is 4.33% for the standards, 3.99% for the QC samples and 4.31% for the samples. Four of 48 standard pairs and 14 of 192 sample pairs exceed 15%, and most of them sit at a low signal. The IL-1beta pair of Sample_02 has a mean MFI of 21.5 and a CV of 27.6%, and Std8 of IL-1beta and of TNF-alpha make the list too. The generator adds the same reader noise to every well, and at an MFI near 20 that noise is a large share of the value.
The bead check and the CV check catch different wells. Sample_12 for IL-8 has the highest CV, 29.8%, and one of its wells counted 17 beads. Only 2 of the 9 pairs with a short well exceed 15%, though, so a CV filter alone would keep seven pairs that include a well with fewer than 35 beads.
The QC samples against the kit ranges
Section titled “The QC samples against the kit ranges”QC1 and QC2 are samples of known concentration that come with the kit, each with an acceptance range. Checking them takes concentrations, so this block fits a five-parameter logistic curve to the standards of each analyte and reads the QC wells off it. The next page explains the fit. The plate is synthetic, so the table also shows the true QC concentrations.
#' Fit a five-parameter log-logistic curve to the log of the MFI.#'#' @param standards A data frame with the columns conc and mfi.#' @return The drc parameters b, c, d, e and f as a named vector.FitFivePl <- function(standards) { start <- c( -1, min(standards$mfi), max(standards$mfi), median(standards$conc), 1 ) first <- drm( mfi ~ conc, data = standards, fct = LL.5(), bcVal = 0, start = start, control = drmc(relTol = 1e-12, maxIt = 5000) ) # BFGS can stop short where the curve is flat. A Nelder-Mead pass from # its estimates finishes the search. final <- drm( mfi ~ conc, data = standards, fct = LL.5(), bcVal = 0, start = coef(first), control = drmc(method = "Nelder-Mead", relTol = 1e-15, maxIt = 20000) ) setNames(coef(final), c("b", "c", "d", "e", "f"))}
#' Turn an MFI into a concentration with a fitted five-parameter curve.#'#' @param mfi Median FI values.#' @param p Parameters from FitFivePl.#' @return Concentrations in pg/mL. NA where the MFI is outside the two#' asymptotes, where the curve has no inverse.BackCalculate <- function(mfi, p) { conc <- rep(NA_real_, length(mfi)) inside <- mfi > p[["c"]] & mfi < p[["d"]] ratio <- ((p[["d"]] - p[["c"]]) / (mfi[inside] - p[["c"]]))^(1 / p[["f"]]) conc[inside] <- p[["e"]] * (ratio - 1)^(1 / p[["b"]]) conc}
kept <- filter(plate, `Bead Count` >= min_beads)qc_rows <- list()for (analyte in kit$analyte) { standards <- kept |> filter(type == "standard", Analyte == analyte) |> transmute(conc = 10000 / `Dilution Factor`, mfi = `Median FI`) p <- FitFivePl(standards) ranges <- filter(kit, analyte == .env$analyte) qc <- kept |> filter(type == "QC", Analyte == analyte) |> group_by(Sample) |> summarise(mfi = mean(`Median FI`), .groups = "drop") |> mutate( Analyte = analyte, conc = BackCalculate(mfi, p), low = c(ranges$qc1_low, ranges$qc2_low), high = c(ranges$qc1_high, ranges$qc2_high), in_range = conc >= low & conc <= high ) qc_rows[[analyte]] <- qc}# The plate is synthetic, so the true QC concentrations are known.truth <- read_csv( file.path(data_dir, "luminex_truth_concentrations.csv"), show_col_types = FALSE) |> select(Analyte = analyte, Sample = sample, true = true_concentration_pg_ml)qc_table <- bind_rows(qc_rows) |> left_join(truth, by = c("Analyte", "Sample")) |> select(Analyte, Sample, mfi, conc, true, low, high, in_range)print(as.data.frame(qc_table), row.names = FALSE, digits = 4)cat(sprintf( "QC results inside the kit range: %d of %d\n", sum(qc_table$in_range), nrow(qc_table)))
for (i in seq_len(nrow(qc_table))) { key <- gsub("-", "_", tolower(qc_table$Analyte[i])) name <- paste0(tolower(qc_table$Sample[i]), "_conc_", key) metrics[[name]] <- qc_table$conc[i]}metrics$qc_in_range <- sum(qc_table$in_range)jsonlite::write_json( metrics, "outputs/luminex_bead_qc_metrics_r.json", auto_unbox = TRUE, digits = NA) Analyte Sample mfi conc true low high in_range IL-6 QC1 1046.7 51.14 55 38 72 TRUE IL-6 QC2 14699.4 2270.76 1600 1120 2080 FALSE IL-8 QC1 1622.5 74.36 70 49 91 TRUE IL-8 QC2 18590.6 2437.44 2100 1470 2730 TRUE TNF-alpha QC1 836.5 50.02 45 31 58 TRUE TNF-alpha QC2 11713.3 1367.08 1400 980 1820 TRUE IL-10 QC1 1209.8 35.78 35 24 46 TRUE IL-10 QC2 12087.5 1948.09 1100 770 1430 FALSE IFN-gamma QC1 957.5 84.28 80 56 104 TRUE IFN-gamma QC2 11512.5 2588.02 2400 1680 3120 TRUE IL-1beta QC1 510.7 30.10 30 21 39 TRUE IL-1beta QC2 11031.9 1089.24 900 630 1170 TRUEQC results inside the kit range: 10 of 12def five_pl(conc, params): """Evaluate the drc LL.5 curve.
Args: conc: Concentrations in pg/mL. params: The parameters b, c, d, e and f.
Returns: The MFI that the curve predicts. """ b, c, d, e, f = params return c + (d - c) / (1 + np.exp(b * (np.log(conc) - np.log(e)))) ** f
def log_residuals(params, conc, mfi): """Residuals of the curve on the log scale of the MFI.
Args: params: The parameters b, c, d, e and f. conc: Concentrations of the standards. mfi: Median FI of the standards.
Returns: log(mfi) minus the log of the curve. """ return np.log(mfi) - np.log(five_pl(conc, params))
def fit_five_pl(conc, mfi): """Fit the five-parameter curve to the log of the MFI.
Args: conc: Concentrations of the standards. mfi: Median FI of the standards.
Returns: The fitted parameters b, c, d, e and f as an array. """ start = [-1, mfi.min(), mfi.max(), np.median(conc), 1] fit = least_squares(log_residuals, start, args=(conc, mfi), xtol=1e-15, ftol=1e-15, gtol=1e-15) return fit.x
def back_calculate(mfi, params): """Turn an MFI into a concentration with a fitted five-parameter curve.
Args: mfi: Median FI values. params: The parameters from fit_five_pl.
Returns: Concentrations in pg/mL. NaN where the MFI is outside the two asymptotes, where the curve has no inverse. """ b, c, d, e, f = params mfi = np.asarray(mfi, dtype=float) conc = np.full(mfi.shape, np.nan) inside = (mfi > c) & (mfi < d) ratio = ((d - c) / (mfi[inside] - c)) ** (1 / f) conc[inside] = e * (ratio - 1) ** (1 / b) return conc
kept = plate[plate["Bead Count"] >= MIN_BEADS]qc_rows = []for _, ranges in kit.iterrows(): analyte = ranges["analyte"] rows = kept[kept["Analyte"] == analyte] standards = rows[rows["type"] == "standard"] params = fit_five_pl( 10000 / standards["Dilution Factor"].to_numpy(), standards["Median FI"].to_numpy(), ) qc = rows[rows["type"] == "QC"].groupby("Sample")["Median FI"].mean() qc = qc.rename("mfi").reset_index() qc.insert(0, "Analyte", analyte) qc["conc"] = back_calculate(qc["mfi"], params) qc["low"] = [ranges["qc1_low"], ranges["qc2_low"]] qc["high"] = [ranges["qc1_high"], ranges["qc2_high"]] qc["in_range"] = (qc["conc"] >= qc["low"]) & (qc["conc"] <= qc["high"]) qc_rows.append(qc)# The plate is synthetic, so the true QC concentrations are known.truth = pd.read_csv(DATA_DIR / "luminex_truth_concentrations.csv").rename( columns={"analyte": "Analyte", "sample": "Sample", "true_concentration_pg_ml": "true"})qc_table = pd.concat(qc_rows, ignore_index=True).merge( truth[["Analyte", "Sample", "true"]], on=["Analyte", "Sample"])qc_columns = ["Analyte", "Sample", "mfi", "conc", "true", "low", "high", "in_range"]print(qc_table[qc_columns].round(2).to_string(index=False))print( f"QC results inside the kit range: {int(qc_table['in_range'].sum())} " f"of {len(qc_table)}")
for _, row in qc_table.iterrows(): key = row["Analyte"].lower().replace("-", "_") metrics[f"{row['Sample'].lower()}_conc_{key}"] = float(row["conc"])metrics["qc_in_range"] = int(qc_table["in_range"].sum())pathlib.Path("outputs/luminex_bead_qc_metrics_python.json").write_text( json.dumps(metrics, indent=2) + "\n") Analyte Sample mfi conc true low high in_range IL-6 QC1 1046.70 51.14 55.0 38 72 True IL-6 QC2 14699.35 2270.76 1600.0 1120 2080 False IL-8 QC1 1622.45 74.36 70.0 49 91 True IL-8 QC2 18590.55 2437.44 2100.0 1470 2730 TrueTNF-alpha QC1 836.50 50.02 45.0 31 58 TrueTNF-alpha QC2 11713.35 1367.08 1400.0 980 1820 True IL-10 QC1 1209.75 35.78 35.0 24 46 True IL-10 QC2 12087.55 1948.09 1100.0 770 1430 FalseIFN-gamma QC1 957.55 84.28 80.0 56 104 TrueIFN-gamma QC2 11512.50 2588.02 2400.0 1680 3120 True IL-1beta QC1 510.65 30.10 30.0 21 39 True IL-1beta QC2 11031.90 1089.24 900.0 630 1170 TrueQC results inside the kit range: 10 of 12Ten of the twelve QC results fall inside their kit ranges. QC2 reads 2270.76 pg/mL for IL-6 against an upper limit of 2,080 and a true value of 1,600, and 1948.09 pg/mL for IL-10 against 1,430 and 1,100. Both have an MFI above 12,000, in the upper part of the curve where the MFI rises slowly with concentration, so a few percent of error in MFI turns into a far larger error in concentration. On a real plate, a QC outside its range says that results for that analyte near that concentration are less accurate than the kit claims.
How these checks fail
Section titled “How these checks fail”Counting low rows hides a failed well. G06 is one problem that shows up as six rows, and the right response is to drop the well for every analyte. On this plate both rules agree, because all six rows of G06 fall below 35 beads, but on another plate a failing well could still clear 35 for some regions.
A log transform applied before these checks loses rows without an error. Rows with a Net
MFI at or below zero become NaN under log(), with no more than a warning in R or NumPy.
A standard at the level of the blank, such as TNF-alpha’s Std8, still enters the fit as a
measured point. The next page sets the
limits of quantification from the standards and shows what happens to values outside them.
The code for this page is in benchtoinsights-code/guides/proteomics/luminex-bead-qc/, and
its parity.json lists the values that the two languages must agree on.
Scientific references
Section titled “Scientific references”The drc package by Ritz and Streibig fits dose-response models in R.
Further reading
Section titled “Further reading”Section 5.1 of the Bio-Plex 200 hardware manual lists causes of low bead counts, incorrect bead selection, and absent assay signal. Use it to connect a failed plate check with the instrument or preparation record. The manual concerns that reader; the synthetic kit thresholds on this page do not define acceptance limits for other assays.