I have file 1 like following:
1 15776220 15776240 GTGACCAGCAGGTGTCTCTG 16855676 16855696 CTGTCCAGCAGAGGGCGGTG
And file 2 as following
1 15776231 2 5008 G:5002 A:6 1 16855677 2 5008 A:5003 C:5
I am trying to write a code(but failing!) to do the following:
if $2
of file2 comes in between $2
and $3
of file1 (between the interval of $2
and $3
) and if $8
of file2 comes in between $5
and $6
of file1 (between the interval of $5
and $6
), then the output would be $1,$2,$3,$4
from file1 and $2,$3,$4,$5,$6
from file2 and $5,$6,$7
from file1 and $8,$9,$10,$11,$12
from file 2, all in one line. So something like this:
1 15776220 15776240 GTGACCAGCAGGTGTCTCTG 15776231 2 5008 G:5002 A:6 16855676 16855696 CTGTCCAGCAGAGGGCGGTG 16855677 2 5008 A:5003 C:5
Something like bedtools does but I am not able to use bedtools one this since I don't have two columns in file2. Is there any way to make bedtools work on this?
(There could be many lines from file2 intersecting between the same line in file1,so that line could be repeated)