Test Fixtures Documentation
1 Test Fixtures Documentation
IMPACT-VIS includes test fixtures for validation and development.
1.1 Overview
Test fixtures are located in tests/testthat/fixtures/ and app/data/.
Purpose: - Validate data loaders - Test filtering and ranking algorithms - Demonstrate expected file formats - Enable reproducible testing
1.2 Available Test Samples
1.2.1 SNV/GDS Test Data
File: app/data/sample001_SNV_IMPACT.gds
| Property | Value |
|---|---|
| Sample ID | sample001 |
| Variants | ~10,000 |
| Annotations | IMPACT, ClinVar, BRAVO AF, Consequence |
| File Size | ~8 MB |
| Build | GRCh38 |
Companion File: app/data/sample001_SNV_IMPACT.gds_variant_states.rds - Contains annotation states (reviewed, flagged, notes)
1.2.2 SV Test Data
File: app/data/sample001_SV_IMPACT.tsv
| Property | Value |
|---|---|
| Sample ID | sample001 |
| SVs | ~150 |
| Format | AnnotSV TSV |
| Columns | 50+ |
| File Size | ~2 MB |
Key Features: - Mix of DEL, DUP, INV, BND types - Includes exonic and intronic variants - ACMG classifications present - AnnotSV ranking scores included
1.2.3 CNV Test Data
File: app/data/sample001_CNV_IMPACT.txt
| Property | Value |
|---|---|
| Sample ID | sample001 |
| Segments | ~200 |
| Format | SCIP TXT |
| Copy States | 0, 1, 2, 3, 4 |
| File Size | ~10 KB |
Key Features: - Representative deletions and amplifications - Common oncogene amplifications (MYC, MYCN) - Tumor suppressor deletions (TP53, BRCA1)
1.3 Additional Test Samples
The repository includes 9 complete sample datasets:
app/data/
├── sample001_* (primary test sample)
├── sample002_*
├── sample003_*
├── sample004_*
├── sample005_*
├── sample006_*
├── sample007_*
├── sample008_*
└── sample009_*
Each sample includes: - <ID>_SNV_IMPACT.gds - <ID>_SNV_IMPACT.gds_variant_states.rds - <ID>_SV_IMPACT.tsv - <ID>_CNV_IMPACT.txt
1.4 Fixture Characteristics
1.4.1 Data Provenance
Test data is synthetic and does not represent real patient data.
- Generated using simulation tools
- Designed to cover edge cases
- Includes known pathogenic variants
- Balanced for performance testing
1.4.2 Expected Validation Results
| File Type | Validation | Expected Outcome |
|---|---|---|
| GDS | validate_gds_file() |
TRUE |
| SV TSV | validate_sv_tsv() |
TRUE |
| CNV TXT | validate_cnv_file() |
TRUE |
1.4.3 Performance Benchmarks
| Operation | Sample 1113506 | Expected Time |
|---|---|---|
| Load GDS | 10,000 variants | 0.5s |
| Load SV | 150 SVs | 0.1s |
| Load CNV | 200 segments | 0.05s |
| Render plot | All data | 1.2s |
1.5 Using Test Fixtures
1.5.1 In Unit Tests
box::use(
testthat[test_that, expect_true]
)
test_that("GDS loader works with test fixture", {
fixture_path <- "tests/testthat/fixtures/1113506_SNV_IMPACT.gds"
data <- load_gds_data(
gds_path = fixture_path,
num_variants = 100,
filters = list(),
bravo_thresh = 0.01
)
expect_true(!is.null(data))
expect_true(nrow(data) > 0)
})1.5.2 In Interactive Development
# Load test sample
config <- config::get()
sample_id <- "1113506"
data_dir <- config$default_sample_dir
# Load all data types
snv_data <- load_gds_data(
file.path(data_dir, paste0(sample_id, "_SNV_IMPACT.gds")),
num_variants = 1000,
filters = list(),
bravo_thresh = 0.01
)
sv_data <- load_sv_data(
file.path(data_dir, paste0(sample_id, "_SV_IMPACT.tsv"))
)
cnv_data <- load_cnv_data(
file.path(data_dir, paste0(sample_id, "_CNV_IMPACT.txt"))
)1.6 Fixture Metadata
1.6.1 GDS Fixture Details
Variant Composition: - Pathogenic: 15% - Likely pathogenic: 10% - VUS: 50% - Likely benign: 15% - Benign: 10%
Consequence Distribution: - Missense: 60% - Synonymous: 20% - Frameshift: 10% - Stop-gain: 5% - Other: 5%
1.6.2 SV Fixture Details
Type Distribution: - DEL: 45% - DUP: 30% - INV: 15% - BND: 10%
Size Distribution: - <1 KB: 20% - 1-10 KB: 30% - 10-100 KB: 30% - >100 KB: 20%
1.6.3 CNV Fixture Details
Copy State Distribution: - cn=0: 5% - cn=1: 20% - cn=2: 50% (baseline) - cn=3: 15% - cn≥4: 10%
1.7 Regenerating Fixtures
To regenerate test fixtures:
Rscript scripts/build_test_sample_fixture.RThis script: 1. Generates synthetic variant data 2. Adds realistic annotations 3. Creates GDS, TSV, TXT files 4. Validates outputs 5. Saves to app/data/