Calculating values of a 2d array by comparison of 2 strings



Hi. I am having a hard time dealing with a problem And I was wondering if anyone has a suggestion to how I should do this.

I have 2 strings that I want to compare. These strings are composed of amino acid residues (long sequences of any of 20 characters) these string are aligned to each other and I want to compare each position of the two strings and fill up a matrix of 21*21 so that for eg:

AAAAAA....
ATLL_Y....

1 pos: A-A -> counts 1 and adds to position [0][0] on the matrix
2 pos: A-T -> counts 1 and adds to position [0][1] on the matrix
3 pos: A-L -> counts 1 and adds to position [0][2] on the matrix
4 pos: A-L -> counts 1 and adds to position [0][2] on the matrix
5 pos: A-_ -> counts 1 and adds to position [0][21] on the matrix
6 pos: A-Y -> counts 1 and adds to position [0][10] on the matrix
....


I've been suggested by a friend to use a switch but this ends up needing 441 cases of assignments in other to fill up every position of the matrix.

Does anyone know of a better way of dealing with this? I appreciate any suggestions. Thanks

Duarte
.



Relevant Pages

  • Re: Ascan with a Substr
    ... the above suggestion: ... operator to compare the strings. ... code block you originally used was just right, ...
    (comp.lang.clipper)
  • Re: Calculating values of a 2d array by comparison of 2 strings
    ... if anyone has a suggestion to how I should do this. ... I have 2 strings that I want to compare. ... I first perform an alignment that results in positioning the sequences inthe best alignment of characters possible. ...
    (comp.lang.perl.misc)
  • Re: Calculating values of a 2d array by comparison of 2 strings
    ... I have 2 strings that I want to compare. ... If you do need the array form you can generate it from the count hash. ... Thank you very much for the suggestion... ...
    (comp.lang.perl.misc)
  • Re: Calculating values of a 2d array by comparison of 2 strings
    ... On 12/15/2006 08:48 AM, Pepetideo wrote: ... if anyone has a suggestion to how I should do this. ... I have 2 strings that I want to compare. ...
    (comp.lang.perl.misc)
  • RE: Error handling in a Do Loop
    ... I made the changes you suggested to my strings - blanking them correctly now. ... have any further suggestion or pointers, ... > When loop is able to ping a computer and able to pull the information, ... when the loop does not ping a computer/unable to ...
    (microsoft.public.windows.server.scripting)