SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to convert a SNP.txt to a bed file or get a SNP.bed from samtools? Ling Bioinformatics 7 04-02-2015 06:17 AM
To convert BAM file to BED file Anjali Bioinformatics 10 04-28-2014 04:43 AM
Convert merged BAM back to per lane BAM or FASTQ file danielsbrewer Bioinformatics 6 10-03-2013 07:29 AM
Perl script to convert BAM to BED? rebrendi Bioinformatics 3 03-22-2012 10:34 PM
How to convert BED format to SAM/BAM? seq_newbie Bioinformatics 1 06-23-2011 08:11 AM

Reply
 
Thread Tools
Old 05-22-2012, 11:37 PM   #1
adurasiwam3
Member
 
Location: singapore

Join Date: Apr 2012
Posts: 12
Default help - convert .bed to .bam

hi,

i need to convert a .bed file to .bam. I've tried using BEDTools, but i've been running into a lot of issues with it.

are there any other tools/methods out there to do this?

thanks
adurasiwam3 is offline   Reply With Quote
Old 05-22-2012, 11:41 PM   #2
arvid
Senior Member
 
Location: Berlin

Join Date: Jul 2011
Posts: 156
Default

What are the issues with bedtools? If you post a few lines of your bed file, maybe these issues could be sorted out.
arvid is offline   Reply With Quote
Old 05-22-2012, 11:45 PM   #3
adurasiwam3
Member
 
Location: singapore

Join Date: Apr 2012
Posts: 12
Default

hi,

thanks for your reply.

so the current issue i'm having is:

Error: BED entry without name found at line: 1. Exiting!

the command I gave in UNIX is:

bedToBam -i chr1.bed -g hg18.txt > chr1.bam

chr1.bed (bed file for only chromosome1) looks like this:

chr1 100000000 100000036
chr1 100000040 100000076
chr1 100000090 100000126
chr1 100000136 100000172
chr1 100000189 100000225
chr1 100000235 100000271
chr1 100000287 100000323
chr1 100000336 100000372
chr1 100000401 100000437
chr1 100000452 100000488
chr1 100000512 100000548..
.....

and hg18.txt looks like this:

chr1 247249719
chr10 135374737
chr11 134452384
chr12 132349534
chr13 114142980
chr14 106368585
chr15 100338915

thanks!
adurasiwam3 is offline   Reply With Quote
Old 05-22-2012, 11:57 PM   #4
Hobbe
Member
 
Location: Uppsala, Sweden

Join Date: Apr 2010
Posts: 29
Default

The bed file seems very sparse to me. BedToBam seems to be looking for a name which should be in a fourth column. Haven't really tried BedToBam, but that is my guess.
Hobbe is offline   Reply With Quote
Old 05-23-2012, 12:14 AM   #5
arvid
Senior Member
 
Location: Berlin

Join Date: Jul 2011
Posts: 156
Default

Yes, that's the problem. Try the following:

Code:
cat chr1.bed | awk '{x++; printf "%s\tread%d\n",$0,x}' | bedtools bedtobam -g hg18.txt -i - > chr1.bam
I get the following output then, when converted to SAM (with samtools view):

Code:
read1   0       chr1    100000001       255     36M     *       0       0       *       *
read2   0       chr1    100000041       255     36M     *       0       0       *       *
read3   0       chr1    100000091       255     36M     *       0       0       *       *
read4   0       chr1    100000137       255     36M     *       0       0       *       *
read5   0       chr1    100000190       255     36M     *       0       0       *       *
read6   0       chr1    100000236       255     36M     *       0       0       *       *
read7   0       chr1    100000288       255     36M     *       0       0       *       *
read8   0       chr1    100000337       255     36M     *       0       0       *       *
read9   0       chr1    100000402       255     36M     *       0       0       *       *
read10  0       chr1    100000453       255     36M     *       0       0       *       *

Last edited by arvid; 05-23-2012 at 12:15 AM. Reason: typo
arvid is offline   Reply With Quote
Old 05-29-2012, 07:04 PM   #6
adurasiwam3
Member
 
Location: singapore

Join Date: Apr 2012
Posts: 12
Default

thanks a lot for helping out! really appreciate it.
adurasiwam3 is offline   Reply With Quote
Reply

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:20 PM.


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