This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Blast grep based on the first unique value

I have a blast table out like this

Ref1    xzxzxzz00000135960.1    51.74   259 125 0   1   259 125 383 3e-85   269
Ref1    xzxzxzz00000126626.2    50.20   249 124 0   11  259 2   250 8e-79   248
Ref1    xzxzxzz00000137335.1    49.81   259 130 0   1   259 125 383 1e-78   252
Ref1    ASNP00000445420.1   49.42   259 131 0   1   259 125 383 3e-78   251
Ref1    xzxzxzz00000126626.2    52.20   349 124 0   11  259 2   250 8e-79   248
Ref1    ASNP00000445420.1   49.80   255 128 0   1   255 125 379 2e-77   249
Ref1    ASNPCAP00000013746.1    47.88   259 135 0   1   259 106 364 1e-76   243
Ref2    xzxzxzz00000108341.3    26.38   163 87  8   11  140 156 318 5e-04   43.9
Ref2    ASNP00000026303.9   26.38   163 87  8   11  140 149 311 5e-04   43.9
 Ref2   xzxzxzz00000108321.3    16.38   163 87  8   11  140 156 318 5e-04   43.9
Ref2    ASNP00000108340.1   26.38   163 87  8   11  140 149 311 5e-04   43.9
Ref2    ENSLAFP00000015342.3    25.45   165 86  9   11  140 150 312 0.002   41.6

and I need output like this

Ref1    xzxzxzz00000135960.1    51.74   259 125 0   1   259 125 383 3e-85   269
Ref1    ASNP00000445420.1   49.42   259 131 0   1   259 125 383 3e-78   251
Ref1    ASNPCAP00000013746.1    47.88   259 135 0   1   259 106 364 1e-76   243
Ref2    xzxzxzz00000108341.3    26.38   163 87  8   11  140 156 318 5e-04   43.9
Ref2    ASNP00000026303.9   26.38   163 87  8   11  140 149 311 5e-04   43.9
Ref2    ENSLAFP00000015342.3    25.45   165 86  9   11  140 150 312 0.002   41.6

I tried with awk '!seen[$1$2]++' but it is not giving the expected one

awk bioawk

What is the logic that takes you from the input to the output? I don't see all unique combinations of $1 and $2 present in your output.

if you don't mind me asking, I don't see the rationale in the hits you are keeping for your desired output? It's apparently not the best hit per ref you are looking for. Best hit for a specific region then?

0 answers

No answers yet.

Log in to answer this question.