Skip to content

Commit 4ca3fd4

Browse files
ahmed-shuaibiclaude
andcommitted
fix: redirect per-cohort verbose output to output/pancan/<C>/pipeline.log
CBaSE prints unbounded progress spam; routing each stage's stdout/stderr to a per-cohort log keeps the main sweep log small and monitorable (one cohort had already bloated it to 256MB). Takes effect for the next cohort onward. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6ee785f commit 4ca3fd4

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

scripts/run_cohort_pipeline.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ log() { echo "[$(date +%H:%M:%S)] ${C}: $*"; }
2222

2323
[ -f "$MAF" ] || { log "no MAF at ${MAF}; skipping cohort"; exit 0; }
2424
mkdir -p "${ROOT}/${C}"
25+
LOGF="${ROOT}/${C}/pipeline.log"; : > "$LOGF" # per-cohort verbose log (keeps main log small)
2526

2627
# 1. CBaSE ------------------------------------------------------------------
2728
if [ ! -f "${ROOT}/${C}/bmr_pmfs.csv" ]; then
2829
log "CBaSE generate"
29-
"$DIALECT" generate -m "$MAF" -o "${ROOT}/${C}" --bmr cbase -r hg19 || log "STAGE-FAIL cbase"
30+
"$DIALECT" generate -m "$MAF" -o "${ROOT}/${C}" --bmr cbase -r hg19 >>"$LOGF" 2>&1 \
31+
|| log "STAGE-FAIL cbase"
3032
else log "skip cbase"; fi
3133

3234
N=0
@@ -36,7 +38,8 @@ N=0
3638
if [ ! -f "${ROOT}/${C}/bmr_pmfs.dig.csv" ] && [ "$N" -gt 0 ]; then
3739
log "DIG generate (N=${N})"
3840
"$DIALECT" generate -m "$MAF" -o "${ROOT}/${C}" --bmr dig \
39-
--dig-results "$DIG_RESULTS" --dig-samples "$N" -r hg19 || log "STAGE-FAIL dig"
41+
--dig-results "$DIG_RESULTS" --dig-samples "$N" -r hg19 >>"$LOGF" 2>&1 \
42+
|| log "STAGE-FAIL dig"
4043
else log "skip dig"; fi
4144

4245
# 3. DIALECT identify -- CBaSE + DIG (fast; run before the slow MutSig) ------
@@ -47,14 +50,14 @@ if [ ! -f "${ROOT}/${C}/id_cbase/pairwise_interaction_results.csv" ] \
4750
mkdir -p "${ROOT}/${C}/id_cbase"
4851
cb_arg=(); [ -f "$CB_Q" ] && cb_arg=(-cb "$CB_Q")
4952
"$DIALECT" identify -c "${ROOT}/${C}/count_matrix.csv" -b "${ROOT}/${C}/bmr_pmfs.csv" \
50-
-o "${ROOT}/${C}/id_cbase" -k 100 "${cb_arg[@]}" || log "STAGE-FAIL id_cbase"
53+
-o "${ROOT}/${C}/id_cbase" -k 100 "${cb_arg[@]}" >>"$LOGF" 2>&1 || log "STAGE-FAIL id_cbase"
5154
fi
5255
if [ ! -f "${ROOT}/${C}/id_dig/pairwise_interaction_results.csv" ] \
5356
&& [ -f "${ROOT}/${C}/bmr_pmfs.dig.csv" ]; then
5457
log "identify dig"
5558
mkdir -p "${ROOT}/${C}/id_dig"
5659
"$DIALECT" identify -c "${ROOT}/${C}/count_matrix.csv" -b "${ROOT}/${C}/bmr_pmfs.dig.csv" \
57-
-o "${ROOT}/${C}/id_dig" -k 100 || log "STAGE-FAIL id_dig"
60+
-o "${ROOT}/${C}/id_dig" -k 100 >>"$LOGF" 2>&1 || log "STAGE-FAIL id_dig"
5861
fi
5962

6063
# 4. MutSig2CV (Docker, slow) + its identify -- skipped when SKIP_MUTSIG set --
@@ -67,13 +70,14 @@ else
6770
docker run --rm -v "${PWD}:/work" -w /work/external/MutSig2CV/mutsig2cv \
6871
-e LD_LIBRARY_PATH="$LDP" -e MCR_CACHE_ROOT="/tmp/mcr_${C}" \
6972
flywheel/matlab-mcr:v81 \
70-
./MutSig2CV "/work/${MAF}" "/work/${ROOT}/${C}_mutsig" || log "STAGE-FAIL mutsig"
73+
./MutSig2CV "/work/${MAF}" "/work/${ROOT}/${C}_mutsig" >>"$LOGF" 2>&1 \
74+
|| log "STAGE-FAIL mutsig"
7175
else log "skip mutsig (done)"; fi
7276
if [ ! -f "${ROOT}/${C}/id_mutsig/pairwise_interaction_results.csv" ] \
7377
&& [ -f "${ROOT}/${C}_mutsig/results.mat" ]; then
7478
log "identify mutsig (per-sample extractor)"
7579
"$PY" -m analysis.mutsig_persample_co --cohort "$C" --results-root "$ROOT" -k 100 \
76-
|| log "STAGE-FAIL id_mutsig"
80+
>>"$LOGF" 2>&1 || log "STAGE-FAIL id_mutsig"
7781
fi
7882
fi
7983
log "cohort pipeline DONE"

0 commit comments

Comments
 (0)