Entering edit mode
9.4 years ago
federica.r299
•
0
I am trying to convert the output of blast in a .sam or .bam file. I tried to use the blast2sam tool but there are many warnings and the output file is not complete.
Is there another tool to make the conversion or another alignment tool for which it is possible to specify the output format as .sam or .bam?
Thanks
Take a look at Peter Cock's post: http://blastedbio.blogspot.com/2015/07/ncbi-working-on-sam-output-from-blast.html
Maybe there is something wrong with your input rather than with the tool you use? You should post the exact command you executed and some or all the warnings you see and give details of the input file, like format and a few example lines.
There is a blast2bam converter, is it the one you used? (You mention blast2sam).
The alignement of the reads has been done with the command
This is the first line of the output
blast_tab
:Then the conversion has been done with the command blast2sam (not blast2bam)
For the conversion we didn't use the default format, but the tabular format of the output of blast.
In the conversion there aren't errors, but the output file blast.sam is empty.
Where can be the error?
I think blast2sam.pl has not been updated for some time as Heng Li said:
That is part of why I wrote Blast2Bam.
If you want to use it, blast output will have to be in XML format (
-outfmt 5
).I downloaded the code, but I'm not able to create the ref.dict. How can I do it?
Then in the folder "src" there are two codes (blastSam.c and blastSam.h), so which one should I use?
Thanks
The .dict file is created by picard-tools:
In your case:
The src folder contains the source code, not the program.
You need to compile the code first by typing "make" in your command line in the main folder or in the src folder.
The program will then be in the bin folder.
You can then pipe the output of blastn in the program:
By typing
make
in src folder there is an errorAs Pierre told you on seqanswers.com, you got this error because xsltproc wasn't installed on your computer.
In order to compile Blast2Bam, you will also need libxml2, zlib and of course gcc.
If your XML is big, you should pipe the blast output into Blast2Bam, like I've shown you in my previous comment.
Again, if you're afraid the SAM file will be too big, you should pipe the output of Blast2Bam into SAMtools to make a BAM file:
-F 0xF00 is used to filter the results in order to keep only the primary alignments. You may or may not want to use this option depending on what you want to do with the results.
I got it working. Thank you.