Lecture 1

Log in using ssh

ssh user@workshop2021a.vhost37.genap.ca

Create a directory with mkdir

mkdir -p ~/projects/lec1

Go to the created directory with cd

cd ~/projects/lec1

Copy over files with cp

cp -R /home/hgen_share/lec1/* ./

Show the list of files with ls

ls -lh

Inspect the first few lines of ex* files with head

head ex1.fa
head ex2.fq

Inspect the seqtk module with module spider

module spider seqtk/1.3

Load the seqtk module with module load

module load StdEnv/2020 seqtk/1.3

Inspect loaded modules with module list

module list

Convert FASTQ to FASTA with seqtk seq

seqtk seq -a ex2.fq > ex2.fa

Inspect the first few lines of ex2.fa with head

head ex2.fa

Export conda environment

export PATH="/home/hgen_share/Anaconda/bin:$PATH"
export PATH="/home/hgen_share/Anaconda/envs/lec1/bin:$PATH"

Check environment is in your path

echo $PATH

More information on how to set up Anaconda environment here

Perform quality control analysis on ex2.fq with fastqc

fastqc ex2.fq

Download results to your local computer using scp

scp user@workshop2021a.vhost37.genap.ca:/directory/fastqc_results.html local_directory 

Inspect the reference assembly

head /home/hgen_share/bwa/hg19.fa

Assign the reference file to a variable for simplicity

ref=/home/hgen_share/bwa

Subset the first 10 and then 1000 sequences of ex2.fa using seqkit

seqkit head -n 10 ex2.fa > sub_ex2.fa

Time the alignment against hg19 with blat using a command of the form

module load blat/3.5
time blat $ref/hg19.fa sub_ex2.fa OUTPUT.psl

More information on the .psl format found here

Align against the same reference with bwa mem

module load bwa/0.7.17
bwa mem $ref/hg19.fa ex2.fq > ex2.sam

How many reads are there in ex2.fq? How much faster is BWA MEM compared to BLAT?


Take a look at the *.sam file with less

less ex2.sam

Calculate summary statistics with samtools flagstat

module load samtools/1.16.1
samtools flagstat ex2.sam

More information on interpreting flagstat statistics found here

Sort and compress in one go with samtools sort

samtools sort ex2.sam > ex2.sorted.bam 

Take a look at the *.bam file with head

head ex2.sorted.bam

Compare the size difference after compression with ls

ls -lh ex2.*am

Generate an index file with samtools index

samtools index ex2.sorted.bam