Programmatically output is correct, but not the way OP wants. Trick is that some rows have "transmembrane" above and below (third line in this case). Current AWK code doesn't consider that. That is why it outputs only 4 lines. It should output 5 lines as per OP.
$ awk -F "\t" 'NR==FNR { array[FNR]=$3; next };{if (array[FNR-1]=="Transmembrane") $4=$4-12};{if (array[FNR+1]=="Transmembrane") $5=$5+12};/Lumenal/' test.txt test.txt
Q75T13 UniProtKB Topological domain 74 641 . . . Note=Lumenal
Q9BRR3 UniProtKB Topological domain 1 34 . . . Note=Lumenal
Q96FM1 UniProtKB Topological domain 145 181 . . . Note=Lumenal
Q96FM1 UniProtKB Topological domain 179 250 . . . Note=Lumena
line:
Q96FM1 UniProtKB Topological domain 145 181 . . . Note=Lumenal
must be broken down to:
3 Q96FM1 UniProtKB Topological domain 145 169 . . . Note=Lumenal
4 Q96FM1 UniProtKB Topological domain 157 181 . . . Note=Lumenal
as the line satisfies both the conditions.
This is the version in csv:
And the output:
Use python instead of an awk script and save the code somewhere. This is not a trivial re-formatting issue and you'll revisit this exact code some time in the future, do not waste your time writing a 'throw-away" script.
@ Rafael Soler
Why did you delete the post?
Try this in R: