2
$\begingroup$

I'm trying to use the HaplotypeCaller from the GATK toolkit but I keep getting an error. I pulled GATK through Docker and am using this command:

docker run -v /Users/rimo/ -it broadinstitute/gatk:latest gatk HaplotypeCaller -R /Users/rimo/reference.fasta -I /Users/rimo/sample1.bam -O /Users/rimo/sample1.g.vcf.gz -ERC GVCF

/Users/rimo is my home directory it's where the files are currently located on my computer and it's where I want GATK to look for files to use in the command.

but then I get this error:

A USER ERROR has occurred: The specified fasta file (file:///Users/rimo/reference.fasta) does not exist.

I don't fully understand how Docker commands work but I found a similar problem listed with this issue. I tried to use their solution but it's still giving me the same error as listed above.

$\endgroup$

2 Answers 2

3
$\begingroup$

Read the manual please: https://docs.docker.com/storage/bind-mounts/

-v or --volume: Consists of three fields, separated by colon characters (:). The fields must be in the correct order, and the meaning of each field is not immediately obvious.

  • In the case of bind mounts, the first field is the path to the file or directory on the host machine.
  • The second field is the path where the file or directory is mounted in the container.
  • The third field is optional, and is a comma-separated list of options, such as ro, z, and Z. These options are discussed below.

Try

docker run -v /Users/rimo/:/myhome ...

Also, why are you combining a -it run with an actual command? I thought the -it is to start an interactive shell, which is the opposite of running a single command.

$\endgroup$
1
  • 3
    $\begingroup$ Thanks for your response! Didn't see it until I posted my answer below but it definitely makes sense. I'm still trying to figure out how Docker works so your comment about -it and what it actually means helped! $\endgroup$
    – rimo
    Commented Nov 7, 2023 at 17:04
2
$\begingroup$

I went back to the documentation listed on the GATK website instead of Docker because the Docker documentation was a bit confusing. And was able to figure it out with this command:

docker run -v ~/data:/gatk/my_data -it broadinstitute/gatk:latest

And for those who might use this as a resource because they don't understand how to use local files on a Docker image the breakdown is as follows:

$\endgroup$
2
  • 2
    $\begingroup$ Upvoting @RamRS would be a cool thing to do. $\endgroup$
    – M__
    Commented Nov 7, 2023 at 16:59
  • 2
    $\begingroup$ The main issue here was that I didn't understand the breakdown of a docker run command and the documentation on the website is pretty confusing if you aren't familiar with all of the verbiage. Going back and breaking down the command helped me understand how the local files on my computer get onto the docker image and where to find them in order to run a separate command. I got there in the end but thanks for your contribution! $\endgroup$
    – rimo
    Commented Nov 7, 2023 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.