I have two Numpy arrays which I need to combine maintaining only certain columns from A - size (888, 1114253), depending on the rows I have in B - size (555861, 3).
The problem is that the header of A is 55730: each column has two values!
In other words I want to get only the columns of A where the header corresponds to the rows in B, but in A each column is "double"
An example will clarify:
A:
family id mum dad rs1 rs2 rs3 rs4 rs5 rs6 rs7 rs8 rs9 rs10 rs11 rs12
1 1 4 6 A T A A T T C C G G A T A G A A G A T A G G C C
2 2 7 9 T A G A C T C T G A T T A A A C G G T A C C C T
3 3 2 8 T T G G C T C T G G A T A G A C G G T T C C C C
4 4 5 1 A A A A T T C C G A T T A A A A G A T A G C C T
Since in this file each rsxxx column header has two corresponding columns, I have to find a way to put them together, so I can read the file as an array
B:
1 rs1 2345
1 rs2 2346
2 rs5 2348
4 rs8 2351
4 rs12 2360
The desired output is
Output:
family id mum dad rs1 rs2 rs5 rs8 rs12
1 1 4 6 A T A A G G A A C C
2 2 7 9 T A G A G A A C C T
3 3 2 8 T T G G G G A C C C
4 4 5 1 A A A A G A A A C T
Ideas?
On the console
B:
array([['1', 'rs3094315', '752566'],
['1', 'rs12562034', '768448'],
['1', 'rs3934834', '1005806'],
...,
['23', 'rs2032612', '21866491'],
['23', 'rs2032621', '21872738'],
['23', 'rs2032617', '21896261']],
dtype='<S10')