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.
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
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.
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
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:
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
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
Each sample will get its own output directory containing the following:
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.
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.
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).