SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
How many inputs for each replicate/cell line krespim Epigenetics 0 02-22-2013 01:53 AM
coverageBed: command not found ibn.adam RNA Sequencing 6 10-29-2011 02:24 PM
coverageBed: command not found ibn.adam RNA Sequencing 0 10-29-2011 11:34 AM
Bowtie. Different outputs from equivalent(?) inputs. AEB Bioinformatics 1 08-18-2011 12:34 AM
Tophat Multiple inputs and out puts repinementer Bioinformatics 2 11-15-2010 01:58 AM

Reply
 
Thread Tools
Old 04-12-2013, 12:46 PM   #1
hari_iyer16
Junior Member
 
Location: US

Join Date: Feb 2013
Posts: 8
Default pipe two inputs to a command (coverageBed)

Hi,
I am trying to run coverageBed on my data. Since it is huge, I have to split the data into each chromosome and run them separately. coverageBed takes two input files, the data.bed file (contains the sequencing data) and the windows.bed (a file with defined windows in which the sequencing coverage has to be estimated). I thought it would be a good idea to grep for each chromosome in the data.bed and windows.bed and pipe that input to the coverageBed command. How do I simultaneously grep from two files and pass the two outputs to coverageBed? I figured how I can pipe one file (shown below), but struggling with piping two files simultaneously.
grep -w 'chr[1]' data.bed| coverageBed -counts -a stdin -b ExtraFiles_for_Analysis/windows_chr1.bed | sortBed -i stdin > chr1_coverage.txt

In the above command, windows_chr1.bed is the file containing only the windows in chromosome-1, which I had to create separately. So my goal is not to create separate files for each chromosomes a priori, and instead be able to create that in the same line.

And secondly, can I use some loop so that I can do this for each chromosome?
I searched a lot in online forums and couldn't get anything.
Thanks for any help or pointers.
Hari
hari_iyer16 is offline   Reply With Quote
Old 04-12-2013, 01:20 PM   #2
kmcarr
Senior Member
 
Location: USA, Midwest

Join Date: May 2008
Posts: 1,177
Default

You could do this with named pipes.

Code:
mkfifo data
mkfifo windows
This will create two special files in the current directory named data and windows respectively.

Code:
grep -w 'chr[1]' data.bed > data &
grep -w 'chr[1]' windows.bed > windows &

coverageBed -counts -a data -b windows | sortBed -i stdin > chr1_coverage.txt
When the coverageBed task completes the grep jobs in the background will terminate. You can then reuse the same named pipes while iterating through each of the chromosomes.
kmcarr is offline   Reply With Quote
Old 04-13-2013, 02:21 PM   #3
lh3
Senior Member
 
Location: Boston

Join Date: Feb 2008
Posts: 693
Default

coverageBed -counts -a <(grep chr1 data.beg) -b <(grep chr1 windows.beg)
lh3 is offline   Reply With Quote
Old 04-16-2013, 01:51 AM   #4
syfo
Just a member
 
Location: Southern EU

Join Date: Nov 2012
Posts: 103
Default

Quote:
Originally Posted by lh3 View Post
coverageBed -counts -a <(grep chr1 data.beg) -b <(grep chr1 windows.beg)
That looks great, thanks.
Of course do not forget the "-w" option to only grep the chr1 and not chr10, chr11 etc (I would actually use awk ' $1=="chr1" ' < data.bed).
syfo 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 07:44 AM.


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