This is a test version of Biostars. For the public version, visit https://www.biostars.org.
replace value of each rows with value of column?
 I have a table like as below. I like to replace each sample value base on comparing with third first columns and code each value with(0,1,2,3). For example, if sample value in each row = REF_REF -> 1 ; if sample value in each row = REF_ALT -> 2 ; if sample value in each row = ALT_ALT -> 3 and for 0/0 -> 0.

    REF_REF   REF_ALT   ALT_ALT       sample1       sample2     sample3

     A/A         A/G     G/G             0/0          A/G          G/G

    T/T          T/C     C/C             T/T          T/C          T/C

    C/C          C/G    G/G              0/0          C/G          C/G

I like to make a table like as:

    REF_REF   REF_ALT   ALT_ALT       sample1       sample2     sample3

    A/A         A/G       G/G           0               2           3

    T/T         T/C       C/C           1               2           2

    C/C        C/G       G/G            0               2           2
r replace

Hello star!

Questions similar to yours can already be found at:

We have closed your question to allow us to keep similar content in the same thread.

If you disagree with this please tell us why in a reply below. We'll be happy to talk about it.

Cheers!

PS: Please do not repost the same question

0 answers

No answers yet.

Log in to answer this question.