rogerjms / bedtools

Automatically exported from code.google.com/p/bedtools
0 stars 0 forks source link

TSS from different strands overlapping in 1k window #108

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to get the TSS of different strands that overlap in a window of 1kb

**Query: windowBed -l 1000 -r 0 -sw -Sm -a tss.tsv -b tss.tsv 

I am not getting any output, even with lager upstream window.

Running: bedtools 2.15.0 on Ubuntu 11.10 X64

Thanks for your help,

Javi

Original issue reported on code.google.com by jdiezper...@gmail.com on 14 Jan 2012 at 11:48

GoogleCodeExporter commented 9 years ago
This is the header of the file I am using:
chr1    11870   11871   uc001aaa.3      -
chr1    11873   11874   uc001aaa.3      +
chr1    14362   14363   uc001aah.3      -
Thanks,
Javi

Original comment by jdiezper...@gmail.com on 14 Jan 2012 at 11:50

GoogleCodeExporter commented 9 years ago
The strand should be the 6th column.  In your example, it looks like your fifth 
column (score) is blank.  BEDTools requires that you put sum non-whitespace 
value in every column.  Try just adding the line number as the 5th column as 
follows

awk '{print $1"\t"$2"\t"$3"\t"$4"\t"NR"\t"$5}' tss.tsv > tss.tsv.bed

Original comment by aaronqui...@gmail.com on 14 Jan 2012 at 11:58

GoogleCodeExporter commented 9 years ago
I have checked it is the 6th column, so this is not the problem.
Thanks anyway.
Javi

Original comment by jdiezper...@gmail.com on 14 Jan 2012 at 12:02

GoogleCodeExporter commented 9 years ago
I must have been unclear.  I see that your strand _is_ the 6th column, but your 
5th column is empty.  This confuses Bedtools.  Please do the following, it 
works for me.

awk '{print $1"\t"$2"\t"$3"\t"$4"\t"NR"\t"$5}' tss.tsv > tss.tsv.bed

windowBed -l 1000 -r 0 -sw -Sm -a tss.tsv -b tss.tsv.bed
chr1    11870   11871   uc001aaa.3  1   -   chr1    11873   11874   uc001aaa.3  2   +
chr1    11873   11874   uc001aaa.3  2   +   chr1    11870   11871   uc001aaa.3  1   -

Original comment by aaronqui...@gmail.com on 14 Jan 2012 at 12:08

GoogleCodeExporter commented 9 years ago
Ok, thank you so much, now it works. (As you can see, I do not use awk ...)
Should I always fill this column when I create a .bed file?
Cheers,
Javi

Original comment by jdiezper...@gmail.com on 14 Jan 2012 at 12:15

GoogleCodeExporter commented 9 years ago
Great.  Yes, always populate every field with something.  Awk is quite the 
swiss-army knife - I use it every day.

Original comment by aaronqui...@gmail.com on 14 Jan 2012 at 12:18

GoogleCodeExporter commented 9 years ago

Original comment by aaronqui...@gmail.com on 25 Jan 2012 at 1:04