Hi Friends,
Hope all is well.
I have an input file like this
a gene1 10
b gene1 2
c gene2 20
c gene3 10
d gene4 5
e gene5 6
Steps to reach output.
- Print unique values of column1 as column of the matrix, which will be
a
b
c
d
e
- Print unique values of column2 as row of the matrix, which will be
gene1 gene2 gene3 gene4 gene5
- Now print column3 values in the matrix, which will be my final output
gene1 gene2 gene3 gene4 gene5
a 10 0 0 0 0
b 2 0 0 0 0
c 0 20 10 0 0
d 0 0 0 5 0
e 0 0 0 0 6
My special condition is nothing but, if there is no value for a combination, print that value to be 0. My input file has more than 50K records. Please let me know if you have any questions. Thanks in advance.
The spacing is messed up while posting this thread. But, my output columns are separated by a tab.