I have three character strings represented below as seq1, seq2, and seq3. Each 
string has a reference character different from the other. Thus, for seq1, the 
reference character is U, seq2, S (3rd S from left where A is leftmost 
character) and for seq3 Y.
seq1 = PQRTUWXYseq2 = AQSDSSDHRSseq3 = EEZYJKFFBHO
I wish to generate a 3 by 26 matrix where 3 represent seq1, seq2, seq3 and 26 
the letters of the alphabet in order. A matrix entry should correspond to the 
number of characters from the reference character to the said character. We 
would consider characters to the left of the reference character to have a 
negative value and characters to the right a positive value. In addition, if a 
character appears more than once, we would consider the lowest of the counts.
The output for seq1, seq2, seq3 shown below where 99 indicates missing. A   B  
C  D  E  F   G   H  I   J   K  L   M  N   O  P  Q  R   S   T   U  V  W  X   Y   
Z 99 99 99 99 99 99 99 99 99 99 99 99 99 99  99  -4 -3 -2   99  0  99 99  1   2 
  3   99 -5  99 99 -2 99 99 99  1  99 99 99 99 99  99  99 -4 99  2   0   99 99 
99 99  99 99 99 99  5  99 99  2  3  99  6  99 1   2  99 99  99   7  99 99 99  
99 99 99 99 99  99  0  -1
Could someone help me with a code on how to implement this.Thank you in advance 
for your helpJN 
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to