A de novo assembly with spades should work as well as a mapping with bowtie2.
While performing a de novo assembly you should also be aware of possible contamination which you may need to remove. By using a mapping this may not be necessary.
When you use a mapping, you must be aware that you may miss relevant and diverged regions because of the mapping to a reference strain. So a mappping would be preferrable if your target genome is closely related to your reference genome.
I'd like to give you the advice to use some kind of distribution system like Anaconda which helps you to keep your system clean and make it easier to reproduce your steps.
Here are some possible steps for both ways. I am using an e.coli k12 sample, sra number SRR6940089 :
De novo assembly
1. Quality Check ( you already did this )
2. Run Spades
spades.py -o k12 -m 8 -t 4 --pe1-1 SRR6940089_1.fastq --pe1-2 SRR6940089_2.fastq &> k12.log
This command will start an assembly using 4 threads and 8 GB RAM. You can scale it to whatever your system is capable of or what you'd like.
You now have a folder called
k12 which holds the assembly information.
To get some information about the contigs you can use the emboss toolkit.
fasta::contigs.fasta:NODE_859_length_78_cov_1.000000 - NODE_859_length_78_cov_1.000000 - N 78 43.59
fasta::contigs.fasta:NODE_860_length_78_cov_1.000000 - NODE_860_length_78_cov_1.000000 - N 78 44.87
fasta::contigs.fasta:NODE_861_length_78_cov_1.000000 - NODE_861_length_78_cov_1.000000 - N 78 43.59
This is the end of the contigs.fasta. So you see contigs.fasta contains 861 contigs. And you also see thate ther length and coverage is quiet low. So you need to remove this low coverage regions.
3. Remove low quality contigs
There are multiple ways how you could achieve this. I'd like to filter sequence smaller than 500 bp. the tricky part is to identify the coverage threshold. Contigs with a low coverage could be some artifacts or contamination.
4. Check for possible contamination
So to check for possible contamination you can use kraken2. But it needs some disk space. I am using here the minikraken database
kraken2 --db minikraken --threads 4 --output ecoli.kraken --report ecoli_kraken.report k12/contigs.fasta &> kraken.log
ecoli_kraken.report shows an overview of how the contigs could be classified to availible species from the database.
Based on this results you can also remove some contigs.
5. Run Prokka
Now after you removed unwanted contigs, you can run prokka to get the annotation.
prokka --cpus 4 --outdir prokka k12/contigs.fasta &> prokka.log
And you will find the information in the prokka folder
The mapping process is a little bit easier. You can use bowtie2 and samtools
bowtie2 -x ecoli -1 SRR6940089_1.fastq -2 SRR6940089_2.fastq -p 4 | samtools view -@ 4 -O BAM -o ecoli.bam
158216 reads; of these:
158216 (100.00%) were paired; of these:
35696 (22.56%) aligned concordantly 0 times
120047 (75.88%) aligned concordantly exactly 1 time
2473 (1.56%) aligned concordantly >1 times
35696 pairs aligned concordantly 0 times; of these:
4458 (12.49%) aligned discordantly 1 time
31238 pairs aligned 0 times concordantly or discordantly; of these:
62476 mates make up the pairs; of these:
56512 (90.45%) aligned 0 times
5365 (8.59%) aligned exactly 1 time
599 (0.96%) aligned >1 times
82.14% overall alignment rate
You now also get some information about the similarity to your reference sequence.
Now you need to work a little bit more on the BAM file. You need to sort and index this.
samtools sort ecoli.bam -o ecoli_sort.bam
samtools index ecoli_sort.bam
Now you can create a consensus sequence using bcftools and seqtk
bcftools mpileup -f sequence.fasta ecoli_sorted.bam | bcftools call -c | vcfutils.pl vcf2fq | seqtk seq -aQ64 -q 20 -n N > ecoli_consensus.fasta
This gives you now a sequence where unknown bases are marked as N.
As I wrote before, using anaconda would make the installation a lot easier. So you can write the following lines into the file
Now you can run following command and most of the installation part is completed. Just the database for kraken is missing.
conda env create -f bio.yaml
I hope this gives you some help how to process your data. If you need some information just let me know ;)