Error when runing Bowtie2: (ERR): bowtie2-align exited with value 1
0
0
Entering edit mode
15 months ago
luzglongoria ▴ 50

Hi there,

I'm running this command with Bowtie2:

bowtie2 --threads 20 --no-unal -x /Path/to/Indexed/Genome/file.fna -q -k 1 --al file.fastq -U -b --align-paired-reads input.bam | samtools view -b -o output.bam

I'm getting this error message:

Error: Encountered internal Bowtie 2 exception (#1)
Command: ALL My COMAND --passthrough -U -b 
(ERR): bowtie2-align exited with value 1

I think, the problem is that I need to use a unique input file (with paired reads inside from a previous alignment). This file is in BAM format. Reading Bowtie2 manual I found :

-b 

Reads are unaligned BAM records sorted by read name

--align-paired-reads

Bowtie 2 will, by default, attempt to align unpaired BAM reads. Use this option to align paired-end reads instead.

I've read about this problem, it's related to my bowtie version? Mine is bowtie2-2.2.5.

Maybe I should try with another alignment tool? STAR ?

Thank you in advance.

PS: I've tried to run it with .SAM file (as the input) by doing:

bowtie2 --threads 20 --no-unal -x //Path/to/Indexed/Genome/file.fna -q -k 1 --al file.fastq  -S no_aligned_COLL4_parasite.sam | samtools view -b -o outfile.bam
BAM Bowtie • 2.0k views
ADD COMMENT
2
Entering edit mode

I think the problem is that you are using both -b and -U. Also, file should be next to the parameter, just like:

-b input.bam

Also, take into account that bowtie should only be used for genomic reads and not from RNA-seq. For RNA, use either STAR or HISAT2.

ADD REPLY
0
Entering edit mode

Thank you so much.

I have been reading STAR manual but I donde find any function where you can use an input with an aligned read BAM file.

Maybe STAR does not have that option?

ADD REPLY
2
Entering edit mode

I need to use a unique input file (with paired reads inside from a previous alignment).

Also make a note of what you wrote above. BAM file needs to contain "unaligned" reads. You have an aligned BAM file.

Best option may be to recover fastq reads from your aligned BAM and then use them for alignment.

ADD REPLY
0
Entering edit mode

Thanks. I didn't know that we can recover fastq reads from an aligned BAM file. Is there any specific program for that?

ADD REPLY
1
Entering edit mode

samtools collate (to name sort the BAM).

Followed by samtools fastq (can be done in one pipe).

reformat.sh from BBMap suite. (check in-line help)

bamtofastq from BEDtools.

Look for threads here about conversion of BAM to fastq.

ADD REPLY
0
Entering edit mode

Thanks !

Could you please explain me what's the point of using reformat.sh ?

I've read it is used for any file format conversion but , in in my case, samtools create a fastq file as an output and bamtofastq from BEDtools uses this format.

I'm missing something, sor sure.

Could you please indicate why I need to use reformat.sh ?

ADD REPLY
0
Entering edit mode

You don't need to use reformat.sh. It was one of the three options for doing the conversion.

ADD REPLY
0
Entering edit mode

I've tried with samtools collate but it stars to create files as name.bam.001.bam (until number 63) and then stop printing a lot of random numbers and letter.

I used then

samtools sort -n -o outputfile.sorted.bam in.bam

and after that tried to run BEDtools:

bedtools bamtofastq -i outputfile.sorted.bam \
                      -fq aln.end1.fq \
                      -fq2 aln.end2.fq

Although the output files (fastq) star to being created I get thousand of error messages as :

*****WARNING: Query [...] is marked as paired, but its mate does not occur next to it in your BAM file. Skipping

I understand the file is not sorted by name properly, so if I used those .fastq files there won't be all the reads I should have , right?

ADD REPLY
1
Entering edit mode

If you were able to sort the file using samtools then you could have used samtools fastq to do the conversion.

I mentioned three ways of doing the conversion. samtools, refotmat.sh from BBMap and bedtools. They are all independent.

A potential way of using reformat.sh with name sorted BAM would be reformat.sh -Xmx10g in=name.sort.bam out1=R1.fq.gz out2=R2.fq.gz pairedonly=t primaryonly=t.

BTW samtools collate | samtools fastq should have worked as well.

ADD REPLY

Login before adding your answer.

Traffic: 3199 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