A tarefa cheira como um trabalho para o awk:
$ cat locus_file.txt
LOC_Os02g47020, LOC_Os03g57840,0.88725114
LOC_Os02g47020, LOC_Os07g36080,0.94455624
LOC_Os02g47020, LOC_Os03g02590,0.81881344
$ cat attr.txt
blue LOC_Os02g47020
red LOC_Os02g40830
blue LOC_Os07g36080
yellow LOC_Os03g57840
red LOC_Os03g02590
$ awk 'BEGIN { while(getline<"attr.txt">0) c[$2]=$1 ; FS=",[ ]*" ; OFS=", " } { print $1,$2,$3,c[$1],c[$2] }' locus_file.txt
LOC_Os02g47020, LOC_Os03g57840, 0.88725114, blue, yellow
LOC_Os02g47020, LOC_Os07g36080, 0.94455624, blue, blue
LOC_Os02g47020, LOC_Os03g02590, 0.81881344, blue, red
Se você quiser "," em vez de "," ou algo diferente, basta alterar OFS
:
$ awk 'BEGIN { while(getline<"attr.txt">0) c[$2]=$1 ; FS=",[ ]*" ; OFS="," } { print $1,$2,$3,c[$1],c[$2] }' locus_file.txt
LOC_Os02g47020,LOC_Os03g57840,0.88725114,blue,yellow
LOC_Os02g47020,LOC_Os07g36080,0.94455624,blue,blue
LOC_Os02g47020,LOC_Os03g02590,0.81881344,blue,red