Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <style>
- body {
- font-family:Monospace;
- font-size:20;
- }
- </style>
- <script>
- function adn() {
- location.href = "adn.php";
- }
- function arn() {
- location.href = "arn.php";
- }
- </script>
- </head>
- <body>
- <?php
- for ($i = 1; $i <= 10; $i++) {
- $str[$i] = htmlspecialchars($_POST['in'.$i]);
- }
- if (!$str[1] == null) {
- goto c; // Si le formulaire a déjà été rempli, on n'affiche pas le formulaire
- }
- echo "
- <form action='prot.php' method='post'>
- Collez les séquences ARNm à traduire ici : <br/>
- <input name=in1 type=textarea /><br/>
- <input name=in2 type=textarea /><br/>
- <input name=in3 type=textarea /><br/>
- <input name=in4 type=textarea /><br/>
- <input name=in5 type=textarea /><br/>
- <input name=in6 type=textarea /><br/>
- <input name=in7 type=textarea /><br/>
- <input name=in8 type=textarea /><br/>
- <input name=in9 type=textarea /><br/>
- <input name=in10 type=textarea /><br/>
- <br/>
- <input type=submit value=Traduire! /><br/>
- </form>
- <br/><br/><br/><br/>Autres fonctions : <br/>
- <input type=button onClick='adn();' value='Comparer des séquences ADN' /><br/>
- <input type=button onClick='arn();' value='Transcrire ADN en ARN' /><br/>
- ";
- c: //pour goto
- if ($str[1] == null) {
- exit(); // Si le formulaire n'a pas été rempli, exit
- }
- //liste des codons valides, sauf les codons stop :
- $liste1 = array(
- "AAA" => "Lys",
- "AAC" => "Asn",
- "AAG" => "Lys",
- "AAU" => "Asn",
- "ACA" => "Thr",
- "ACC" => "Thr",
- "ACG" => "Thr",
- "ACU" => "Thr",
- "AGA" => "Arg",
- "AGC" => "Ser",
- "AGG" => "Arg",
- "AGU" => "Ser",
- "AUA" => "Ile",
- "AUC" => "Ile",
- "AUG" => "Met",
- "AUU" => "Ile",
- "CAA" => "Gln",
- "CAC" => "His",
- "CAG" => "Gln",
- "CAU" => "His",
- "CCA" => "Pro",
- "CCC" => "Pro",
- "CCG" => "Pro",
- "CCU" => "Pro",
- "CGA" => "Arg",
- "CGC" => "Arg",
- "CGG" => "Arg",
- "CGU" => "Arg",
- "CUA" => "Leu",
- "CUC" => "Leu",
- "CUG" => "Leu",
- "CUU" => "Leu",
- "GAA" => "Glu",
- "GAC" => "Asp",
- "GAG" => "Glu",
- "GAU" => "Asp",
- "GCA" => "Ala",
- "GCC" => "Ala",
- "GCG" => "Ala",
- "GCU" => "Ala",
- "GGA" => "Gly",
- "GGC" => "Gly",
- "GGG" => "Gly",
- "GGU" => "Gly",
- "GUA" => "Val",
- "GUC" => "Val",
- "GUG" => "Val",
- "GUU" => "Val",
- "UAC" => "Tyr",
- "UAU" => "Tyr",
- "UCA" => "Ser",
- "UCC" => "Ser",
- "UCG" => "Ser",
- "UCU" => "Ser",
- "UGC" => "Cys",
- "UGG" => "Trp",
- "UGU" => "Cys",
- "UUA" => "Leu",
- "UUC" => "Phe",
- "UUG" => "Leu",
- "UUU" => "Phe"
- );
- for ($i = 1; $i <= 10; $i++) {
- // echo $i; //debug
- $str_fin[$i] = null;
- $str_cur[$i] = $str[$i];
- while (!$str_cur[$i] == null) {
- $str_tmp[$i] = substr($str_cur[$i], 0, 3); //ATGCCTGGCTA : prend ATG
- $str_cur[$i] = substr($str_cur[$i], 3); //ATGCCTGGCTA : prend CCTGGCTA (le reste)
- // echo "cur:".$str_cur[$i]." tmp:".$str_tmp[$i]."<br/>"; //debug
- if ($str_tmp[$i] == "UGA" || $str_tmp[$i] == "UAG" || $str_tmp[$i] == "UAA") {
- echo "<br/>Codon stop détecté : ".$str_tmp[$i]." dans la chaîne numéro ".$i."<br/>";
- break; // Si codon stop, on arrête le while
- }
- foreach ($liste1 as $A => $B) {
- // echo $A.$B.$str_tmp[$i].$str_fin[$i]."<br/>"; //debug
- if ($str_tmp[$i] == $A) {
- $str_fin[$i] = $str_fin[$i].$B;
- }
- if (!strlen($str_tmp[$i]) == 3) {
- $str_fin[$i] = $str_fin[$i]."<font color='red'>ERR</font>";
- }
- }
- //echo $str_fin[$i]; //debug
- }
- }
- // Affichage
- if (!$str[1] == null) {
- echo "Traitement terminé <br/><br/><u>Affichage des séquences ARN et peptidiques :</u><br/>";
- for ($i = 1; $i <=10; $i++) {
- if (!$str[$i] == null) {
- echo "<br/>".$str[$i]."<br/>".$str_fin[$i]."<br/>";
- }
- }
- }
- ?>
- <br/>
- <small>Créé par Hugo en php - (c) hugoland.fr<br/>
- Code source (pour les curieux...) <a href="http://pastebin.com/ZdGyVb8G">ici</a></small>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement