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
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
Comment