Configuration Reference¶
Complete reference for config.json structure and customization.
Overview¶
MucOneUp requires a JSON configuration file specifying:
- Repeat definitions - DNA sequences for each repeat symbol
- Flanking constants - Left/right regions surrounding VNTR
- Probability transitions - State transitions for repeat selection
- Length model - Distribution parameters for VNTR lengths
- Mutation definitions - Named mutations with operations
- Tool paths - External tools for read simulation
- Simulation parameters - Platform-specific read simulation settings
Location: Repository root contains config.json (example configuration).
File Structure¶
{
"repeats": { ... },
"constants": { ... },
"probabilities": { ... },
"length_model": { ... },
"mutations": { ... },
"tools": { ... },
"read_simulation": { ... },
"nanosim_params": { ... },
"pacbio_params": { ... },
"ont_amplicon_params": { ... },
"amplicon_params": { ... }
}
Repeats Section¶
Purpose¶
Defines DNA sequences for each repeat symbol used in VNTR chains.
Structure¶
{
"repeats": {
"1": "GCCCCACCCCTCCTCCCGCCGCGCCG",
"2": "GCTCCACCCCTTCTCCCACCGCGCCG",
"3": "GCCCCACCCCTTCTCCCACCGCGCCG",
"X": "GCCCCACCCCTCCTCCCGCCGCGCCG",
"A": "GCTCCACCCCTTCTCCCACCGCGCCG",
"B": "GCCCCACCCCTTCTCCCACCGCGCCG",
"C": "GCCCCACCCCTCTTCCCGCCGCGCCG",
"6": "GCCCCACCCCTCCTCCCGCCGCGCCG",
"6p": "GCTCCACCCCTTCTCCCACCGCGCCG",
"7": "GCCCCACCCCTTCTCCCACCGCGCCG",
"8": "GCCCCACCCCTCCTCCCGCCGCGCCG",
"9": "GCTCCACCCCTTCTCCCACCGCGCCG"
}
}
Rules¶
- Key: Repeat symbol (string, typically 1-2 characters)
- Value: DNA sequence (uppercase ACGT)
- Terminal block required: Must define 6 or 6p, 7, 8, 9
- Validation: Sequences validated on load (must be valid DNA)
Example: Custom Repeat¶
{
"repeats": {
"CUSTOM": "ATCGATCGATCGATCGATCGATCGAT"
},
"probabilities": {
"1": {"CUSTOM": 0.2, "2": 0.8}
}
}
Constants Section¶
Purpose¶
Defines left and right flanking regions surrounding the VNTR, assembly-specific.
Structure (Nested Format)¶
{
"constants": {
"hg19": {
"left": "AGCAGGCAGTGCGGGGCCGCTGCTGCTG...",
"right": "TGCTGCTGCTGCGGGGCCGCTGCTGCTG...",
"vntr_region": "chr1:155158000-155165000"
},
"hg38": {
"left": "AGCAGGCAGTGCGGGGCCGCTGCTGCTG...",
"right": "TGCTGCTGCTGCGGGGCCGCTGCTGCTG...",
"vntr_region": "chr1:155185824-155192916"
}
}
}
Structure (Flat Format, Auto-Converted)¶
{
"constants": {
"left": "AGCAGGCAGTGCGGGGCCGCTGCTGCTG...",
"right": "TGCTGCTGCTGCGGGGCCGCTGCTGCTG...",
"vntr_region": "chr1:155158000-155165000"
}
}
Note: Flat format assumed to be hg38 and auto-converted to nested format.
Fields¶
| Field | Type | Description |
|---|---|---|
left |
string | DNA sequence upstream of VNTR |
right |
string | DNA sequence downstream of VNTR |
vntr_region |
string | VNTR genomic coordinates (e.g., "chr1:155185824-155192916") |
Assembly-Specific Constants¶
MUC1 genomic coordinates differ between assemblies:
| Assembly | Chromosome | Start | End |
|---|---|---|---|
| hg19 | chr1 | 155,158,000 | 155,165,000 |
| hg38 | chr1 | 155,185,824 | 155,192,916 |
Ensure left and right constants match your chosen assembly.
Probabilities Section¶
Purpose¶
State transition probabilities for repeat selection during chain generation.
Structure¶
{
"probabilities": {
"1": {"2": 0.3, "3": 0.2, "X": 0.5},
"2": {"1": 0.2, "3": 0.3, "A": 0.5},
"3": {"1": 0.1, "2": 0.4, "X": 0.5},
"X": {"A": 0.4, "B": 0.4, "X": 0.2},
"A": {"B": 0.5, "X": 0.3, "A": 0.2},
"B": {"A": 0.4, "X": 0.4, "B": 0.2},
"C": {"X": 0.6, "A": 0.4}
}
}
Rules¶
- Outer key: Source repeat symbol
- Inner key: Destination repeat symbol
- Value: Transition probability (0.0 to 1.0)
- Sum: Inner values should sum to 1.0 (normalized automatically if not)
Example¶
From repeat 1, transitions:
- To
2with 30% probability - To
3with 20% probability - To
Xwith 50% probability
Customizing Probabilities¶
From Real Data:
# Analyze VNTR database
muconeup --config config.json analyze vntr-stats \
data/examples/vntr_database.tsv \
--header \
-o observed_probs.json
# Extract transitions
jq '.transition_probabilities' observed_probs.json
# Update config.json
Manual Specification:
Length Model Section¶
Purpose¶
Distribution parameters for sampling VNTR repeat counts.
Normal Distribution¶
{
"length_model": {
"distribution": "normal",
"mean_repeats": 63.3,
"median_repeats": 70,
"min_repeats": 42,
"max_repeats": 85
}
}
Behavior:
- Sample from normal distribution (μ=63.3, σ derived from median)
- Clip to [42, 85] range
Fields¶
| Field | Type | Description | Required |
|---|---|---|---|
distribution |
string | Must be "normal" | Yes |
mean_repeats |
float | Mean for normal distribution | If normal |
median_repeats |
float | Informational only; not used for sampling | No |
min_repeats |
integer | Minimum repeat count (at least 10) | Yes |
max_repeats |
integer | Maximum repeat count (at least 10) | Yes |
Mutations Section¶
Purpose¶
Define named mutations with operations (insert/delete/replace/delete_insert).
Structure¶
{
"mutations": {
"dupC": {
"allowed_repeats": ["X", "A", "B"],
"strict_mode": false,
"changes": [
{
"type": "insert",
"start": 0,
"end": 0,
"sequence": "GCCCACGGTGTCACCTCGGCCCCGGACACCAGGCCGGCCCCGGGCTCCACCGCCCCCCCA"
}
]
},
"deletion_example": {
"allowed_repeats": ["X"],
"strict_mode": true,
"changes": [
{
"type": "delete",
"start": 0,
"end": 0
}
]
}
}
}
Fields¶
| Field | Type | Description |
|---|---|---|
allowed_repeats |
array | Valid repeat symbols for this mutation |
strict_mode |
boolean | Enforce allowed_repeats (error if violated) |
changes |
array | List of mutation change objects |
Mutation Change Fields¶
| Field | Type | Description | Required |
|---|---|---|---|
type |
string | "insert", "delete", "replace", or "delete_insert" | Yes |
start |
integer | Start position within repeat | Yes |
end |
integer | End position within repeat | Yes |
sequence |
string | DNA sequence for insert/replace/delete_insert | No |
Mutation Operations¶
Insert:
Inserts sequence at target position.
Delete:
Removes repeat at target position.
Replace:
Substitutes repeat at target position with new sequence.
Delete-Insert:
Deletes repeat, then inserts sequence.
Strict Mode¶
strict_mode: false (Permissive):
- If target repeat not in
allowed_repeats, auto-convert to nearest allowed repeat - Emit warning
- Simulation continues
strict_mode: true (Strict):
- If target repeat not in
allowed_repeats, raise error - Simulation fails
Example:
# This will fail if position 25 is not an "X" repeat
muconeup --config config.json simulate \
--mutation-name dupC \
--mutation-targets 1,25
Tools Section¶
Purpose¶
Paths to external tools for read simulation.
Structure¶
{
"tools": {
"reseq": "/path/to/reseq2",
"bwa": "/usr/bin/bwa",
"samtools": "/usr/bin/samtools",
"faToTwoBit": "/usr/bin/faToTwoBit",
"pblat": "/usr/bin/pblat",
"minimap2": "/usr/bin/minimap2",
"pbsim3": "/usr/bin/pbsim3",
"ccs": "/usr/bin/ccs"
}
}
Auto-Detection¶
If paths not specified, MucOneUp searches system PATH:
Note: samtools is required and cannot be omitted. Other tools are auto-detected from system PATH.
Conda Environments¶
When using conda environments, specify full paths:
# Find tool path in conda env
conda activate wessim
which reseq2
# /home/user/miniconda3/envs/wessim/bin/reseq2
# Update config.json
{
"tools": {
"reseq": "/home/user/miniconda3/envs/wessim/bin/reseq2"
}
}
Read Simulation Section¶
Purpose¶
Parameters for Illumina read simulation (Wessim2-style fragment simulation with ReSeq2 error modeling).
Structure¶
{
"read_simulation": {
"simulator": "illumina",
"human_reference": "/path/to/hg38.fa",
"reseq_model": "/path/to/reseq_model",
"read_number": 10000,
"fragment_size": 350,
"fragment_sd": 50,
"min_fragment": 100,
"coverage": 100,
"threads": 4,
"seed": null
}
}
Fields¶
| Field | Type | Description | Default |
|---|---|---|---|
simulator |
string | "illumina", "ont", "pacbio", "amplicon", or "ont-amplicon" | "illumina" |
human_reference |
string | Alignment reference FASTA used by every simulator. Precedence: human_reference_<assembly>, then human_reference, then reference_genomes.<assembly>.fasta_path. Ignored with --no-align |
Required for Illumina (unless reference_genomes is set) |
reseq_model |
string | Path to ReSeq2 error model (.reseq file) |
- |
read_number |
integer | Number of fragment pairs to simulate (more = higher achievable coverage). CLI: --read-number |
100000 |
fragment_size |
integer | Mean insert size (bp) | 350 |
fragment_sd |
integer | Insert size std dev (bp) | 50 |
min_fragment |
integer | Minimum fragment size (bp) | - |
coverage |
integer | Target coverage depth | 100 |
threads |
integer | Parallel threads | Required |
seed |
integer | Random seed (null = random) | null |
downsample_mode |
string | "vntr": downsample so sample_target_bed hits coverage, then thin the VNTR to coverage × vntr_to_flanking_ratio. "non_vntr": only the first step, so the VNTR keeps whatever depth the capture model gives it |
"vntr" |
sample_target_bed |
string | Capture targets next to the VNTR (VNTR excluded) that coverage is measured on |
Required when coverage is set |
vntr_to_flanking_ratio |
number | VNTR mean / sample_target_bed mean in vntr mode |
1.4 |
downsample_seed |
integer | Seed for downsampling | VNTR capture seed + 1 |
Coverage realism (Illumina)¶
MucOneUp only simulates reads from the MUC1 haplotypes. There are no
off-target or exome background reads, so set the depth with coverage
and downsample_mode: "vntr", not with read_number (#88).
Measured with samtools depth -a on the final BAM (seed 42, one simulated
diploid, read_number 100000, twist_v2 BED, hg38 VNTR
chr1:155188487-155192239):
| Settings | VNTR mean | BED mean | Ratio | Mapped reads |
|---|---|---|---|---|
non_vntr, coverage 150 |
697.5x | 150.7x | 4.6 | 20,815 |
vntr, coverage 150 (default) |
204.2x | 150.7x | 1.4 | 8,177 |
vntr, coverage 107, ratio 1.6 |
169.1x | 108.2x | 1.6 | 6,459 |
The medians in 1,043 real Twist v2 exomes (validation for PR #90) were VNTR 169x, BED 107x,
ratio 1.6, and about 30,000 reads in the MUC1 slice. To match them, use
--coverage 107 with "vntr_to_flanking_ratio": 1.6. The read count
still stays about 5x lower than in a real exome slice.
NanoSim Parameters Section¶
Purpose¶
Parameters for Oxford Nanopore read simulation.
Structure¶
{
"nanosim_params": {
"training_data_path": "/path/to/nanosim/training",
"coverage": 50,
"min_read_length": 1000,
"max_read_length": 10000,
"correction_factor": 0.325,
"enable_split_simulation": true,
"seed": null
}
}
Fields¶
| Field | Type | Description | Default |
|---|---|---|---|
training_data_path |
string | NanoSim pre-trained model path | Required |
coverage |
integer | Target coverage depth | 50 |
min_read_length |
integer | Minimum read length (bp). For muconeup reads ont, precedence is --min-read-length > this value > built-in 100 |
100 (reads ont) |
max_read_length |
integer | Maximum read length (bp) | 10000 |
correction_factor |
float | Coverage adjustment factor | 0.325 |
enable_split_simulation |
boolean | Diploid split-simulation mode | true |
seed |
integer | Random seed (null = random) | null |
Diploid Split-Simulation¶
When enable_split_simulation: true and reference has 2 sequences:
- Split diploid reference into haplotype1.fa and haplotype2.fa
- Simulate each independently (coverage/2 each)
- Merge reads from both haplotypes
- Align merged reads to diploid reference
Result: Balanced allelic coverage (eliminates length-proportional bias).
PacBio Parameters Section¶
Purpose¶
Parameters for PacBio HiFi read simulation.
Structure¶
{
"pacbio_params": {
"model_type": "qshmm",
"model_file": "/path/to/pbsim3/models/QSHMM-RSII.model",
"coverage": 30,
"pass_num": 10,
"min_passes": 3,
"min_rq": 0.99,
"threads": 4,
"seed": null
}
}
Fields¶
| Field | Type | Description | Default |
|---|---|---|---|
model_type |
string | "qshmm" or "errhmm" | Required |
model_file |
string | pbsim3 model file path | Required |
coverage |
number | Target coverage depth (0.1-10000); template molecules in amplicon mode | Required (amplicon: 30) |
pass_num |
number | Number of passes per molecule (2-50) | Required |
min_passes |
number | Minimum CCS passes (1-50) | Required |
min_rq |
number | Minimum read quality (0.0-1.0) | Required |
threads |
number | Parallel threads (minimum 1) | 8 |
seed |
integer | Random seed (null = random) | null |
difference_ratio |
string | pbsim3 --difference-ratio (SUB:INS:DEL) for amplicon mode; omitted when unset |
pbsim3 default |
ONT Amplicon Parameters Section¶
Purpose¶
Parameters for ONT amplicon read simulation (pbsim3 single-pass mode). Separate from pacbio_params so each platform uses its own error model.
Structure¶
{
"ont_amplicon_params": {
"model_type": "qshmm",
"model_file": "reference/pbsim3/QSHMM-ONT-HQ.model",
"threads": 8,
"accuracy_mean": 0.95
}
}
Fields¶
| Field | Type | Description | Default |
|---|---|---|---|
model_type |
string | "qshmm" or "errhmm" | "qshmm" |
model_file |
string | pbsim3 ONT error model file | QSHMM-ONT-HQ.model |
threads |
number | Parallel threads (minimum 1) | 8 |
coverage |
number | Template molecules when --coverage is not given |
30 |
seed |
integer | Random seed (null = random) | null |
accuracy_mean |
number | Mean read accuracy (0.0-1.0) | 0.95 |
difference_ratio |
string | pbsim3 --difference-ratio (SUB:INS:DEL). The pbsim3 default produces insertion-heavy errors; per-base rates measured on real R10.4.1 sup MUC1 amplicons (PRJEB92208) give about "33:31:36" |
pbsim3 default |
Available ONT models: QSHMM-ONT-HQ.model, QSHMM-ONT.model, ERRHMM-ONT.model.
Read Model and Fragment Parameters Sections¶
read_model¶
Activates a read profile from the
config file; --read-profile on the command line takes precedence.
| Field | Type | Description |
|---|---|---|
profile |
string | Built-in profile name or path to a profile JSON (required) |
name, sha256 |
string | Recorded automatically when a profile is applied |
ont_fragment_params¶
Settings for reads ont --simulator pbsim3-fragments (config simulator
ont-fragments). The ONT error model settings come from ont_amplicon_params.
| Field | Type | Description | Default |
|---|---|---|---|
n_reads |
integer | Number of reads | derived from coverage |
coverage |
number | Total depth used to derive n_reads (set by --coverage) |
30 |
length_median |
number | Median read length (bp) | profile, else 5000 |
length_sigma |
number | Log-normal sigma | profile, else 0.5 |
flank_fasta |
string | FASTA with left/right records added around each haplotype |
none |
seed |
integer | Random seed | none |
read_simulation.track_read_source (boolean) requests truth-tracked amplicon
simulation, as --track-read-source does.
Amplicon Parameters Section¶
Purpose¶
Parameters for amplicon read simulation (shared by PacBio and ONT) with PCR length bias modeling.
Structure¶
{
"amplicon_params": {
"forward_primer": "GGAGAAAAGGAGACTTCGGCTACCCAG",
"reverse_primer": "GCCGTTGTGCACCAGAGTAGAAGCTGA",
"primer_source": "Wenzel et al. 2018 (PMID: 29520014)",
"expected_product_range": [500, 15000],
"pcr_bias": {
"preset": "default"
}
}
}
Fields¶
| Field | Type | Description | Required |
|---|---|---|---|
forward_primer |
string | Forward primer sequence (5'->3') | Yes |
reverse_primer |
string | Reverse primer sequence (5'->3') | Yes |
primer_source |
string | Citation for primer sequences | No |
expected_product_range |
array | [min, max] amplicon size in bp (inclusive) | No |
pcr_bias |
object | PCR bias model configuration | No |
PCR Bias Configuration¶
"pcr_bias": {
"preset": "default",
"e_max": 0.95,
"alpha": 0.00005,
"cycles": 25,
"denaturation_time": 10.0,
"stochastic": false
}
| Field | Type | Description | Default |
|---|---|---|---|
preset |
string | "default", "no_bias" or "madritsch2025_r10" | "default" |
e_max |
float | Max per-cycle efficiency (0-1) | 0.95 |
alpha |
float | Length decay rate (bp^-1) | 0.00005 |
cycles |
integer | Number of PCR cycles | 25 |
denaturation_time |
float | Denaturation duration (seconds) | 10.0 |
stochastic |
boolean | Enable stochastic bias mode | false |
When preset is specified, its values are used as defaults and individual fields override them.
See the Amplicon Simulation Guide for details.
Complete Example¶
{
"repeats": {
"1": "AAGGAGACTTCGGCTACCCAGAGAAGTTCAGTGCCCAGCTCTACTGAGAAGAATGCTGTG",
"2": "AGTATGACCAGCAGCGTACTCTCCAGCCACAGCCCCGGTTCAGGCTCCTCCACCACTCAG",
"X": "GCCCACGGTGTCACCTCGGCCCCGGACACCAGGCCGGCCCCGGGCTCCACCGCCCCCCCA",
"A": "GCCCACGGTGTCACCTCGGCCCCGGAGAGCAGGCCGGCCCCGGGCTCCACCGCGCCCGCA",
"B": "GCCCACGGTGTCACCTCGGCCCCGGAGAGCAGGCCGGCCCCGGGCTCCACCGCCCCCCCA",
"6": "GCCCACGGTGTCACCTCGGCCCCGGACACCAGGCGGGCCCCGGGCTCCACCCCGGCCCCG",
"6p": "GCCCACGGTGTCACCTCGGCCCCGGACACCAGGCCGGCCCCGGGCTCCACCCCGGCCCCG",
"7": "GGCTCCACCGCCCCCCCAGCCCACGGTGTCACCTCGGCCCCGGACACCAGGCCGGCCCCG",
"8": "GGCTCCACCGCCCCCCCAGCCCATGGTGTCACCTCGGCCCCGGACAACAGGCCCGCCTTG",
"9": "GGCTCCACCGCCCCTCCAGTCCACAATGTCACCTCGGCCTCAGGCTCTGCATCAGGCTCA"
},
"constants": {
"hg38": {
"left": "AGCAGGCAGTGCGGGGCCGCTGCTGCTG...",
"right": "TGCTGCTGCTGCGGGGCCGCTGCTGCTG...",
"vntr_region": "chr1:155185824-155192916"
}
},
"probabilities": {
"1": {"2": 0.3, "X": 0.7},
"2": {"1": 0.2, "A": 0.8},
"X": {"A": 0.5, "B": 0.5},
"A": {"B": 0.6, "X": 0.4},
"B": {"A": 0.5, "X": 0.5}
},
"length_model": {
"distribution": "normal",
"mean_repeats": 63.3,
"median_repeats": 70,
"min_repeats": 42,
"max_repeats": 85
},
"mutations": {
"dupC": {
"allowed_repeats": ["X", "A", "B"],
"strict_mode": false,
"changes": [
{
"type": "insert",
"start": 0,
"end": 0,
"sequence": "GCCCACGGTGTCACCTCGGCCCCGGACACCAGGCCGGCCCCGGGCTCCACCGCCCCCCCA"
}
]
}
},
"tools": {
"reseq": "/usr/bin/reseq2",
"bwa": "/usr/bin/bwa",
"samtools": "/usr/bin/samtools"
},
"read_simulation": {
"simulator": "illumina",
"human_reference": "/path/to/hg38.fa",
"reseq_model": "/path/to/reseq_model",
"fragment_size": 350,
"fragment_sd": 50,
"coverage": 100,
"threads": 4,
"seed": 42
},
"nanosim_params": {
"training_data_path": "/path/to/nanosim_training",
"coverage": 50,
"min_read_length": 1500,
"max_read_length": 5000,
"correction_factor": 0.325,
"enable_split_simulation": true,
"seed": 42
},
"pacbio_params": {
"model_type": "qshmm",
"model_file": "/path/to/pbsim3/QSHMM-RSII.model",
"coverage": 30,
"pass_num": 10,
"min_passes": 3,
"min_rq": 0.99,
"threads": 4,
"seed": 42
},
"ont_amplicon_params": {
"model_type": "qshmm",
"model_file": "/path/to/pbsim3/QSHMM-ONT-HQ.model",
"threads": 8,
"accuracy_mean": 0.95
}
}
Validation¶
MucOneUp validates configuration on load:
Checked:
- All repeat symbols referenced in probabilities exist in repeats
- Terminal block symbols (6/6p, 7, 8, 9) defined
- Probability values are valid (0.0 to 1.0)
- Length model parameters are positive integers
- Mutation sequences contain valid DNA (ACGT)
- Tool paths exist (if specified)
Errors cause simulation to fail immediately.
Best Practices¶
Version Control Configuration
Commit config.json to version control with your simulation scripts for reproducibility.
Comment Your Mutations
JSON doesn't support comments, but you can use descriptive mutation names:
Test Configuration
Validate configuration before large-scale simulations:
Platform-Specific Paths
Tool paths differ across systems. Use environment variables or separate configs for different machines:
Next Steps¶
- Simulation Guide - Use your configuration for simulations
- mutations guide (coming soon) - Define custom mutations
- Workflows (coming soon) - Analyze real data to inform probabilities