@@ -11,6 +11,8 @@ include_bed_file=$6
1111primary_contigs_list=$7
1212cpu_cores=${8:- 4}
1313
14+ include_bed_file_abs_path=$( realpath $include_bed_file )
15+ reference_fasta_abs_path=$( realpath $reference_fasta )
1416
1517chr_list=$( paste -s -d ' ,' " ${primary_contigs_list} " )
1618
@@ -23,33 +25,38 @@ export GCS_OAUTH_TOKEN=`gcloud auth application-default print-access-token`
2325
2426echo " 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
2729echo " 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
4045cd 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