12. Coding solutions

12.1. QC

12.1.1. Code: Sickle

# run sickle like this on the ancestor:
sickle pe -g -t sanger -f data/ancestor-R1.fastq.gz -r data/ancestor-R2.fastq.gz -o trimmed/ancestor-R1.trimmed.fastq.gz -p trimmed/ancestor-R2.trimmed.fastq.gz -s trimmed/ancestor-singles.fastq.gz

# run the evolved samples through sickle
sickle pe -g -t sanger -f data/evolved-6-R1.fastq.gz -r data/evolved-6-R2.fastq.gz -o trimmed/evolved-6-R1.trimmed.fastq.gz -p trimmed/evolved-6-R2.trimmed.fastq.gz -s trimmed/evolved-6-singles.fastq.gz

12.1.2. Code: FastQC

Create directory:

mkdir trimmed-fastqc

Run FastQC:

fastqc -o trimmed-fastqc trimmed/ancestor-R1.trimmed.fastq.gz trimmed/ancestor-R2.trimmed.fastq.gz trimmed/evolved-6-R1.trimmed.fastq.gz trimmed/evolved-6-R2.trimmed.fastq.gz

Open html webpages:

firefox trimmed-fastqc/\*.html

12.2. Assembly

12.2.1. Code: SPAdes assembly (trimmed data)

spades.py -o assembly/spades-150/ -k 21,33,55,77 --careful -1 trimmed/ancestor-R1.trimmed.fastq.gz -2 trimmed/ancestor-R2.trimmed.fastq.gz

12.2.2. Code: SPAdes assembly (original data)

spades.py -o assembly/spades-original/ -k 21,33,55,77 --careful -1 data/ancestor-R1.fastq.gz -2 data/ancestor-R2.fastq.gz

12.3. Mapping

12.3.1. Code: Bowtie2 indexing

Build the index:

bowtie2-build assembly/spades-final/scaffolds.fasta assembly/spades-final/scaffolds

12.3.2. Code: Bowtie2 mapping

Map to the genome. Use a max fragemnt length of 1000 bp:

bowtie2 -X 1000 -x assembly/spades-final/scaffolds -1 trimmed/evolved-6-R1.trimmed.fsatq.gz -2 trimmed/evolved-6-R2.trimmed.fastq.gz -S mappings/evolved-6.sam

12.3.3. Code: BWA indexing

Index the genome assembly:

bwa index assembly/spades-final/scaffolds.fasta

12.3.4. Code: BWA mapping

Run bwa mem:

# trimmed data
bwa mem assembly/spades-final/scaffolds.fasta trimmed/evolved-6-R1.trimmed.fastq.gz trimmed/evolved-6-R2.trimmed.fastq.gz > mappings/evolved-6.sam

# raw data
bwa mem assembly/spades-final/scaffolds.fasta data/evolved-6-R1.fastq.gz data/evolved-6-R2.fastq.gz > mappings/evolved-6.raw.sam