Hi Guys, Just a quick question. Its more of a Bash question rather than Bioinformatics, with Bedtools in question.
I mostly pipe
the bedtools I/O.
Here's a general scenario :
sed 1d fileA.bed | intersectBed -a stdin -b peaks.bed | intersectBed -u -a stdin -b fileB.bed
Now, the problem is fileB
is also having a head, which is reported as an error by intersectBed (makes sense, non-integer start).
How can I remove the first line or the head of the fileB on the fly in the pipe.
Thanks
If I am right, this is a bash trick, which can be used with any programs, irrelevant of bedtools and its versions. But as it is shell dependent, you cannot use it in a C-shell.
That's right, FIFOs are a shell technology, not a bedtools technology. What @Daler is describing is that, owing to a silly mistake, early versions of bedtools were incapable of using FIFOs as input.
That's a great news and post!! Cheers
Very cool, I didn't know you could do this. I'm going to have to start using this method.
More generally, sed can be used to extract any part of a multiline text file, between lines n and m and you can do a similar trick by piping head and tail, see e.g. http://linux.byexamples.com/archives/130/head-and-tail/