![]() |
|
|||||||
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Consensus FASTA from BAM files | mixter | Bioinformatics | 8 | 11-14-2012 11:20 AM |
| building a consensus FASTA from BAM(s) | adaptivegenome | Bioinformatics | 0 | 11-30-2011 02:29 PM |
| NEw to Chip-seq and have .bam/.sam/.bam.bai files... then what? | NGS newbie | Bioinformatics | 11 | 05-25-2011 07:48 AM |
| Bam and Sam don't like my fasta file | mindlessbrain | Bioinformatics | 2 | 12-09-2010 10:47 PM |
| BWA sam and Samtools sam->bam conversion problem | maasha | Bioinformatics | 3 | 10-30-2009 10:58 AM |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Junior Member
Location: Canada Join Date: Apr 2010
Posts: 5
|
Hi there,
I have a couple of aligned sequences from BWA. I used samtools to get the BAM format. What I really need is the Fasta format of these aligned sequences. Is there a program that would help? Thanks. |
|
|
|
|
|
#2 |
|
Peter (Biopython etc)
Location: Dundee, Scotland, UK Join Date: Jul 2009
Posts: 1,171
|
Yes, several, including one line shell scripts.
Possibly seqret from EMBOSS 6.3.x will do what you want. See also this thread for SAM/BAM to FASTQ which is very relevant: http://seqanswers.com/forums/showthread.php?t=6164 |
|
|
|
|
|
#3 |
|
Junior Member
Location: Canada Join Date: Apr 2010
Posts: 5
|
Thanks Maubp, I just downloaded Emboss. I will get back if I bump into trouble.
Thanks very much. |
|
|
|
|
|
#4 |
|
Member
Location: milan, italy Join Date: Aug 2008
Posts: 22
|
This one liner would give you a fasta formatted file from a bam alignment:
samtools view filename.bam | awk '{OFS="\t"; print ">"$1"\n"$10}' - > filename.fasta Hope this helps. Gabriel |
|
|
|
|
|
#5 |
|
Senior Member
Location: Graz, Austria Join Date: Feb 2010
Posts: 215
|
Or picard SamToFastq:
Works with BAM Files as well and supports some other options: http://picard.sourceforge.net/comman...tml#SamToFastq |
|
|
|
|
|
#6 |
|
Junior Member
Location: New York City Join Date: May 2011
Posts: 4
|
Hi Gabriel,
Is there a way to do the opposite ? What i mean is that, i have a file called mrna_ref.fa (fasta file), can i convert it into a sam or a bam file using Samtools in the command line. Regards Teja |
|
|
|
|
|
#7 |
|
Member
Location: milan, italy Join Date: Aug 2008
Posts: 22
|
Hi Teja.
In theory you can convert a multifasta file in a sam (tabular) file, and then convert to bam with samtools view -b. But the fasta file only contains information on the nucletide sequence itself, nothing about the mapping, read quality etc... which are indeed the columns of the sam file (you will also need to rebuild the sam header). In conclusion I think it's useless to convert a fasta file into a sam file, but I can't exclude that you are dealing with something that requires such conversion. Would please briefly explain your case? Thank you. Best regards. Gabriel
__________________
gabriele bucci |
|
|
|
|
|
#8 |
|
Junior Member
Location: New York City Join Date: May 2011
Posts: 4
|
Hi Gabriel,
I want to send u the file. which is very small. Probably u can have a look at it .. Can u just send me a mail to this id, if its not a problem. tejaminnu@gmail.com Regards Teja |
|
|
|
|
|
#9 |
|
Junior Member
Location: New York City Join Date: May 2011
Posts: 4
|
Basically i have a Stand Alone Blast program running. The "fasta" file served as a reference file using which i blasted the large database file that i had. I am trying to find out if i can call SNP's using "Blast" program.
And i want to confirm it by getting the SNP's using Samtools. Is the above explanation even valid. ? Do let me know Regards Teja |
|
|
|
|
|
#10 |
|
Junior Member
Location: New York City Join Date: May 2011
Posts: 4
|
Hi Gabriel,
I want to send u the file. which is very small. Probably u can have a look at it .. Can u just send me a mail to this id, if its not a problem. tejaminnu@gmail.com Basically i have a Stand Alone Blast program running. The "fasta" file served as a reference file using which i blasted the large database file that i had. I am trying to find out if i can call SNP's using "Blast" program. And i want to confirm it by getting the SNP's using Samtools. Is the above explanation even valid. ? Do let me know Regards Teja |
|
|
|
|
|
#11 | |
|
Member
Location: milan, italy Join Date: Aug 2008
Posts: 22
|
Quote:
If I understand it right, you have to: 1) align your fasta query file (mrna_fa) to a reference with blast 2) parse the blast output to be compliant with sam 3) use samtools to call SNPs (to a properly indexed reference) for point 2) you can look at here: http://seqanswers.com/forums/showthread.php?t=3759 In general I can say that blast it's not suited for efficient SNP calling , but I may be wrong. Gabriel
__________________
gabriele bucci |
|
|
|
|
![]() |
| Tags |
| bam, bwa, fasta, sam |
| Thread Tools | |
|
|