I have a string like "ATCGGCGCCTAT" consisting of four 3-letter words (ATC,GGC,GCC,TAT). I am interested to
count the number and the kinds of letters (A,T,G,C) at 1st, 2nd and 3rd positions of these four words. I am a beginner
in perl programming. I shall be glad if any perl monk can help me by providing the syntax/perl code that can count
letters and their kinds in 1st, 2nd and 3rd position of 3-letter words. Separate scalar variable may be used for each
position and letter. For instance, for the 1st position the scalar variables may be $A1, $T1, $G1 and $C1.
Similarly, for 2nd the scalar variables may be $A2,$T2,$G2,$C2 and for 3rd position $A3,$T3,$G3 and $C3.
print" Letters at 1st position:\n
A1=$A1; T1=$T1; G1=$G1; C1=$C1; \n
Letters at 2nd position:\n
A2=$A2; T2=$T2; G2=$G2; C2=$C2; \n
Letters at 3rd position:\n
A3=$A3; T3=$T3; G3=$G3; C3=$C3; \n";
Expected results are:
The result of counting from the string should look like:
Letters at 1st position:
A1=1; T1=1; G1=2; C1=0;
Letters at 2nd position:
A2=1; T2=1; G2=1; C2=1;
Letters at 3rd position:
A3=0; T3=1; G3=0; C3=3;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||