I like the idea of having my protein sequences and the restriction enzymes displayed in various colours and i have been messing around with this but have had no luck, this is what i have tried:
sub color { my($colorkey) = @_; my $color = ''; my %color_key = ( A => "<font color=#99CCCC> A </font>", C => "<font color=#00CC00> C </font>", G => "<font color=#FF99CC> G </font>", T => "<font color=#33CC66> T </font>", R => "<font color=#996666> R </font>", Y => "<font color=#006699> Y </font>", M => "<font color=#33CC00> M </font>", K => "<font color=#99CC00> K </font>", S => "<font color=#000066> S </font>", W => "<font color=#990000> W </font>", B => "<font color=#0000FF> F </font>", D => "<font color=#FF9900> F </font>", H => "<font color=#9900CC> H </font>", V => "<font color=#99CC66> V </font>", N => "<font color=#33CCFF> N </font>", L => "<font color=#006633> L </font>", P => "<font color=#990066> P </font>", Q => "<font color=#996600> Q </font>", I => "<font color=#9966CC> I </font>", E => "<font color=#FF9966> E </font>", _ => "<font color=#000000> _ </font>", ); # Translate each character in the sequence coloured character for ( my $i = 0 ; $i < length($colorkey) ; ++$i ) { $color .= $color_key{substr($colorkey, $i, 1)}; } return }
it was a long shot but obviously did not work...trail and error eh lol either way i was wondering how would one get a key or something to store an individual amino acid as a different colour. I am assuming because the amino acid in my sequence is displayed in a string (here is my code for that):
print "please enter the start point of your DNA sequence\n\n"; $dnastart = <STDIN>; chomp $dnastart; print "please enter the end point of your DNA sequence\n\n"; $dnaend = <STDIN>; chomp $dnaend; $dna = substr($dna, $dnastart, ($dnaend - $dnastart)); print"Here is your selected DNA sequence:\n\n $dna\n\n"; } #start the string from position 0 $protein = substr($dna,0); #Translate the DNA to protein $protein = dna2peptide($protein); #Print the sequence in lines of 50 characters long print"\n\n<----------------Peptide frame 1----------------> \n\n"; print_sequence ($protein,50); # printing data sequences to HTML print OUTFILE "<table border=1 width=50% bgcolor=#CCFFFF> <tr><td><b> Peptide sequence frame 1</td></tr></b> <tr></tr> <tr><td> $protein </td></tr> </table>";
i would need some sort of code which does a substitution for each letter into color, which is what i was trying to accomplish with my horrible attempt above lol

In reply to Re^2: PERL HTML HELP by Singh121
in thread PERL HTML HELP by Singh121

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.