Find complete region between lines
I have a file which looks like this:
chr1 20 100 0
chr1 50 250 1
chr1 70 500 4
chr1 100 250 1
chr1 500 800 0
chr2 50 80 2
chr2 70 100 3
chr2 159 800 0
And want to find the complete region between the zeros in column 4 for which the region contains a 4.
So for this example I want to get as output only:
chr1 50 250
because the first region between the zeros contained a 4 and the second region between the zeros didn't.
Because Im pretty new with java I have no idea how to do this.
First I wanted to put all regions between the zeros in an array and later look if there in a 4 in that array. If there is, return that array.
But I didn't know how to do this exactly
Could somebody help me?
Re: Find complete region between lines
Is this pixel data or what? Can you describe that the input represents?