Skip to content

Trinity in Docker

Brian Haas edited this page Mar 21, 2023 · 20 revisions

Run Trinity Using Docker

If you have Docker installed, you can pull our image from DockerHub, which contains Trinity and all software used for downstream analyses supported within the larger Trinity framework.

Pull the latest Docker image for Trinity like so:

% docker pull trinityrnaseq/trinityrnaseq

Run Trinity like so (eg. as shown where with a very small test data set):

% docker run --rm -v`pwd`:`pwd` trinityrnaseq/trinityrnaseq Trinity \
      --seqType fq \
      --left `pwd`/reads_1.fq.gz \
      --right `pwd`/reads_2.fq.gz
      --max_memory 1G --CPU 4 --output `pwd`/trinity_out_dir

Downstream analyses using Dockerized Trinity:

Trinity is installed in the Docker container at '/usr/local/bin/trinityrnaseq'.

Just use that path to access all tools installed within Trinity.

eg.

 %  docker run -v`pwd`:`pwd` trinityrnaseq/trinityrnaseq \
      /usr/local/bin/trinityrnaseq/util/align_and_estimate_abundance.pl

With the above, just be sure to specify full paths to inputs and outputs.

Running Trinity Using Singularity

Singularity is easier and safer to use than Docker, and is our preferred method for running Trinity. All modern releases of Trinity have a Singularity image (.simg) offered for download from our Trinity Singularity Image Archive. If you have Singularity installed and the .simg file downloaded, you can run Trinity like so:

    %  singularity exec -e Trinity.simg  Trinity \
          --seqType fq \
          --left `pwd`/reads_1.fq.gz  \
          --right `pwd`/reads_2.fq.gz \
          --max_memory 1G --CPU 4 \
          --output `pwd`/trinity_out_dir

All downstream analyses can be accessed similarly to the Docker instructions above, but using the Singularity execution syntax.

Running other Trinity-supported analyses using the Docker or Singularity images.

The Trinity software is unpacked at /usr/local/bin in the images, and hence $TRINITY_HOME=/usr/local/bin

To run other Trinity-supported analyses, you can reference the corresponding utilities by replacing the call to Trinity in the above commands with the path to the script as found in the container according to /usr/local/bin as the base path. For example:

   % singularity exec -e Trinity.simg /usr/local/bin/util/TrinityStats.pl

MS-Windows Users Take Notice

Windows users trying to run things through Windows Subsystem for Linux (WSL), Singularity (and for all intents and purposes, Docker) won't work on WSL version 1 (WSL1) - it will only works on version 2 (WSL2).

This issue is related to the architectural differences between the two WSL versions, and has been mentioned elsewhere https://github.com/apptainer/singularity/issues/1791 and https://superuser.com/questions/1465197/singularity-in-wsl .

Clone this wiki locally