BioPHP - Chemical groups of aminoacids in protein
Original code submitted by josebaCode bellow is covered by GNU GPL v2 license.
Description
Last change: 2010/10/18 17:04 | Edit description | Recent Changes | Original descriptionTranslates peptide sequence to checmical groups. Chemical groups/aminoacids: L/GAVLI H/ST M/NQ R/FYW S/CM I/P A/DE C/KRH */* X/X
Code
Last change: 2010/10/18 17:04 | Edit Code | Recent Changes | Download | Original codefunction chemgrp($amino_seq){
$chemgrp_seq = "";
$ctr = 0;
while(1)
{
$amino_letter = substr($amino_seq, $ctr, 1);
if ($amino_letter == "") break;
if (strpos(" GAVLI", $amino_letter)>0) $chemgrp_seq .= "L";
elseif (($amino_letter == "S") or ($amino_letter == "T")) $chemgrp_seq .= "H";
elseif (($amino_letter == "N") or ($amino_letter == "Q")) $chemgrp_seq .= "M";
elseif (strpos(" FYW", $amino_letter)>0) $chemgrp_seq .= "R";
elseif (($amino_letter == "C") or ($amino_letter == "M")) $chemgrp_seq .= "S";
elseif ($amino_letter == "P") $chemgrp_seq .= "I";
elseif (($amino_letter == "D") or ($amino_letter == "E")) $chemgrp_seq .= "A";
elseif (($amino_letter == "K") or ($amino_letter == "R") or ($amino_letter == "H"))
$chemgrp_seq .= "C";
elseif ($amino_letter == "*") $chemgrp_seq .= "*";
elseif ($amino_letter == "X" or $amino_letter == "N") $chemgrp_seq .= "X";
else die("Invalid amino acid symbol in input sequence.");
$ctr++;
}
return $chemgrp_seq;
}