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
The answer given by [Malcolm.Cook][1], [ole.tange][2]  and  [cpad0112][3] works well

Method 1:

    parallel gatk --java-options "-Xmx40g" HaplotypeCaller \
    -R /media/gatk/Homo_sapiens_assembly38.fasta -I {} -O {.}.vcf.gz \
     --dbsnp /media/gatk/dbsnp_138.hg38.vcf.gz \
    -L /media/gatk/target/ag_V6_list.interval_list ::: *.bam


Method 2:

    #!/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


  [1]: https://www.biostars.org/u/266/
  [2]: https://www.biostars.org/u/6149/
  [3]: https://www.biostars.org/u/20673/