Skip to content

Commit 9942cbc

Browse files
committed
update whamg
1 parent e701891 commit 9942cbc

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/bash_workflows/run_whamg.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ include_bed_file=$6
1111
primary_contigs_list=$7
1212
cpu_cores=${8:-4}
1313

14+
include_bed_file_abs_path=$(realpath $include_bed_file)
15+
reference_fasta_abs_path=$(realpath $reference_fasta)
1416

1517
chr_list=$(paste -s -d ',' "${primary_contigs_list}")
1618

@@ -23,33 +25,38 @@ export GCS_OAUTH_TOKEN=`gcloud auth application-default print-access-token`
2325

2426
echo "Converting cram to bam ..."
2527
# covert cram to bam
26-
samtools view -b1@ ${cpu_cores} -T "${reference_fasta}" "${cram_file}" > sample.bam
28+
#samtools view -b1@ ${cpu_cores} -T "${reference_fasta}" "${cram_file}" > sample.bam
2729
echo "Finished converting cram to bam."
2830

2931
# index bam file
30-
samtools index -@ ${cpu_cores} sample.bam
32+
echo "Indexing the bam file ..."
33+
#samtools index -@ ${cpu_cores} sample.bam
34+
echo "Finished indexing the bam file."
3135

3236
# ensure that index files are present in appropriate locations
33-
ln -s sample.bam.bai sample.bai
34-
if [ ! -e "${reference_fasta}.fai" ]; then
35-
ln -s "${reference_index}" "${reference_fasta}.fai"
36-
fi
37+
#ln -s sample.bam.bai sample.bai
38+
#if [ ! -e "${reference_fasta}.fai" ]; then
39+
# ln -s "${reference_index}" "${reference_fasta}.fai"
40+
#fi
3741

3842
# run whamg on all specified intervals
39-
mkdir tmpVcfs
43+
echo "Running whamg on specified intervals ..."
44+
mkdir -p tmpVcfs
4045
cd tmpVcfs
41-
awk 'BEGIN{FS=OFS="\t"}{printf("%07d\t%s\n",NR,$1":"$2"-"$3)}' ${include_bed_file} |\
46+
47+
awk 'BEGIN{FS=OFS="\t"}{printf("%07d\t%s\n",NR,$1":"$2"-"$3)}' "${include_bed_file_abs_path}" |\
4248
while read -r line interval; do
4349
vcfFile="$line.wham.vcf.gz"
4450
whamg \
45-
-c ${chr_list}" \
51+
-c "${chr_list}" \
4652
-x ${cpu_cores} \
47-
-a "${reference_fasta}" \
53+
-a "${reference_fasta_abs_path}" \
4854
-f ../sample.bam \
4955
-r $interval \
5056
| bgzip -c > $vcfFile
5157
bcftools index -t $vcfFile
5258
done
59+
echo "Finished running whamg on specified intervals."
5360

5461
# We need to update both the VCF sample ID and the TAGS INFO field in the WHAM output VCFs.
5562
# WHAM uses both to store the sample identifier, and by default uses the SM identifier from the BAM file.

0 commit comments

Comments
 (0)