Audit identification confidence
A spectrum match, a peptide sequence, and a protein group are different hypotheses. Their counts differ, their evidence overlaps, and their error rates require separate definitions. Repeated spectra from one peptide cannot be counted as independent protein evidence.
The primary workflow preserves the accepted identification records and their score metadata. This lesson uses those fresh records to inspect filtering at each reported level.
Name the hypothesis before the threshold
Section titled “Name the hypothesis before the threshold”| Level | Hypothesis | Duplicate measurements |
|---|---|---|
| Peptide-spectrum match | A particular spectrum supports a candidate peptide. | Several spectra can support the same peptide. |
| Peptidoform | A sequence has a declared modification state. | Charge states and repeated spectra can represent the same peptidoform. |
| Peptide sequence | An unmodified amino acid sequence is present. | Different peptidoforms can share that sequence. |
| Protein group | The peptide evidence supports the declared group of accessions. | Group members can share the same evidence. |
The selected workflow applies per-run filtering before its experiment-wide PSM and protein steps. We preserve the exact score names, score directions, and filtering order. A column named score is not enough to identify the hypothesis or its error interpretation.
The configured 0.01 thresholds do not automatically establish peptide-level control. Unless the accepted output records a peptide-level procedure, the lesson reports peptide counts without claiming a peptide q-value threshold.
Read a q-value at its reported level
Section titled “Read a q-value at its reported level”A q-value describes the minimum estimated false discovery rate at which a result enters the accepted set under that procedure. It is not the posterior probability that the individual result is wrong. Percolator can also report posterior error probabilities, but those values answer a different question.
The target-decoy comparison depends on the search space and competition procedure. We inspect the executed OpenMS and Percolator commands instead of treating a requested parameter as proof that the corresponding option ran.
A post-filtered table cannot reconstruct the complete score distribution before filtering. If only accepted records remain, a target-decoy plot must state that boundary. The preserved process evidence supplies the appropriate earlier records where the workflow retains them.
Preserve protein-group membership
Section titled “Preserve protein-group membership”The result retains every accession in a group. A representative accession is useful for display, but it does not turn an ambiguous group into an independently measured protein.
Peptide support uses unmodified sequence identities. Multiple charge states or modified forms of one sequence do not satisfy a two-sequence requirement. A group-unique peptide can map to several proteins within one indistinguishable group, provided it does not also support another group.
Potential contaminants and decoys remain separate flags. A mixed group that includes a potential contaminant requires conservative treatment before biological interpretation. The exclusion table records the full group and its reason instead of deleting a name without a trace.
Keep differential error control separate
Section titled “Keep differential error control separate”Identification acceptance determines which measurements have enough sequence evidence to enter later analysis. Differential abundance then tests condition coefficients among an explicitly eligible set of protein groups.
The differential BH adjustment belongs to that second family of hypotheses. It does not repair a mistaken sequence assignment, and a protein identification q-value does not replace the differential p-value. Continue with sample quality and normalization after the identification record passes its checks.
Audit the accepted group records
Section titled “Audit the accepted group records”The sequential counts below apply to the final exported groups. They do not reconstruct the search population before target-decoy filtering. The score histogram likewise describes final group q-values, and each group counts once regardless of its number of members.
Interpret this cohort
Section titled “Interpret this cohort”The export retains 2005 protein groups, including 92 groups with multiple accessions. The declared support filter retains 1166 noncontaminant target groups.
These counts describe retained export records. They do not estimate the number of distinct proteins measured independently.
library(ggplot2)library(jsonlite)source("/shared/ms_common.R")
data <- LoadMsData()groups <- data$groupsq_value <- as.numeric(groups$protein_q_value)member_count <- as.integer(groups$member_count)stopifnot(all(is.finite(q_value)), all(q_value >= 0 & q_value <= 1))stopifnot(identical(groups$identification_pass, q_value <= 0.01))identified <- groups$identification_passtarget <- identified & !groups$is_decoyclean <- target & !groups$is_contaminantsupported <- clean & groups$unique_peptide_count >= 2Lstages <- data.frame( stage = c("Exported groups", "Identification threshold", "Target groups", "Without potential contaminants", "Two unique peptides"), groups = c(nrow(groups), sum(identified), sum(target), sum(clean), sum(supported)))write.csv(stages, "outputs/identification_stages_r.csv", row.names = FALSE)record <- data.frame( group_id = groups$group_id, members = groups$members, protein_q_value = q_value, member_count = member_count, unique_peptide_count = groups$unique_peptide_count, is_decoy = groups$is_decoy, is_contaminant = groups$is_contaminant, identification_pass = identified, support_pass = supported)write.csv(record, "outputs/group_evidence_r.csv", row.names = FALSE)metrics <- list(exported_groups = nrow(groups), identified_groups = sum(identified), supported_target_groups = sum(supported), ambiguous_groups = sum(member_count > 1L), potential_contaminant_groups = sum(groups$is_contaminant))write_json(metrics, "outputs/metrics_r.json", auto_unbox = TRUE)cat("Final exported protein groups:", metrics$exported_groups, "\n")cat("Supported noncontaminant target groups:", metrics$supported_target_groups, "\n")cat("Groups with multiple accessions:", metrics$ambiguous_groups, "\n")Final exported protein groups: 2005Supported noncontaminant target groups: 1166Groups with multiple accessions: 92stages$stage <- factor(stages$stage, levels = rev(stages$stage))retention <- ggplot(stages, aes(groups, stage)) + geom_col(fill = "#286b86") + geom_text(aes(label = groups), hjust = -0.15) + scale_x_continuous(expand = expansion(mult = c(0, 0.15))) + labs(x = "Protein groups", y = NULL, title = "Sequential decisions within the final export") + theme_minimal(base_size = 11)ggsave("outputs/identification_retention_r.png", retention, width = 9, height = 4.5, dpi = 160, bg = "white")score <- ggplot(record, aes(protein_q_value, fill = is_contaminant)) + geom_histogram(bins = 30, position = "stack") + scale_fill_manual(values = c("#286b86", "#b85c38")) + labs(x = "Final protein-group q-value", y = "Groups", fill = "Potential contaminant", title = "Scores after primary filtering") + theme_minimal(base_size = 11)ggsave("outputs/identification_scores_r.png", score, width = 8, height = 4.5, dpi = 160, bg = "white")

import importlib.utilimport jsonfrom pathlib import Path
import matplotlib.pyplot as pltimport numpy as npimport pandas as pd
spec = importlib.util.spec_from_file_location("ms", "/shared/ms_common.py")ms = importlib.util.module_from_spec(spec)spec.loader.exec_module(ms)data = ms.load_ms_data()groups = data["groups"]q_value = pd.to_numeric(groups["protein_q_value"], errors="raise")member_count = pd.to_numeric(groups["member_count"], errors="raise")assert np.isfinite(q_value).all() and q_value.between(0, 1).all()identified = groups["identification_pass"]assert identified.eq(q_value.le(0.01)).all()target = identified & ~groups["is_decoy"]clean = target & ~groups["is_contaminant"]supported = clean & groups["unique_peptide_count"].ge(2)stages = pd.DataFrame({ "stage": ["Exported groups", "Identification threshold", "Target groups", "Without potential contaminants", "Two unique peptides"], "groups": [len(groups), identified.sum(), target.sum(), clean.sum(), supported.sum()],})record = pd.DataFrame({ "group_id": groups["group_id"], "members": groups["members"], "protein_q_value": q_value, "member_count": member_count, "unique_peptide_count": groups["unique_peptide_count"], "is_decoy": groups["is_decoy"], "is_contaminant": groups["is_contaminant"], "identification_pass": identified, "support_pass": supported,})for name, frame in [("identification_stages", stages), ("group_evidence", record)]: frame.to_csv(f"outputs/{name}_python.csv", index=False) expected = pd.read_csv(f"outputs/{name}_r.csv") pd.testing.assert_frame_equal(frame, expected, check_dtype=False, rtol=1e-12, atol=1e-12)metrics = { "exported_groups": len(groups), "identified_groups": int(identified.sum()), "supported_target_groups": int(supported.sum()), "ambiguous_groups": int(member_count.gt(1).sum()), "potential_contaminant_groups": int(groups["is_contaminant"].sum()),}Path("outputs/metrics_python.json").write_text(json.dumps(metrics, indent=2))print("Final exported protein groups:", metrics["exported_groups"])print("Supported noncontaminant target groups:", metrics["supported_target_groups"])print("Groups with multiple accessions:", metrics["ambiguous_groups"])Final exported protein groups: 2005Supported noncontaminant target groups: 1166Groups with multiple accessions: 92figure, axis = plt.subplots(figsize=(9, 4.5))axis.barh(stages["stage"], stages["groups"], color="#286b86")for index, count in enumerate(stages["groups"]): axis.text(count, index, f" {count}", va="center")axis.invert_yaxis()axis.set_xlim(0, stages["groups"].max() * 1.15)axis.set_xlabel("Protein groups")axis.set_title("Sequential decisions within the final export")figure.tight_layout()figure.savefig("outputs/identification_retention_python.png", dpi=160, facecolor="white")plt.close(figure)figure, axis = plt.subplots(figsize=(8, 4.5))values = [q_value.loc[~groups["is_contaminant"]], q_value.loc[groups["is_contaminant"]]]axis.hist(values, bins=30, stacked=True, color=["#286b86", "#b85c38"], label=["No", "Yes"])axis.set_xlabel("Final protein-group q-value")axis.set_ylabel("Groups")axis.set_title("Scores after primary filtering")axis.legend(title="Potential contaminant")figure.tight_layout()figure.savefig("outputs/identification_scores_python.png", dpi=160, facecolor="white")plt.close(figure)

Further reading
Section titled “Further reading”The pinned OpenMS ProteomicsLFQ implementation declares separate sub-protein and protein FDR options, protein inference methods, and peptide restrictions for quantification. These options explain why a threshold needs a stated hypothesis level.
The quantms 1.10.0 usage guide describes the SDRF sample metadata, sequence database, and workflow inputs. Consult it when tracing the accepted identification records back to the primary analysis.