Question: Convert .Txt Into Bed Files
2
gravatar for Bioscientist
7.7 years ago by
Bioscientist1.6k
Bioscientist1.6k wrote:

I used paired-end sequence data for copy number variation study; and eventually get .txt files as output. I'm hoping to use Bedtools to compare my results with others.

Can I convert .txt files into .bed files? (I don't see option in Bedtools)

If Bedtools is not working, what software can I use for data comparison?

my lines of txt is just like:

deletion    chr9:6169901-6173000    3100
deletion    chr9:7657401-7658800    1400
deletion    chr9:8847501-8848600    1100
deletion    chr9:10010201-10011600    1400
deletion    chr9:10126601-10127700    1100

thx

edit: I converted the txt files into bedpe format, which looks like

chr21    18542801    18543500
chr21    18545701    18545900
chr21    19039901    19040600
chr21    19164301    19169400
chr21    19366001    19370200
chr21    19639601    19640300
chr21    20493701    20495700
chr21    20581401    20583000
chr21    20880901    20882700
chr21    21558601    21559700

Then I started to compare two bedpe, looking for overlapping region, using the command like:

pairToPair -a 1.bedpe -b 2.bedpe > share.bedpe

Then I see the errors:

It looks as though you have less than 6 columns.  Are you sure your files are tab-delimited?

MY bed file have only three columns, seems it requires 6....What's the problem here? thx

bedtools comparison • 7.0k views
ADD COMMENTlink modified 7.7 years ago by Swbarnes21.4k • written 7.7 years ago by Bioscientist1.6k

Can you give a few sample lines from your .txt file?

ADD REPLYlink written 7.7 years ago by Farhat2.9k
4
gravatar for Farhat
7.7 years ago by
Farhat2.9k
Pune, India
Farhat2.9k wrote:

If you are on a unix or mac system the following command will convert to bed.

awk '{gsub(/[:-]/, "\t", $2); print $2}' infile.txt > outfile.bed
ADD COMMENTlink written 7.7 years ago by Farhat2.9k

thx, that works!

ADD REPLYlink written 7.7 years ago by Bioscientist1.6k

hi but i got another problem........can you have a look at my edit? thx

ADD REPLYlink written 7.7 years ago by Bioscientist1.6k

I guess pairToPair may be looking for strand information. You can add a dummy column to bring it to 6 since that information is not there in the txt file. awk '{gsub(/[:-]/, "\t", $2); print $2 "\t" $1 "\t0\t+" }' infile.txt > outfile.bed

ADD REPLYlink written 7.7 years ago by Farhat2.9k
1
gravatar for Swbarnes2
7.7 years ago by
Swbarnes21.4k
Swbarnes21.4k wrote:

The .bed you made is not a paired end bed, which is what the pairToPair operation calls for.

Look in the manual; a paired end bed has the start and stop coordinates of a read 1 and a read 2. You don't have that, and it doesn't look appropriate for what you want to do anyway.

I think intersectBed is probably what you want to be running; to compare your observed CNVs with other CNVs. That'll take your plain bed format.

ADD COMMENTlink written 7.7 years ago by Swbarnes21.4k

thx! this makes more sense to me now!

ADD REPLYlink written 7.7 years ago by Bioscientist1.6k
0
gravatar for Dellen Sen
7.7 years ago by
Dellen Sen0
Dellen Sen0 wrote:

What is the use of bed files?

delivery service

ADD COMMENTlink written 7.7 years ago by Dellen Sen0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1163 users visited in the last hour