1+ #! /bin/bash
2+ set -e
3+
4+ echo " Testing ichorCNA v0.3.2 installation..."
5+
6+ # Create test directories
7+ mkdir -p /data2/ichorcna_test/output
8+
9+ # Set ichorCNA path (should be set by Dockerfile, but fallback if needed)
10+ if [ -z " ${ICHORCNA_PATH} " ]; then
11+ ICHORCNA_PATH=" /data2/ichorCNA"
12+ fi
13+
14+ echo " Using ichorCNA at: ${ICHORCNA_PATH} "
15+
16+ # Test 1: Verify readCounter exists (from HMMcopy)
17+ echo " Testing readCounter..."
18+ readCounter --help > /dev/null 2>&1 || echo " Warning: readCounter not found (optional)"
19+
20+ # Test 2: Verify ichorCNA R package loads and check version
21+ echo " Testing ichorCNA R package..."
22+ Rscript -e " library(ichorCNA); v <- packageVersion('ichorCNA'); cat('ichorCNA version:', as.character(v), '\n'); stopifnot(as.character(v) == '0.3.2')"
23+
24+ # Test 3: Check required script exists
25+ echo " Checking runIchorCNA.R script..."
26+ if [ ! -f " ${ICHORCNA_PATH} /scripts/runIchorCNA.R" ]; then
27+ echo " ERROR: runIchorCNA.R script not found"
28+ exit 1
29+ fi
30+
31+ # Test 4: Check required extdata files exist (hg19 for test data)
32+ echo " Checking extdata files..."
33+ ls -lh ${ICHORCNA_PATH} /inst/extdata/gc_hg19_1000kb.wig
34+ ls -lh ${ICHORCNA_PATH} /inst/extdata/map_hg19_1000kb.wig
35+ ls -lh ${ICHORCNA_PATH} /inst/extdata/MBC_315.ctDNA.reads.wig
36+
37+ # Test 5: Run ichorCNA on test data (using hg19 references to match test data)
38+ echo " Running ichorCNA on test sample..."
39+ Rscript ${ICHORCNA_PATH} /scripts/runIchorCNA.R \
40+ --libdir " ${ICHORCNA_PATH} " \
41+ --id test_sample \
42+ --WIG ${ICHORCNA_PATH} /inst/extdata/MBC_315.ctDNA.reads.wig \
43+ --gcWig ${ICHORCNA_PATH} /inst/extdata/gc_hg19_1000kb.wig \
44+ --mapWig ${ICHORCNA_PATH} /inst/extdata/map_hg19_1000kb.wig \
45+ --ploidy " c(2,3)" \
46+ --normal " c(0.5,0.6,0.7,0.8,0.9)" \
47+ --maxCN 5 \
48+ --includeHOMD False \
49+ --chrs " c(1:22, \" X\" )" \
50+ --chrTrain " c(1:22)" \
51+ --estimateNormal True \
52+ --estimatePloidy True \
53+ --estimateScPrevalence False \
54+ --txnE 0.9999 \
55+ --txnStrength 10000 \
56+ --outDir /data2/ichorcna_test/output
57+
58+ # Test 6: Verify output files were created
59+ echo " Verifying output files..."
60+ if [ ! -f " /data2/ichorcna_test/output/test_sample.cna.seg" ]; then
61+ echo " ERROR: Expected output file test_sample.cna.seg not created"
62+ exit 1
63+ fi
64+
65+ if [ ! -f " /data2/ichorcna_test/output/test_sample.seg.txt" ]; then
66+ echo " ERROR: Expected output file test_sample.seg.txt not created"
67+ exit 1
68+ fi
69+
70+ # Test 7: Check output contains data
71+ SEG_LINES=$( wc -l < /data2/ichorcna_test/output/test_sample.seg.txt)
72+ if [ ${SEG_LINES} -lt 2 ]; then
73+ echo " ERROR: Output segmentation file is empty or too small"
74+ exit 1
75+ fi
76+
77+ echo " ✓ All ichorCNA v0.3.2 tests passed!"
78+ echo " "
79+ echo " Output files:"
80+ ls -lh /data2/ichorcna_test/output/
81+
82+ # Clean up test directory
83+ rm -rf /data2/ichorcna_test
0 commit comments