Hi, I have a file like this. I have to put some criteria like if chromosome matched, then check start position matched; if matched then check for end position matched. If it ends position not matched then put value 1.1 else put value 1
Chromosome Start End
1 990595 990685
1 990595 990882
1 1459777 1460585
1 1563779 1563827
2 1564102 1564215
2 1564108 1564219
I am looking for output like this
Chromosome Start End
1 990595 990685 1.1
1 990595 990882 1.2
1 1459777 1460585 2
1 1563779 1563827 3
2 1564102 1564215 1
2 1564108 1564219 2
You probably need:
Or from data.table package:
What have you tried? Please add some context (on the biological problem you're trying to solve) so this pure R question can qualify as a bioinformatics question.
Ok I will modify the question for better understanding.
This looks like an XY problem. What are you doing this exercise for?
I have to find the overlap region if it has been found then add new column like serial number 1.1, 1.2 etc
That is a verbatim description of the problem, not the reason why this problem needs solving (See what an XY problem means). There is also another factor you have not mentioned: the numbering resets with the start of a new chromosome. This is quite the convoluted logic and I don't know why you're doing it, so I want to make sure this problem needs solving before starting to solve it.