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

title

Body

[close]

/plasmidb/ -> primerDesignerRefactored.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      $oDna = new Dna($values[seq], "IUPACUnambiguousDna");
 204  
 205      $iDnaLen = $oDna->len();
 206      $sDna = $oDna->getData();
 207      print "The input DNA sequence is <b>". $iDnaLen." "."</b> base pairs long<br>";
 208      
 209      $fCodons = ($iDnaLen / 3);
 210      $iCodonStart = (($values[start] - 1) * 3);
 211      if ($values[finish]) {
 212          $iCodonFinish = $values[finish] * 3;
 213      } else {
 214          $iCodonFinish = $iDnaLen;
 215      }
 216      $iCodonFinish2 = $iCodonFinish - $iCodonStart;
 217      $sPcr = substr($sDna, $iCodonStart, $iCodonFinish2);
 218  
 219      print "The length of the desired PCR product Coding Sequence is <b>".strlen($sPcr)."</b> base pairs<br>";;
 220  
 221      $oPcr = new Dna($sPcr, "IUPACUnambiguousDna");
 222      print "<pre>";
 223      print $oPcr->pretty();
 224  
 225      print "</pre>";
 226      $translator = new Translator;
 227      $oProt = $translator->translate($oPcr);
 228      
 229      print "The length of the sequence to be translated is: <b>".$oProt->len()."</b> residues<br>";
 230      print "<pre>";
 231      print $oProt->pretty();
 232      
 233      print "</pre>";
 234  
 235      for ($i = $values[minCodingSeqLen]; $i <= $values[maxCodingSeqLen]; $i ++) {
 236          $sForwardPrimer = substr($sPcr, 0, $i);
 237          $forwardPrimer = new Dna($sForwardPrimer, false, false);
 238          if (($forwardPrimer->getTm() < $values[minCodingSeqTm]) || ($forwardPrimer->getTm() > $values[maxCodingSeqTm])) {
 239          } else {
 240              $fForwardPrimerTm = $forwardPrimer->getTm();
 241              $forwardPrimers["$sForwardPrimer"] = $fForwardPrimerTm;
 242          }
 243  
 244          $sReversePrimer = substr($sPcr, - ($i));
 245          $reversePrimer = new Dna($sReversePrimer, false, false);
 246          if (($reversePrimer->getTm() < $values[minCodingSeqTm]) || ($reversePrimer->getTm() > $values[maxCodingSeqTm])) {
 247          } else {
 248              $fReversePrimerTm = $reversePrimer->getTm();
 249              $reversePrimers["$sReversePrimer"] = $fReversePrimerTm;
 250          }
 251      }
 252  
 253      Bio::printWithNl("<b>Primers meeting your requirements:</b>");
 254      foreach ($forwardPrimers as $sForwardPrimer => $fForwardPrimerTm) {
 255          foreach ($reversePrimers as $sReversePrimer => $fReversePrimerTm) {
 256              $delta = round(sqrt(pow(($fForwardPrimerTm - $fReversePrimerTm), 2)), 2);
 257              if ($delta < $lowestDelta) {
 258                  $lowestDelta = $delta;
 259                  $forwardPrimerLd = $sForwardPrimer;
 260                  $reversePrimerLd = $sReversePrimer;
 261                  $fPrimerCoding = new Dna($sForwardPrimer, "IUPACUnambiguousDna");
 262                  $fPrimerCoding->getData();
 263                  $rPrimerCoding = new Dna($sReversePrimer, "IUPACUnambiguousDna");
 264              }
 265          }
 266      }
 267  
 268      Bio :: printWithNl("<br>Lowest delta Tm found for all primers tested: <b>".$delta. "</b> degrees C<br>");
 269      Bio :: printWithNl("Forward primer coding sequence: <pre>".$sForwardPrimer.", Tm: ".$forwardPrimers[$sForwardPrimer]." degrees C</pre>");
 270      Bio :: printWithNl("Reverse primer coding sequence: <pre>".$sReversePrimer.", Tm: ".$reversePrimers[$sReversePrimer]." degrees C</pre>");
 271      print "Tag is ";
 272      
 273      if ($values[tagSeqPosn] == 1) {
 274          print "N-terminal<br>";
 275          $fPrimerTagSeq = $values[tagSeq];
 276      }
 277      elseif ($values[tagSeqPosn] == 0) {
 278          print "Unused<br>";
 279      }
 280      elseif ($values[tagSeqPosn] == 2) {
 281          print "C-terminal<br>";
 282          $sPrimerTagSeq = $values[tagSeq];
 283      }
 284  
 285      $oForwardPrimerFlanking = new Dna (strtoupper($values['clamp5']).strtolower($values['restSite5prime']).strtoupper($values['frameSeq']).strtoupper($fPrimerTagSeq), "IUPACUnambiguousDna");
 286      
 287      $oReversePrimerFlanking = new Dna(strtoupper($sPrimerTagSeq)."TAG".strtolower($values['restSite3prime']).$values['clamp3'], "IUPACUnambiguousDna");
 288      
 289      $sForwardPrimerEntire = new Dna($oForwardPrimerFlanking->getData(). $sForwardPrimer);
 290      //print $sForwardPrimerEntire;
 291      $sReversePrimerEntire = new Dna($sReversePrimer . $oReversePrimerFlanking->getData());
 292      //print $sReversePrimerEntire;
 293      $sReversePrimerEntire->revComp();
 294      
 295      $iFivePrimeTally = $oPcr->strSearch($values['restSite5prime']);
 296      $iThreePrimeTally = $oPcr->strSearch($values['restSite3prime']);
 297      
 298      if ($iFivePrimeTally){
 299          Bio :: printWithNl("<br>There are occurrences of the 5 prime restriction site ". $values['restSite5prime'] ." within the PCR sequence<br>");
 300      }
 301      if ($iThreePrimeTally){
 302          Bio :: printWithNl("<br>There are occurrences of the 3 prime restriction site ". $values['restSite3prime'] ." within the PCR sequence<br>");
 303      }
 304      
 305      Bio :: printWithNl("<br>F primer:");
 306      printPrimerInfo($sForwardPrimerEntire->getData(), "Forward");
 307      Bio :: printWithNl("<br>R primer:");
 308      printPrimerInfo($sReversePrimerEntire->getData(), "Reverse");
 309      
 310      print "<br>";    
 311      $oPcrEntire = new Dna ($oForwardPrimerFlanking->getData() . "" . $oPcr->getData() . $oReversePrimerFlanking->getData());
 312      print "<pre>";
 313      print $oPcrEntire->pretty();
 314      print "</pre>";
 315      return;
 316  
 317  }
 318  
 319  // }}} end function processPrimer
 320  
 321  // {{{ begin function printPrimerInfo
 322  
 323  /**
 324   * function printPrimerInfo
 325   * @param string $primerStr
 326   * @param string $primerName
 327   * @return void
 328   */
 329  
 330  function printPrimerInfo($sPrimer, $sPrimerName = "") {
 331  
 332      global $style;
 333      $pa = new PrimerAnalyser($sPrimer, $style);
 334      $pa->display();
 335      return;
 336  
 337  }
 338  
 339  // }}} end function printPrimerInfo
 340  
 341  // {{{ begin function printHtmlInFont
 342  
 343  /**
 344   * printHtmlInFont
 345   * 
 346   * To return a string as the string in FONT containers.
 347   * @param string $text
 348   * @param string $font
 349   * @return string $printHtmlInFont
 350   */
 351  
 352  function printHtmlInFont($text, $font) {
 353  
 354      $htmlInFont = sprintf('<FONT FACE="%s" COLOR="BLACK"><HTML>%s</HTML></FONT>', $font, $text);
 355      return $htmlInFont;
 356  
 357  }
 358  
 359  // }}} end function printHtmlInFont
 360  ?>


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