Entering edit mode
5.4 years ago
star
▴
350
I have three tables contain variation, I would like to merge all three make together and have a table as below. I would like to consider A coordinate (chr and start) as the base of merging and if there are the same coordinate in B and C data put them beside A coordinate otherwise put '.' value instead.
A data:
chr1 19004 A G
chr1 19858 C T
chr1 46633 T A
chr1 28563 A G
chr1 66974 TG T
B data:
chr1 19322 C T
chr1 19858 C T
chr1 63527 T C
chr1 66974 TG T
C data:
chr1 19004 T G
chr1 46633 T A
chr1 64548 A C
chr1 66974 TG T
Desired output:
A.chr A.start A.1 A.2 B.chr B.start B.1 B.2 C.chr C.start C.1 C.2
chr1 19004 A G . . . . chr1 19004 A G
chr1 19858 C T chr1 19858 C T . . . .
chr1 46633 T A . . . . chr1 46633 T A
chr1 28563 A G . . . . . . . .
chr1 63527 T C . . . . . . . .
chr1 64548 A C . . . . . . . .
chr1 66974 TG T chr1 66974 TG T chr1 66974 TG T
You should really try and find answers for these kinds of problems yourself. I remember you asked this kind of question before in a different context and got many solutions. Try to understand the logic behind it. There is no point in spoon-feeding as you cannot abstract it to different problems.
Relevant SO post: