[ PHPXref.com ] [ Generated: Sun Jul 20 20:03:30 2008 ] [ Plasmidb 0.4.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/plasmidb/ -> primerDesigner.php (source)

   1  <?php
   2  
   3  
   4  $path = dirname(__FILE__); 
   5  $BIOPHP_DIR =  $path . "/../";
   6  
   7  require_once  ("./lib/Plasmidb.inc");
   8  require_once ("DB.php");
   9  require_once ("DB/common.php");
  10  require_once ("HTML/QuickForm.php");
  11  require_once ("HTML/Table.php");
  12  require_once ($BIOPHP_DIR."/Seq/Dna.php");
  13  require_once ($BIOPHP_DIR."/Seq/Protein.php");
  14  require_once ($BIOPHP_DIR."/Data/RestrictionEnzymeData.php");
  15  
  16  require_once  ("lib/Plasmi/GrabGlobals.php");
  17  global $aRestrictionEnzymeData;
  18  //$debug = 1;
  19  
  20  $vectorChoices = array("pET0-pBS2426", "pET3ATr-NdeI-BamHI", "pGEX2T-EcoRI-BamHI", "pET21d-NcoI-NotI", "pET21a-NdeI-NotI", "pET21a-NheI-NotI", "pET21a-NdeI-NotI", "pET21a-NdeI-NotI-Strep-Tag" , "pBSTNAV2-EcoRI-PstI");
  21  printf("Design primers for:<BR>"); 
  22  foreach ($vectorChoices as $vectorChoice){
  23  
  24      $anchortarget = sprintf("%s?vector=%s", $_SERVER["PHP_SELF"] , $vectorChoice);
  25      $anchor= new Anchor($vectorChoice, $_SERVER["PHP_SELF"], $style, true, true, null, array("vector" => $vectorChoice));
  26      print " ";
  27  
  28  }
  29  
  30  /**
  31   * Defaults
  32   */
  33  $tagSeq = "CACCATCACCATCACCAT"; // His-Tag
  34  $clamp5 = "GTCCTACT";
  35  $clamp3 = "GTCCTACT";
  36  
  37  $minCodingSeqLen     = 12;
  38  $maxCodingSeqLen     = 25;
  39  $minCodingSeqTm         = 48;
  40  $maxCodingSeqTm         = 65;
  41  $maxCodingSeqTmDelta = 5;
  42  
  43  /**
  44   * Selected options
  45   */
  46   
  47  if ($vector == "pET3ATr-NdeI-BamHI"){
  48      $restSite5primeName = "NdeI";   // NdeI
  49      $restSite3primeName  = "BamHI"; // BamHI
  50      $frameSeq = "";
  51  } elseif ($vector == "pET0-pBS2426"){
  52      $clamp5 = "TAT";
  53      $clamp3 = "TAT";
  54      $restSite5primeName = "BspEI";  
  55      $restSite3primeName  = "BspEI";
  56      $frameSeq = "TCTTTAAGGAGGATATAT";
  57  } elseif ($vector == "pGEX2T-EcoRI-BamHI") {
  58      $restSite5primeName  = "BamHI";
  59      $restSite3primeName  = "EcoRI";
  60      $frameSeq = "";
  61  } elseif ($vector == "pET21d-NcoI-NotI") {
  62      $restSite5primeName  = "NcoI";    // NcoI
  63      $restSite3primeName  = "NotI";    // NotI
  64      $frameSeq = "GC";                // For pET21a
  65  } elseif ($vector == "pET21a-NdeI-NotI") {
  66      $restSite5primeName  = "NdeI";    // NdeI
  67      $restSite3primeName  = "NotI";    // NotI
  68      $frameSeq = "";                    // For pET21a NdeI
  69  } elseif ($vector == "pET21a-NheI-NotI") {
  70      $restSite5primeName  = "NheI";    // NheI
  71      $restSite3primeName  = "NotI";    // NotI
  72      $frameSeq = "";                    // For pET21a NdeI
  73  } elseif ($vector == "pET21d-NdeI-NotI-Strep-Tag") {
  74      $restSite5primeName  = "NdeI";    // NcoI
  75      $restSite3primeName  = "NotI";    // NotI
  76      $tagSeq = "TGGAGCCACCCGCAGTTCGAAAAA"; // Strep-Tag
  77      $frameSeq = "";                    // For pET21a NdeI
  78      $tagSeqPosn = "2";
  79  } elseif ($vector == "pBSTNAV2-EcoRI-PstI") {
  80      $restSite5primeName  = "EcoRI";    // NcoI
  81      $restSite3primeName  = "PstI";    // NotI
  82      $tagSeq = "";                     // Strep-Tag
  83      $frameSeq = "";                    // 
  84      $tagSeqPosn = "0";    
  85  } else {
  86      $restSite5primeName  = "NdeI";
  87      $restSite3primeName  = "BamHI";
  88      $frameSeq = "";
  89  }
  90      $restSite5prime = $aRestrictionEnzymeData[$restSite5primeName][0];
  91      $restSite3prime = $aRestrictionEnzymeData[$restSite3primeName][0];
  92  
  93  $start = 1;
  94  $finish = "";
  95  $seq = "ATGGCACAAAACAATTTTGATTTTAAATTCAGCCAATGTTTTGGTGATAAAGCAGATATT
  96  GTGGTGACAGAGGCGGATCTAATTACAGCTGTAGAATTTGACTATACTGGAAATTATCTG
  97  GCCACTGGTGATAAAGGTGGCCGTGTGGTACTTTTTGAAAGAAGTAATAGTAGACATTGC
  98  GAATATAAGTTTTTAACAGAGTTTCAAAGTCATGACGCAGAATTTGATTATTTAAAATCC
  99  TTAGAAATTGAAGAGAAGATAAATGAAATCAAATGGTTACGACCAACTCAAAGATCACAC
 100  TTTCTTTTGAGCACAAATGATAAAACTATAAAACTTTGGAAAGTTTATGAGAAAAATATA
 101  AAATTGGTAAGCCAGAACAACTTAACAGAAGGGGTTACGTTTGCGAAAAAAGGCAAGCCC
 102  GATAACCATAACAGTAGAGGAGGCTCCGTGAGGGCTGTATTATCTTTACAATCGCTGAAA
 103  CTGCCTCAATTATCACAGCATGACAAAATCATTGCTGCCACCCCAAAGCGTATATATAGT
 104  AATGCACATACCTATCACATTAATTCGATATCGTTGAATTCTGATCAGGAAACATTTTTA
 105  AGTGCTGACGACTTGAGAATCAATTTATGGAATCTGGACATACCAGATCAGAGCTTCAAC
 106  ATCGTAGATATCAAGCCAACCAATATGGAAGAACTTACCGAAGTGATCACAAGCGCTGAA
 107  TTTCATCCGCAAGAATGTAATTTATTCATGTACTCTTCTTCCAAAGGTACAATAAAGTTG
 108  TGTGATATGAGACAAAATTCCCTATGTGACAATAAAACCAAAACATTTGAAGAATATTTG
 109  GATCCAATCAATCATAATTTTTTTACAGAAATCACGTCGTCAATTTCCGACATAAAATTT
 110  AGTCCAAATGGTAGGTATATTGCATCCAGAGATTATTTAACTGTCAAAATTTGGGACGTA
 111  AATATGGATAATAAGCCTTTGAAAACCATAAACATACATGAGCAATTGAAGGAAAGATTG
 112  AGTGATACCTATGAAAACGATGCGATTTTCGATAAATTTGAAGTTAATTTTAGTGGTGAT
 113  AGTTCAAGTGTAATGACTGGTTCTTACAATAACAATTTCATGATCTATCCTAATGTAGTA
 114  ACTTCTGGTGATAATGATAATGGCATAGTCAAAACTTTTGATGAACACAACGCACCTAAT
 115  AGCAACAGCAATAAAAATATCCACAACAGCATACAAAATAAAGATTCTAGTAGTAGTGGC
 116  AACAGCCACAAGCGTAGGAGTAACGGACGCAACACAGGCATGGTGGGAAGTAGTAATAGC
 117  TCTAGAAGCAGTATAGCGGGAGGAGAAGGAGCAAATTCGGAGGACTCGGGAACCGAAATG
 118  AATGAAATCGTGTTACAAGCTGACAAAACAGCGTTCAGGAACAAAAGATACGGTTCGCTA
 119  GCGCAAAGGTCTGCAAGAAATAAGGATTGGGGTGACGATATTGATTTCAAGAAGAATATT
 120  TTACATTTCTCATGGCATCCAAGAGAAAATAGTATTGCTGTTGCAGCAACTAATAATTTA
 121  TTCATTTTTTCCGCATTATAA";
 122  
 123  print "<HTML>\n <TITLE>Primer Designer</TITLE>\n";
 124  print "<BODY bgcolor=#FFFFFF text=#000000 link=#8b1a1a vlink=#8b3a3a alink=#ffffff>\n";
 125  print "<H1>Primer Designer</H1>";
 126  
 127  $form = new HTML_QuickForm('PlasmidForm', 'POST', ($PHP_SELF."?seq=".$seq), '_self');
 128  $defaultValues['clamp5'] = $clamp5;
 129  $defaultValues['clamp3'] = $clamp3;
 130  $defaultValues['restSite5prime'] = $restSite5prime;
 131  $defaultValues['restSite3prime'] = $restSite3prime;
 132  $defaultValues['frameSeq'] = $frameSeq;
 133  $defaultValues['minCodingSeqLen'] = $minCodingSeqLen;
 134  $defaultValues['maxCodingSeqLen'] = $maxCodingSeqLen;
 135  $defaultValues['minCodingSeqTm'] = $minCodingSeqTm;
 136  $defaultValues['maxCodingSeqTm'] = $maxCodingSeqTm;
 137  $defaultValues['maxCodingSeqTmDelta'] = $maxCodingSeqTmDelta;
 138  $defaultValues['start'] = $start;
 139  $defaultValues['finish'] = $finish;
 140  $defaultValues['tagSeq'] = $tagSeq;
 141  $defaultValues['tagSeqPosn'] = $tagSeqPosn;
 142  $defaultValues['seq'] = $seq;
 143  
 144  $form->setDefaults($defaultValues);
 145  $form->addElement('header', '', "Input the information from which to design a primer:");
 146  $form->addElement('text', 'clamp5', '5\' Clamp sequence', $clamp5);
 147  $form->addElement('text', 'clamp3', '3\' Clamp sequence', $clamp3);
 148  $form->addElement('text', 'restSite5prime', '5 prime restriction site', $restSite5prime);
 149  $form->addElement('text', 'restSite3prime', '3 prime restriction site', $restSite3prime);
 150  $form->addElement('text', 'frameSeq', 'Sequence Required to preserve reading frame', $frameSeq);
 151  $form->addElement('text', 'minCodingSeqLen', 'Minimum coding seq length', $minCodingSeqLen);
 152  $form->addElement('text', 'maxCodingSeqLen', 'Maximum coding seq length', $maxCodingSeqLen);
 153  $form->addElement('text', 'minCodingSeqTm', 'Minimum coding seq Tm', $minCodingSeqTm);
 154  $form->addElement('text', 'maxCodingSeqTm', 'Maximum coding seq Tm', $maxCodingSeqTm);
 155  $form->addElement('text', 'start', 'Start Residue Position', $start);
 156  $form->addElement('text', 'finish', 'Finish Residue Position (blank = to end)', $maxCodingSeqTm);
 157  $form->addElement('text', 'tagSeq', 'Tag Coding Sequence', $tagSeq);
 158  $form->addElement('select', 'tagSeqPosn', 'Tag sequence Position', array ("0" => "Unused", "1" => "N-terminal", "2" => "C-terminal"));
 159  $form->addElement('textarea', 'seq', 'Coding Sequence', 'cols="50" rows="10" wrap="virtual"', $seq);
 160  $form->addElement('submit', 'submitButton', 'Enter information');
 161  
 162  $clamp5E = & $form->getElement('clamp5');
 163  $clamp3E = & $form->getElement('clamp3');
 164  $restSite5primeE = & $form->getElement('restSite5prime');
 165  $restSite3primeE = & $form->getElement('restSite3prime');
 166  $frameSeqE = & $form->getElement('frameSeq');
 167  $minCodingSeqLenE = & $form->getElement('minCodingSeqLen');
 168  $maxCodingSeqLenE = & $form->getElement('maxCodingSeqLen');
 169  $minCodingSeqTmE = & $form->getElement('minCodingSeqTm');
 170  $maxCodingSeqTmE = & $form->getElement('maxCodingSeqTm');
 171  $startE = & $form->getElement('start');
 172  $finishE = & $form->getElement('finish');
 173  $tagSeq = & $form->getElement('tagSeq');
 174  $tagSeqPosn = & $form->getElement('tagSeqPosn');
 175  $seqE = & $form->getElement('seq');
 176  $form->addRule('minCodingSeqLen', 'You must enter a minimum sequence length', 'required');
 177  $form->addRule('maxCodingSeqLen', 'You must enter a maximum sequence length', 'required');
 178  $form->addRule('minCodingSeqTm', 'You must enter a minimum Tm', 'required');
 179  $form->addRule('maxCodingSeqTm', 'You must enter a maximum Tm', 'required');
 180  $form->addRule('seq', 'You must enter a sequence', 'required');
 181  
 182  if ($form->validate()) {
 183      $form->removeElement('submitButton');
 184      $form->process('processPrimer', false);
 185      $form->freeze();
 186  }
 187  
 188  $form->display();
 189  
 190  // {{{ begin function processPrimer
 191  
 192  /**
 193   * function processPrimer
 194   * @desc function to process the primer
 195   * @return void
 196   */
 197  
 198  function processPrimer($values) {
 199      
 200      $forwardPrimers = array ();
 201      $reversePrimers = array ();
 202      
 203      $dna = new Dna($values[seq], "IUPACUnambiguousDna");
 204      $dna->inTrim();
 205      $dnaLen = $dna->len();
 206      $dnaStr = $dna->getData();
 207      print "The input DNA sequence is <b>". $dnaLen." "."</b> base pairs long<br>";
 208      
 209      $codons = ($dnaLen / 3);
 210      $codonStart = (($values[start] - 1) * 3);
 211      if ($values[finish]) {
 212          $codonFinish = $values[finish] * 3;
 213      } else {
 214          $codonFinish = $dnaLen;
 215      }
 216      $codonFinish2 = $codonFinish - $codonStart;
 217      $pcrSeq = substr($dnaStr, $codonStart, $codonFinish2);
 218  
 219      print "The length of the desired PCR product Coding Sequence is <b>".strlen($pcrSeq)."</b> base pairs<br>";;
 220  
 221      $pcr = new Dna($pcrSeq, "IUPACUnambiguousDna");
 222      print "<pre>";
 223      print $pcr->pretty();
 224      //print $pcr->getAlphabetLetters();
 225      print "</pre>";
 226      $protStr = $pcr->translate(1);
 227      $protSeq = new Protein($protStr);
 228      print "The length of the sequence to be translated is: <b>".$protSeq->len()."</b> residues<br>";
 229      print "<pre>";
 230      print $protSeq->pretty();
 231      
 232      print "</pre>";
 233  
 234      for ($i = $values[minCodingSeqLen]; $i <= $values[maxCodingSeqLen]; $i ++) {
 235          $forwardPrimerStr = substr($pcrSeq, 0, $i);
 236          $forwardPrimer = new Primer($forwardPrimerStr, false, false);
 237          if (($forwardPrimer->getTm() < $values[minCodingSeqTm]) || ($forwardPrimer->getTm() > $values[maxCodingSeqTm])) {
 238          } else {
 239              $forwardPrimerTm = $forwardPrimer->getTm();
 240              $forwardPrimers["$forwardPrimerStr"] = $forwardPrimerTm;
 241          }
 242  
 243          $reversePrimerStr = substr($pcrSeq, - ($i));
 244          $reversePrimer = new Primer($reversePrimerStr, false, false);
 245          if (($reversePrimer->getTm() < $values[minCodingSeqTm]) || ($reversePrimer->getTm() > $values[maxCodingSeqTm])) {
 246          } else {
 247              $reversePrimerTm = $reversePrimer->getTm();
 248              $reversePrimers["$reversePrimerStr"] = $reversePrimerTm;
 249          }
 250      }
 251  
 252      Bio::printWithNl("<b>Primers meeting your requirements:</b>");
 253      foreach ($forwardPrimers as $forwardPrimerStr => $forwardPrimerTm) {
 254          foreach ($reversePrimers as $reversePrimerStr => $reversePrimerTm) {
 255              $delta = round(sqrt(pow(($forwardPrimerTm - $reversePrimerTm), 2)), 2);
 256              if ($delta < $lowestDelta) {
 257                  $lowestDelta = $delta;
 258                  $forwardPrimerLd = $forwardPrimerStr;
 259                  $reversePrimerLd = $reversePrimerStr;
 260                  $fPrimerCoding = new Dna($forwardPrimerStr, "IUPACUnambiguousDna");
 261                  $fPrimerCoding->getData();
 262                  $rPrimerCoding = new Dna($reversePrimerStr, "IUPACUnambiguousDna");
 263              }
 264          }
 265      }
 266  
 267      Bio :: printWithNl("<br>Lowest delta Tm found for all primers tested: <b>".$delta. "</b> degrees C<br>");
 268      Bio :: printWithNl("Forward primer coding sequence: <pre>".$forwardPrimerStr.", Tm: ".$forwardPrimers[$forwardPrimerStr]." degrees C</pre>");
 269      Bio :: printWithNl("Reverse primer coding sequence: <pre>".$reversePrimerStr.", Tm: ".$reversePrimers[$reversePrimerStr]." degrees C</pre>");
 270      print "Tag is ";
 271      
 272      if ($values[tagSeqPosn] == 1) {
 273          print "N-terminal<br>";
 274          $fPrimerTagSeq = $values[tagSeq];
 275      }
 276      elseif ($values[tagSeqPosn] == 0) {
 277          print "Unused<br>";
 278      }
 279      elseif ($values[tagSeqPosn] == 2) {
 280          print "C-terminal<br>";
 281          $cPrimerTagSeq = $values[tagSeq];
 282      }
 283  
 284      $fPrimerFlanking = new Dna (strtoupper($values['clamp5']).strtolower($values['restSite5prime']).strtoupper($values['frameSeq']).strtoupper($fPrimerTagSeq), "IUPACUnambiguousDna");
 285      
 286      $rPrimerFlanking = new Dna(strtoupper($cPrimerTagSeq)."TAG".strtolower($values['restSite3prime']).$values['clamp3'], "IUPACUnambiguousDna");
 287      
 288      $fPrimerEntire = new Dna($fPrimerFlanking->getData(). $forwardPrimerStr);
 289      $rPrimerEntire = new Dna($reversePrimerStr . $rPrimerFlanking->getData());
 290      
 291      $rPrimerEntire->revComp();
 292      
 293      $fivePrimeTally = $pcr->strSearch($values['restSite5prime']);
 294      $threePrimeTally = $pcr->strSearch($values['restSite3prime']);
 295      
 296      if ($fivePrimeTally){
 297          Bio :: printWithNl("<br>There are occurrences of the 5 prime restriction site ". $values['restSite5prime'] ." within the PCR sequence<br>");
 298      }
 299      if ($threePrimeTally){
 300          Bio :: printWithNl("<br>There are occurrences of the 3 prime restriction site ". $values['restSite3prime'] ." within the PCR sequence<br>");
 301      }
 302      
 303      Bio :: printWithNl("<br>F primer:");
 304      printPrimerInfo($fPrimerEntire->getData(), "Forward");
 305      Bio :: printWithNl("<br>R primer:");
 306      printPrimerInfo($rPrimerEntire->getData(), "Reverse");
 307      
 308      print "<br>";    
 309      $pcrEntire = new Dna ($fPrimerFlanking->getData() . "" . $pcr->getData() . $rPrimerFlanking->getData());
 310      print "<pre>";
 311      print $pcrEntire->pretty();
 312      print "</pre>";
 313      return;
 314  
 315  }
 316  
 317  // }}} end function processPrimer
 318  
 319  // {{{ begin function printPrimerInfo
 320  
 321  /**
 322   * function printPrimerInfo
 323   * @param string $primerStr
 324   * @param string $primerName
 325   * @return void
 326   */
 327  
 328  function printPrimerInfo($primerStr, $primerName = "") {
 329  
 330      global $style;
 331      $pa = new PrimerAnalyser($primerStr, $style);
 332      $pa->display();
 333      return;
 334  
 335  }
 336  
 337  // }}} end function printPrimerInfo
 338  
 339  // {{{ begin function printHtmlInFont
 340  
 341  /**
 342   * printHtmlInFont
 343   * 
 344   * To return a string as the string in FONT containers.
 345   * @param string $text
 346   * @param string $font
 347   * @return string $printHtmlInFont
 348   */
 349  
 350  function printHtmlInFont($text, $font) {
 351  
 352      $htmlInFont = sprintf('<FONT FACE="%s" COLOR="BLACK"><HTML>%s</HTML></FONT>', $font, $text);
 353      return $htmlInFont;
 354  
 355  }
 356  
 357  // }}} end function printHtmlInFont
 358  ?>
 359  
 360  
 361  
 362  
 363  
 364  


[ Powered by PHPXref - Served by Debian GNU/Linux ]