I have a csv file with thousands of rows of the following form:
geneA geneB value
a b 5
a c 3
a d 7
b c 8
b d 1
I want to extract for each gene the two best matches with other genes in terms of highest values. For the former example the result for genes a and b would be:
a d 7
a b 5
b c 8
b a 5
Based on answer I got partly the result I wanted as it doesn't test both 1st and 2nd columns but only the first. So the result is not proper i.e. it does not take into consideration the row a b 5 when it checks for best values of b.
Any ideas what can I do?