home

Filter reads by mapping to a reference genome:

In this example we map raw reads to a chloroplast genome and keep only the reads that map. This should make it possible to perform a chloroplast-only assembly.

Useful links:

Sorting out mapped and unmapped reads with samtools

NCBI genomes ftp

wget ftp://ftp.ncbi.nlm.nih.gov/genomes/Oryza_sativa_Japonica_Group/CHR_Pltd/39947_ref_IRGSP-1.0_chrPltd.fa.gz
gunzip 39947_ref_IRGSP-1.0_chrPltd.fa.gz

reads=/usr/share/data/proj_data/oryza/merge_data/final.fastq

aslocal=39947_ref_IRGSP-1.0_chrPltd.fa

bwa index $aslocal 
bwa mem -t 8 $aslocal $reads | samtools view -F 4 -Sb | samtools sort - -@4 -o WGS.sorted.bam

samtools index WGS.sorted.bam
samtools fastq WGS.sorted.bam > output.fastq 

Then run canu as normal:

canu -p plast -d plast_canu genomeSize=135k maxThreads=8  -nanopore-raw output.fastq

home