-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The Microbiome Helper Docker image is based on Ubuntu and contains all the scripts, external programs and some databases used in the workflow described in the Metagenomics SOP v2 section at https://github.com/dhwanidesai/MH2_test/wiki
We have created a new user in the image called "microbiomeuser" who has permissions to run the scripts in the container. When a container of this image is run, it by default points to a location "/home/microbiomeuser". This will be the "home" location (indicated by ~).
The user ID for this user is 998. So if you already have a user with ID 998 on your system, when you copy result files out from the container, it will have ownership of that user. Otherwise, it will just be owned by 998. In either case, you should change the ownership back to your own username by using the chown
and chgrp
commands.
docker pull dockerdkd/microbiomehelper:latest
docker run -it dockerdkd/microbiomehelper:latest
=== Tip to change the docker installation directory (where it stores the generated image) from the default / ===
We will use systemd from Ubuntu to control Docker behaviour
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo nano /etc/systemd/system/docker.service.d/docker-storage.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// --data-root="/path/to/new/docker_storage folder"
sudo systemctl daemon-reload
sudo systemctl restart docker
Check the change in directory by doing the following: It should now point to "/path/to/new/docker_storage folder"
docker info|grep -P "Docker Root Dir"
sudo groupadd docker
sudo gpasswd -a $USER docker
newgrp docker
This can be done in 2 ways:
docker run -it microbiomehelper:latest
docker container ls -a
docker cp ~/Downloads/mgs_tutorial_Oct2017.zip <container ID>:/home/microbiomeuser
Restart the container and re-run the container as root; You need to do this once to change the permissions of the files copied into the container
docker restart <container ID>
docker exec --user root -it <container ID> bash
Once in the container, change the ownership of the copied folder
chown -R microbiomeuser <folder name>
chgrp -R microbiomeuser <folder name>
Exit the container
exit
Now restart the container without root (with the --user microbiomeuser) to start running the workflow commands
docker exec --user microbiomeuser -it <container ID> bash
Replace with your container IDs in the above commands, e.g 29e00503e530
You can run a docker image with the mount (-v) option to mount a directory from your hard drive in the container. Again, you need to first mount the directory in the container as root, change the ownership of the mounted directory to "microbiomeuser" as in the previous case and then re-run the container with the "--user microbiomeuser" option. For example, if you made a folder docker_test_analysis which contains your fastq files, you could mount it first as root, change the ownership of the folder inside the container, the exit the container, restart it and re-run it again as with the "--user microbiomeuser" option as follows:
docker run --user root -it -v \ $PWD/docker_test_analysis:/home/microbiomeuser/docker_test_analysis \ dockerdkd/microbiomehelper:latest bash
Inside the container, change ownership
chown -R microbiomeuser <folder name>
chgrp -R microbiomeuser <folder name>
Exit the container
exit
Get a list of container IDs so that you know which one to restart
docker container ls -a
Restart the container you want by specifying its ID
docker restart <container ID>
Run it again with "microbiomeuser"
docker exec --user microbiomeuser -it <container ID> bash
humann2_databases --available
humann2_databases --download chocophlan full /home/microbiomeuser/databases
humann2_databases --download uniref uniref90_diamond /home/microbiomeuser/databases
Sometimes you might get an error as follows:
Error message returned from metaphlan2.py :
Downloading MetaPhlAn2 database
Please note due to the size this might take a few minutes
This might be due to incorrect indexing of the Metaphlan2 mpa database by bowtie2
To fix this (modified from https://groups.google.com/forum/#!topic/metaphlan-users/7TfY_h-SELQ ): (PLease make sure you are in the Docker container)
cd ~/metaphlan2/metaphlan_databases
wget https://bitbucket.org/biobakery/metaphlan2/downloads/mpa_v20_m200.tar
tar -xvf mpa_v20_m200.tar
bzip2 -dk mpa_v20_m200.fna.bz2
bowtie2-build --threads 4 mpa_v20_m200.fna mpa_v20_m200
You are now ready to run the Microbiome Helper workflow commands in the Docker container