SEQanswers

SEQanswers (http://seqanswers.com/forums/index.php)
-   Bioinformatics (http://seqanswers.com/forums/forumdisplay.php?f=18)
-   -   No BWA alignment output files! (http://seqanswers.com/forums/showthread.php?t=46481)

thh32 09-08-2014 12:03 PM

No BWA alignment output files!
 
Hi,

I have been using Bowtie for the last few months for alignment but now have a file for indexing which is 6Gb and Bowtie cannot deal with so I have moved onto using BWA, the indexing went fine and I got my files.

When reading the documentation is seemed as though "bwa mem" was the best option for the actual alignment however all the output is being sent to the screen and now an actual file (determined as iy is going to the output file from the cluster we have and no new files have been created).

Basically was this the correct choice and did I miss something which has caused the output of aligned and unaligned files to not be created?

here is the code I used:

bwa index -p 50Gb_index -a bwtsw contigs.fa


bwa mem -t 20 50Gb_index ../../NZ_bowtie_nonaligned_hungate_thread.done.gz


THANKS!

Brian Bushnell 09-08-2014 12:34 PM

Use the redirect operator ">" to pipe to a file:

bwa mem -t 20 50Gb_index ../../NZ_bowtie_nonaligned_hungate_thread.done.gz > mapped.sam

thh32 09-08-2014 04:06 PM

Quote:

Originally Posted by Brian Bushnell (Post 149426)
Use the redirect operator ">" to pipe to a file:

bwa mem -t 20 50Gb_index ../../NZ_bowtie_nonaligned_hungate_thread.done.gz > mapped.sam


This would work if I wanted a SAM file output but I am aiming for a similar output to that provided with bowtie where you get a file of the reads that align to the indexed file and a seperate file for reads that dont align to the indexed file.

Is there a way to do this with BWA?

Brian Bushnell 09-08-2014 04:18 PM

I don't see an option for it, though you can split the output with samtools into mapped and unmapped reads.

Alternatively, BBMap supports unlimited reference size and also separate files for mapped and unmapped reads, using the "outm=" and "outu=" flags. The output can be in sam or other formats, depending on the file extension.

dariober 09-09-2014 07:04 AM

Quote:

Originally Posted by thh32 (Post 149446)
This would work if I wanted a SAM file output but I am aiming for a similar output to that provided with bowtie where you get a file of the reads that align to the indexed file and a seperate file for reads that dont align to the indexed file.

Is there a way to do this with BWA?

Untested, but it should work in bash:

Code:

bwa mem myIndex myReads.fq.gz \
| tee >(samtools view -Sh -f4 - > unmapped.sam) \
| tee >(samtools view -Sh -F4 - > mapped.sam) > /dev/null

This sends unmapped reads (-f4) to unmapped.sam and mapped reads (-F4) to mapped.sam. You could customize the samtools commands in the subshells to decide what goes in each file (e.g. by using -q options). In fact, while you are at it, I would convert to bam and sort the mapped reads.

Dario


All times are GMT -8. The time now is 10:47 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.