Entering edit mode
13 months ago
star
▴
350
I have a table like below. How to count the number of unique different letters in all columns except (column1) for all rows versus row 1.
Input:
query letter_1 letter_2 letter_3 letter_4 letter_5 letter_6 letter_7 letter_8 letter_9
1 lcl|Query_10001 M E K I V L L F A
2 lcl|Query_10002 M E K I G K L L S
3 lcl|Query_10003 M E K I M L L L A
Output:
query. letter_1 letter_2 letter_3 letter_4 letter_5 letter_6 letter_7 letter_8 letter_9
1 lcl|Query_10001 M E K I V L L F A
2 lcl|Query_10002 M E K I G K L L S
3 lcl|Query_10003 M E K I M L L L A
4 differences 0 0 0 0 2 1 0 1 1
Read up on XY problems. That's what you're doing here as well as in your previous question here: how calculate different amino acids in a aligning format?
It looks like you wish residue level counts of unique bases (AKA conservation scores), which is not an uncommon problem in the alignment context. Search online - R is not the best way to do this.