SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert sam/bam or bed file into wig file roll Bioinformatics 5 02-05-2014 04:43 AM
How do you convert a SAM/BAM file to a PSL or AXT format? lpipes Bioinformatics 1 07-30-2013 02:16 PM
SAM file without a header. Can't convert to BAM Malfet Bioinformatics 6 01-17-2013 08:39 AM
How to convert a bam file to sam file badhikari Bioinformatics 2 04-01-2011 08:56 AM
How to convert Eland file to BAM or SAM? fanshu Bioinformatics 0 10-30-2010 11:46 PM

Reply
 
Thread Tools
Old 07-15-2015, 01:04 AM   #1
federica.r
Junior Member
 
Location: Italy

Join Date: Jul 2015
Posts: 4
Default How to convert blastn output file to sam/bam

I am trying to convert the output of blast in a .sam or .bam file using the blast2sam tool.

The alignement of the reads has been done with the command

blastn -query 130205_UNC11-SN627_0280_AC1NEKACXX_TTAGGC_L004_1.fasta -db blast_ref -word_size 15 -outfmt "6 qseqid sseqid pident nident length mismatch positive gapopen gaps ppos qframe sframe sstrand qcovs qstart qend qseq sstart send sseq evalue bitscore score" -out blast_tab

This is the first line of the output blast_tab:

UNC11-SN627:280:C1NEKACXX:4:1101:11031:1976 sequenzadifusione 93.62 44 3 44 0 0 93.62 1 1 plus 98 2 48 TGAACCCGGGAGGTGGAGGTTGCAGTGAGCCGAGATTGCGCCACTGC 24710 24756 TGAACCCGGGAGGTGGAGGCTGCAGTGAGCTGAGATAGCGCCACTGC 6e-16 71.3 38

Then the conversion has been done with the command blast2sam (not blast2bam)

blast2sam.pl blast_tab > blast.sam

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?
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?
federica.r is offline   Reply With Quote
Old 07-15-2015, 01:19 AM   #2
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 6,780
Default

Try the new code mentioned in this thread at the end: https://www.biostars.org/p/53434/ You will need to have your blast results in XML format (based on the readme for the new code).
GenoMax is offline   Reply With Quote
Old 07-15-2015, 01:36 AM   #3
federica.r
Junior Member
 
Location: Italy

Join Date: Jul 2015
Posts: 4
Default

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
federica.r is offline   Reply With Quote
Old 07-15-2015, 02:57 AM   #4
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 6,780
Default

Quote:
Originally Posted by federica.r View Post
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
That is source code. You will need to compile it into an executable using a compiler (gcc). What OS are you using?

You may also have to re-run your blast to get output in XML format (unless there is a tab to XML converter available).
GenoMax is offline   Reply With Quote
Old 07-15-2015, 03:10 AM   #5
federica.r
Junior Member
 
Location: Italy

Join Date: Jul 2015
Posts: 4
Default

Quote:
Originally Posted by GenoMax View Post
That is source code. You will need to compile it into an executable using a compiler (gcc). What OS are you using?

You may also have to re-run your blast to get output in XML format (unless there is a tab to XML converter available).
I am using Linux.
Where can I find the tab to XML converter?
federica.r is offline   Reply With Quote
Old 07-15-2015, 03:27 AM   #6
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 6,780
Default

Quote:
Originally Posted by federica.r View Post
I am using Linux.
Where can I find the tab to XML converter?
Were you able to compile the program?

XML converter: https://www.biostars.org/p/7981/

Ideally you should re-run the blast and save output as XML.
GenoMax is offline   Reply With Quote
Old 07-15-2015, 03:27 AM   #7
lindenb
Senior Member
 
Location: France

Join Date: Apr 2010
Posts: 143
Default

* ref.dict is created with picard CreateSequenceDictionary http://broadinstitute.github.io/picard/
* to compile the C program you need : GNU make and the GCC 'C compiler'
* "Where can I find the tab to XML converter? " you can't : it's like creating a cow from a steak.
lindenb is offline   Reply With Quote
Old 07-15-2015, 04:58 AM   #8
federica.r
Junior Member
 
Location: Italy

Join Date: Jul 2015
Posts: 4
Default

Quote:
Originally Posted by GenoMax View Post
Were you able to compile the program?

XML converter: https://www.biostars.org/p/7981/

Ideally you should re-run the blast and save output as XML.
We tried to compile the program, but there is the following error:

xsltproc --output parseXML.c --stringparam fileType c schema2c.xsl schema.xml
make: xsltproc: Command not found
make: *** [parseXML.c] Error 127

What does it mean?

We are also trying to run blast to obtain the XML output but it's taking a really long time (almost 24 hour, probably because the output is very big).

Thank you
federica.r is offline   Reply With Quote
Old 07-15-2015, 05:04 AM   #9
lindenb
Senior Member
 
Location: France

Join Date: Apr 2010
Posts: 143
Default

as specified in the Requirements section of https://github.com/guyduche/Blast2Bam , xsltproc is required . On most linux there is a command to quickly install it . Something like 'sudo apt-get install xsltproc'

"probably because the output is very big" : yes, because the sequences are fetched+added. You can pipe the output into gzip to reduce the size of the XML, or directly pipe the output of blasn into blast2sam as shown in https://github.com/guyduche/Blast2Ba...ster/README.md
lindenb is offline   Reply With Quote
Old 07-15-2015, 05:05 AM   #10
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 6,780
Default

You may need to install libxslt (and perhaps libxml2 as well). Install instructions would vary depending on what kind of linux distro you are using.
GenoMax is offline   Reply With Quote
Old 07-15-2015, 11:36 AM   #11
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,540
Default

It isn't ready yet, but the NCBI seem to be working on adding SAM output to BLAST+ itself:
http://blastedbio.blogspot.co.uk/201...rom-blast.html
maubp is offline   Reply With Quote
Reply

Tags
blast, blast+, blast2bam, blast2sam

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 09:34 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO