Skip to content

Commit 874e78f

Browse files
committed
Pad sample index in ScatterPloidyCallsBySample
1 parent 4afb3bd commit 874e78f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/cnv_wdl/cnv_common_tasks.wdl

+4-2
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,13 @@ task ScatterPloidyCallsBySample {
688688

689689
# Archive call files by sample, renaming so they will be glob'd in order
690690
sample_ids=(~{sep=" " samples})
691+
num_samples=~{num_samples}
692+
num_digits=${#num_samples}
691693
for (( i=0; i<~{num_samples}; i++ ))
692694
do
693695
sample_id=${sample_ids[$i]}
694-
sample_no=`printf %04d $i`
695-
tar -czf sample_${sample_no}.${sample_id}.contig_ploidy_calls.tar.gz -C calls/SAMPLE_${i} .
696+
padded_sample_index=$(printf "%0${num_digits}d" $i)
697+
tar -czf sample_${padded_sample_index}.${sample_id}.contig_ploidy_calls.tar.gz -C calls/SAMPLE_${i} .
696698
done
697699
>>>
698700
runtime {

0 commit comments

Comments
 (0)