I have a bash script about HaplotypeCaller.sh. Is it possible to run this in gnu parallel ?

cat HaplotypeCaller.sh | parallel

    #!/bin/bash
    
    for i in *.bam; do 
    gatk --java-options "-Xmx40g" HaplotypeCaller -R /media/gatk/Homo_sapiens_assembly38.fasta -I $i -O $i.vcf.gz --dbsnp /media/gatk/dbsnp_138.hg38.vcf.gz -L /media/gatk/target/ag_V6_list.interval_list; done
    #!/bin/bash
    
    do_one() {
      gatk --java-options "-Xmx40g" HaplotypeCaller -R /media/gatk/Homo_sapiens_assembly38.fasta -I "$1" -O "$1".vcf.gz --dbsnp /media/gatk/dbsnp_138.hg38.vcf.gz -L /media/gatk/target/ag_V6_list.interval_list
    }
    export -f do_one
    # test that do_one works on a single bam file. Then:
    parallel do_one ::: *.bam

If you do not want the output to be named `foo.bam.vcf.gz` but instead `foo.vcf.gz`:

    #!/bin/bash
    
    do_one() {
      gatk --java-options "-Xmx40g" HaplotypeCaller -R /media/gatk/Homo_sapiens_assembly38.fasta -I "$1" -O "$2" --dbsnp /media/gatk/dbsnp_138.hg38.vcf.gz -L /media/gatk/target/ag_V6_list.interval_list
    }
    export -f do_one
    # test that do_one works on a single bam file:
    #   do_one foo.bam foo.vcf.gz
    # Then:
    parallel do_one {} {.} ::: *.bam
