paste PCA.WT.50kb.chr19.bedgraph PCA.TU.50kb.chr19.bedgraph | awk 'BEGIN{FS="\t";OFS="\t"}{if ($4>0 && $8>0) print $1,$2,$3,"A2A";else if ($4<0 && $8<0) print $1,$2,$3,"B2B";else if ($4>0 && $8<0) print $1,$2,$3,"A2B"; else if($4<0 && $8>0) print $1,$2,$3,"B2A"; else print $1,$2,$3,"."}' > PCA.WT2TU.50kb.chr19.bedgraph
前提是A/B已经正确矫正!
查看A/B转换的情况:
awk '{print $4}' PCA.WT2TU.50kb.chr19.bedgraph | sort | uniq -c
109 A2A
498 A2B
457 B2A
96 B2B
输出A2B和B2A:
grep 'A2B' PCA.WT2TU.50kb.chr19.bedgraph > A2B.bed
grep 'B2A' PCA.WT2TU.50kb.chr19.bedgraph > B2A.bed
网友评论