Inp1
Code:
Ang_0 chr1 98 T A Ang_0 chr1 352 G A Ang_0 chr1 425 C T Ang_0 chr2 471 T G Ang_0 chr2 508 T -
Inp2
Code:
Bng_0 chr1 98 T G Bng_0 chr1 352 G A Bng_0 chr2 471 T A Bng_0 chr2 508 T -
Inp3
Code:
Cng_0 chr1 198 T A Cng_0 chr1 352 G A Cng_0 chr1 425 C T Cng_0 chr2 471 T G
Code:
Ang_0 Bng_0 Cng_0 chr1 98 A G T chr1 198 T T A chr1 352 A A A chr1 425 T C T chr2 471 G A G chr2 508 - - T
#########
Code:
awk '!($1in colnum ) {Title [++col ]=$1;colnum [$1]=col } {i =colnum [$1]def [$2,$3]=$4Val [i ,$2,$3]=$5 }END { $0=""for (i =1;i <=col ;i ++) $(i +2)=Title [i ]for (v in def ) { $0=""split (v ,f ,SUBSEP ) $1=f [1] $2=f [2]for (i =1;i <=col ;i ++) {if ((i SUBSEP f [1]SUBSEP f [2])in Val ) $(i +2)=Val [i ,f [1],f [2]]else $(i +2)=def [f [1],f [2]] }OFS ='\t 'inp * > result_file
没有评论:
发表评论