This guide will cover the download, installation, and local use of the SALMON 1.11.4 (Patro et al. 2017) for the pseudoalignment of transcriptomic reads to predicted transcripts from a reference genome. This is much faster and requires a lot less storage space than the traditional approach of mapping reads to an entire reference genome.

A Linux based system with Miniconda will be required for this guide and some high computing power is suggested, such a system might exist for your institution or can be purchased through an online cloud computing provide. Follow my guide on cloud based VM setup here: https://scottc-bio.github.io/guides/Virtual-machines-for-bioinformatics.html

A basic understanding of LINUX such as creating and moving directories etc. is assumed for this guide.

1 Installing SALMON

Firstly create and activate a new conda environment for SALMON.

conda create -n salmon_env -c bioconda salmon
conda activate salmon_env

Check the install by checking the version.

salmon --version

2 Creating the SALMON index

You need to have the transcript fasta file of your reference genome. You might have a reference genome which you assembled yourself in which case you will need to predict the the coding regions and use the predicted transcript sequences from this, or you can download the transcript.fna fasta file from a NCBI RefSeq genome accession. Either way you need a fasta file containing all the predicted transcripts from your target organism.

And then use this to create the index files required by SALMON.

salmon index -t transcripts.fna -i salmon_index

This will create ‘salmon_index/’, a directory containing the files that SALMON will use for read mapping and quantification.

3 Running SALMON

Reads should have been trimmed and quality checked previously. This can be done with fastp: https://scottc-bio.github.io/guides/fastp-1.3.2.html

3.1 Single sample

To run SALMON for a single set of paired-end reads, the the following command can be used:

salmon quant \
-i salmon_index \
-l A \
-1 trimmed_reads/sample_trimmed_1.fastq.gz \
-2 trimmed_reads/sample_trimmed_2.fastq.gz \
-p 8 \
--validateMappings \
-o salmon_output/sample

Arguments:

  • -i - Location of index directory
  • -l - The option ‘A’ is to auto-detect the library type
  • -1 & -2 - Directions to the location of the forward and reverse reads, respectively. Omit the ‘-2’ argument for single-end reads.
  • -p - Number of threads
  • –validateMappings - An optional argument but which increases accuraccy
  • -o - Output directory. Each sample will get a folder and the ‘quant.sf’ file is the one containg transcript IDs, counts, and TPM values

3.2 Multiple sample automation

A simple loop can be created to run SALMON for multiple samples.

Create a .sh file using ‘nano’.

nano run_salmon.sh

Paste the following in the text editor which opens:

#!/bin/bash

mkdir -p salmon_output

for sample in trimmed_reads/*_trimmed_1.fastq.gz
do
    base=$(basename ${sample} _trimmed_1.fastq.gz)

    echo "Processing ${base}"

    salmon quant \
        -i salmon_index \
        -l A \
        -1 trimmed_reads/${base}_trimmed_1.fastq.gz \
        -2 trimmed_reads/${base}_trimmed_2.fastq.gz \
        -p 8 \
        --validateMappings \
        -o salmon_output/${base}

done

To save this file, press ‘Ctrl + O’, ‘Enter’, ‘Ctrl + X’.

Then make the file executable.

chmod +x run_salmon.sh

Then run.

./run_salmon.sh

3.3 Running in the background

For a lot of samples it is useful to be able to run this in the background.

The best way to do this is to use tmux.

Create a new tmux window.

tmux new -s salmon_run

Activate salmon_env in this new session.

Then run SALMON as before using the .sh file.

You can then detach from this session and any processes will continue to run in the background. Detach by pressing ‘Ctrl + b’ followed by ‘d’.

Then can re-attach to check progress with:

tmux attach -t salmon_run

4 Understanding the outputs

Each sample will get its own output directory containing the following:

  • quant.sf - The most important output file, it will have single rows for each transcript with columns: Name (transcript ID), Length (transcript lenght), EffectiveLength (length after bias correction), TPM (normalised expression), NumReads (estimated read counts)
  • aux_info/ - Extra information used internally or for QC
  • ambig_info.tsv - Ambiguously mapped reads. Reads that match multiple transcripts.
  • observed_bias.gz - Bias models learned by SALMON
  • cmd_info.json - Records how SALMON runs, useful for documentation.
  • lib_format_counts.json - Info about library type detection.
  • libParams/ - Internally used files relating to length distributions and library characteristics
  • logs/ - Log files from the run

The main file is quant.sf and realistically all the other files can be ignored unless in downstream analysis something stands out, then you can go back to these files for each sample to try and debug.

5 Preparing samples for import into R

It is likely that you will want to do some differential expression analysis, and if so the .sf files can be imported directly into R.

If you are using a VM or a HPC (explained more here: https://scottc-bio.github.io/guides/Virtual-machines-for-bioinformatics.html) then you will need to move the quant.sf files back to your local machine.

5.1 Transferring quant.sf files to local machine

First, on the LINUX system, make a directory with subdirectories named by sample with these subdirectories containing just their quant.sf file:

for d in salmon_output/*; do
    sample=$(basename "$d")
    mkdir -p salmon_quant_only/$sample
    cp "$d/quant.sf" salmon_quant_only/$sample/
done

Then logout of the VM of HPC and in the Windows Powershell use ‘scp’ to copy this directory back to your local machine in the following format.

scp -r user@ip_for_your_server:/path/to/salmon_quant_only path/to/desired/location

Now on your local machine you will have the directory ‘salmon_quant_only’ containing directories for each sample, each containing just that sample’s quant.sf file.

These samples are now ready for import into R and for analysis with DESeq2 (Love, Huber, and Anders 2014).

References

Love, Michael I., Wolfgang Huber, and Simon Anders. 2014. “Moderated Estimation of Fold Change and Dispersion for RNA-seq Data with DESeq2.” Genome Biology 15 (12): 550. doi:10.1186/s13059-014-0550-8.
Patro, Rob, Geet Duggal, Michael I Love, Rafael A Irizarry, and Carl Kingsford. 2017. “Salmon: Fast and Bias-Aware Quantification of Transcript Expression Using Dual-Phase Inference.” Nature Methods 14 (4): 417–19. doi:10.1038/nmeth.4197.