align fasta files using bowtie2
1
3
Entering edit mode
7.5 years ago

dear all,

it is possible to use bowtie2 to align fasta files rather than fastq? essentially I would like to use bowtie just like an aligner such as muscle, taking advantage of the greater computational speed of the former. In the handbooks I found that this is possible but there is no example.

I created a reference sequence ref_idx with bowties2-build; if input.fa is the file i want to align, what would be the syntax? I wrote:

bowtie2 -q -x ref_idx -U  input.fa -S output_aln

but I got the error: Error: reads file does not look like a FASTQ file terminate called after throwing an instance of 'int' Aborted (core dumped) (ERR): bowtie2-align exited with value 134

If this is possible, would bowtie work also with multifasta files?

thank you

alignment genome sequencing • 22k views
ADD COMMENT
0
Entering edit mode

First:

 bowtie2 -p 8 -x index_file -f fasta_reads.fasta -S result.sam

Then,

$ samtools view -bS result.sam > file_out.bam
$ samtools sort file_out.bam file_.sort
$ samtools index  file_.sort

And finally load the bam final in IGV to visualize it (after load your fasta reference)

ADD REPLY
0
Entering edit mode

thank you! it is possible to convert the file back into fasta directly? I tried with

samtools bam2fq 16S_africanum_srt.bam.bai | seqtk seq -A > 16S_africanum.fa

but i got: [bam_header_read] EOF marker is absent. The input is probably truncated. [bam_header_read] invalid BAM binary header (this is not a BAM file). and an empty file. With:

samtools bam2fq 16S_africanum_srt.bam | seqtk seq -A > 16S_africanum.fa

I also got and empty file.

ADD REPLY
0
Entering edit mode

how to I provide index file?

ADD REPLY
1
Entering edit mode
7.5 years ago

Sorry, that was a silly question. the problem was in the input file: the option -q stands for fastq files; -f is for fasta and multifasta. Using

bowtie2 -f -x ref_idx -U  input.fa -S output_aln

resulted in the alignment. Case closed.

ADD COMMENT
0
Entering edit mode

however the resulting file is not a real alignment!

ADD REPLY
1
Entering edit mode

Case back open.

Use bbmap.sh from BBMap suite.

bbmap.sh in=your.fa out=align.sam ref=ref.fa any_other_options

ADD REPLY
0
Entering edit mode

thank you! this was a fast alternative to bowtie. the problem is how to convert the sam file to an aligned fasta. I ran:

bbmap.sh in=your.fa out=align.sam ref=ref.fa  
samtools view -Sb  align.sam  >  align.bam
samtools sort align.bam align_srt
samtools index align_srt.bam
samtools bam2fq align_srt.bam | seqtk seq -A > align.fa

and I obtained an empty file. same thing when using align.bam and align.bam.bai. I am missing something...

ADD REPLY

Login before adding your answer.

Traffic: 1606 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6