cfDNA Quality Control#

The qc command has one table-assembly step and three cfDNA feature checks.

  1. QC metrics and scores Parses process reports into qc_summary.tsv and qc_scores.tsv. Run fragment-length step 2 first when the summary should include median fragment length.

  2. Methylation distribution Uses the merged CpG matrix to plot cohort methylation beta-value densities. Interpret this with coverage, M-bias, assay information, and an independently validated conversion control when required; its shape alone is not a sample-quality verdict. Default CFTK processing does not generate CHH/CHG-derived conversion metrics.

  3. Fragment length distribution Uses duplicate-marked BAMs and deepTools bamPEFragmentSize to write raw lengths, per-sample histograms, and a combined cohort plot.

  4. Dinucleotide frequency Requires the reference FASTA and configured fragment settings. This expensive stage is opt-in for cftk run.

cftk --config cftk_init.json qc -s 2 0 1

The beginner workflow uses that order by default. Add step 3 explicitly when needed:

cftk --config cftk_init.json qc -s 3

Expected Output Location#

QC outputs are written under:

<output_dir>/results/2_qc/

Expected Outputs#

QC output contract#

Step

Output location

Files to inspect

qc.0

results/2_qc/

qc_summary.tsv and qc_scores.tsv

qc.1

results/2_qc/1_methylation_distribution/

methylation_distribution.png and methylation_distribution.pdf

qc.2

results/2_qc/2_fragment_length/

fragment_length.<sample>.raw.csv, per-sample histograms, and the combined PNG/PDF

qc.3

results/2_qc/3_dinucleotide_freq/

per-motif intermediate tables plus dinucleotide_freq.png and PDF

The first three visuals below are sanitized observed technical outputs from the documented two-sample example run. The dinucleotide panel is a fixed-seed synthetic illustration because no public-safe QC-step-3 run artifact is available. None of these panels defines a user-facing pass/fail threshold.

Sanitized CFTK QC overview

qc.0 is table-first. This sanitized overview is a rendering of the summary metrics and is useful for orientation; the TSV files remain the authoritative machine-readable outputs.#

Sanitized methylation distribution example

qc.1 reads the merged CpG matrix and writes the methylation-distribution PNG/PDF. The curve must be interpreted with depth, M-bias, and any available independently validated conversion-control evidence.#

Sanitized fragment length example

qc.2 writes raw fragment-length tables and per-sample/combined plots. The two curves are examples, not group-level inference.#

Fixed-seed synthetic dinucleotide frequency example

Synthetic, fixed-seed illustration of the shape of a qc.3 dinucleotide output. It contains no human-derived measurements and is not validation evidence.#