This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bowtie alignment after adapter removal with trimmomatic

Dear all,

How can I feed Bowtie2 after trimming the fastaq files through trimmomatic?

The output of the trimmomatic implementation returns 4 files, which can be called let's say paired1, paired2, unpaired1 and unpaired2, and I created the index reference file idx_refile. I therefore used this kind of command:

bowtie2 -x idx_refile -1 paired1 -2 paired2 -U unpaired1, unpaired2 -S output.sam

but I got the following error:

Extra parameter(s) specified: "unpaired2"
Note that if <mates> files are specified using -1/-2, a <singles> file cannot
also be specified. Please run bowtie separately for mates and singles.
Error: Encountered internal Bowtie 2 exception (#1)
(ERR): bowtie2-align exited with value 1

How can I separate the unpaired files? The comma did not work.

Thank you

trimmomatic trimming bowtie alignment

You shouldn't have a space after the comma

1 answer

The message is pretty clear:

Note that if <mates> files are specified using -1/-2, a <singles> file cannot also be specified.

So you should run once for the paired reads, and again for the singles.

so it should be like

bowtie2 -x idx_refile paired1 -U unpaired1 -S output1.sam
bowtie2 -x idx_refile paired2 -U unpaired2 -S output2.sam

but then how can I combine the two output files?

Short answer:

samtools merge

Some longer answers here.

I tried with the following:

bowtie2 -x idx_refile -1 paired1 -U unpaired1 -S A.sam
bowtie2 -x idx_refile -1 paired1 -U unpaired1 -S B.sam

samtools view -bS A.sam > A.bam
samtools view -bS B.sam > B.bam

samtools merge output.bam A.bam B.bam

but I got the following error:

[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).
[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).
Segmentation fault (core dumped)

Where I got it wrong?

Tx

Please, take a bit of time to read the manuals of the programs you are using:

With no options or regions specified, prints all alignments in the specified input alignment file (in SAM, BAM, or CRAM format) to standard output in SAM format (with no header).

You want to use samtools view -h

Log in to answer this question.