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 |