I have a tab delimited table (Table1)
a b c
A 0.5 0.2 0
B 0 0.5 0.4
C 1 0.3 0.4
D 0.2 0 0.2
And a tab delimited file (File1)
A 0.3
B 1
C 0.5
D 0.5
I want to multiple every number in each row in Table1 (for example, Row A (0.5 0.2 and 0)),by the number in the row with the same name in File1 (Row A (0.3)). So for Row A it would be 0.5 * 0.3, 0.2 * 0.3 and 0 * 0.3.
Desired output:
a b c
A 0.15 0.06 0
B 0 0.5 0.4
C 0.5 0.15 0.2
D 0.1 0 0.1
To clarify, this is an example table. The letters are variables representing the column/row names - there may be hundreds of columns and rows. Note that the real column/row names may contain numbers, which should not be altered by the script. For Example, Row "A" might be named "ABC123"
Help is greatly appreciated.
A B C
while file2 isB C A
for example? Are all row names from file1 always present in file2 and vice-versa?