trinity

Summary

Software Description

Trinity is a program for the efficient and robust de novo (no reference genome required) reconstruction of transcriptomes from RNA-seq data. Trinity produces a large number of intermediate files (500,000 to 1,000,000). The MSI filesystem limits each group to a maximum of 1 million files. Therefore it is recommended that you configure Trinity to write output to local scratch (using the option “–output /scratch.local/trinity”), where there is no file number limit, and copy the fasta assembly file back to your group folder when Trinity has finished.

General Linux

Depending on where you are working, there may be more than one version of available. To see which modules are available for loading you can run:

module avail trinity

This will provide a list of all versions of the package, shown as <package name>/<version>.

To load a specific module for use in a Linux environment, you can run the command:

module load trinity/2.15.2

To launch the package after it is loaded and see the help menu, use the command:

Trinity -h

Example Trinity Job Script

The following sbatch example script will show you how to set and use local scratch (/scratch.local) to run your Trinity job. To use local scratch, we must first set the sbatch directive --tmp <size> equal to the storage size we would like for our Trinity job’s files. See the MSI partition page about what each queue’s local scratch limits are. Second, we must create a working directory in the /scratch.local/ folder where we can write the numerous Trinity files to.

In this example, we will use the example sequencing FASTQs provided by the Trinity software so please note that the total memory allocation, number of cores, and walltime will be much lower than you would likely set your allocation to for a real data set. #SBATCH -A YOURGROUP and #SBATCH --mail-user=YOUREMAIL@umn.edu should also be updated to include your group’s name and your email address, respectively.

#!/bin/sh
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -c 4
#SBATCH --mem=16G
#SBATCH --tmp=500G
#SBATCH -t 1:00:00
#SBATCH -p msismall
#SBATCH -A YOURGROUP
#SBATCH --mail-type="ALL"
#SBATCH --mail-user=YOUREMAIL@umn.edu


# Load the current latest version of the Trinity module - please check for latest with: module avail trinity
module load trinity/2.15.2

# Create a local scratch working directory - please note that this folder and its contents
# will be deleted once the job ends
LOCAL_SCRATCH="/scratch.local"
WORKDIR="${LOCAL_SCRATCH}/trinity_${SLURM_JOB_ID}"
mkdir -p "$WORKDIR" 

# Define the example FASTQ files - here, we are setting the test FASTQ files provided by the trinity software equal to different variables
FASTQ_RIGHT_1="/opt/trinity/sample_data/test_Trinity_Assembly/reads.right.fq.gz"
FASTQ_RIGHT_2="/opt/trinity/sample_data/test_Trinity_Assembly/reads2.right.fq.gz"
FASTQ_LEFT_1="/opt/trinity/sample_data/test_Trinity_Assembly/reads.left.fq.gz"
FASTQ_LEFT_2="/opt/trinity/sample_data/test_Trinity_Assembly/reads2.left.fq.gz"

# Set the output directory for Trinity to the folder created in local scratch (/scratch.local).
# Intermediate files will be deposited here and deleted after the job ends.
TEMP_OUT=${WORKDIR}/"Trinity_output"    # NOTE: the output folder name must contain the word "trinity" or it will throw an error.
SAVE_PATH="/projects/standard/YOURGROUP/shared/" # Set this to the location where ever you would like the files saved once your job ends. 

## Run Trinity
Trinity --seqType fq \
        --max_memory 2G \
        --left ${FASTQ_LEFT_1},${FASTQ_LEFT_2} \
        --right ${FASTQ_RIGHT_1},${FASTQ_RIGHT_2} \
        --SS_lib_type RF \
        --output ${TEMP_OUT} \
        --CPU ${SLURM_CPUS_PER_TASK}

# Important Note: the intermediate results (inchworm, chrysalis, salmon, etc) are saved to $TEMP_OUT,
# but the final results FASTA file is written to $WORKDIR. So we must make sure to copy that file over
# before the job ends and it is deleted.

# Copy select results that are written to the $WORKDIR to the "$SAVE_PATH" folder:
cp ${WORKDIR}/*.fasta ${SAVE_PATH}
cp ${WORKDIR}/*_map ${SAVE_PATH}