Advertisement
ZaynerTech

For Generating Quickchange Mutagenesis Primers

Jan 17th, 2013
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.98 KB | None | 0 0
  1. #!perl.exe
  2. #
  3. # For generating QuickChange Mutagenesis Primers
  4. #
  5. #
  6. #                    seq.txt            integer              A or ALA, &c.             integer     integer
  7. #./quickchanger.pl <sequence file> <# of residue to mutate> <residue to mutate to> <sequence offset> <num codons on each side>
  8. # Optional:< number of codons on each side of mutation>
  9. #
  10. #
  11. # Sequence file should contain only the nucleotide sequence no header or bullshit
  12. #
  13. # My quickchange primers from IDT have always worked by adding 1uL of a 1:20,000 dilution to a 50uL PCR reaction
  14. # I always use 7 codons or 21 bases on each side of the mutation this is the default also for the program
  15. # You can change this by a command line argument but make sure if you do you also specify
  16. # a sequence offset or 0 as the program reads in the arguments in a specific order
  17. # If you choose a mutation 6 codons from the end it will use only 6 codons
  18. # If you chose a mutation 5 codons from the end it will not work unless you specifically specify <number of codons on each side of mutation>
  19. # I run the quickchange at 56.5C with pfu and have 99% efficiency
  20. #
  21. #
  22. #
  23. #
  24.  
  25.  
  26. use Bio::Tools::CodonTable;
  27. $d = 0;
  28. $e = 0;
  29. $x = 0;
  30. my %val = ();
  31. my %seqer = ();
  32.  
  33. if(!$ARGV[0] || !$ARGV[1] || !$ARGV[2]) { print "Usage: ./quickchanger.pl <sequence file> <number of residue to mutate> <residue to mutate to> <sequence offset>\n\n"; die;}
  34.  
  35.  
  36. open(FILE, $ARGV[0]);
  37.  
  38. @file=<FILE>;
  39.  
  40. #
  41. #load up sequence and separate it by codons
  42. #
  43. @seq = $file[0] =~ /(...)/g;
  44.  
  45. $numt = @seq;
  46. #print "$numt\n\n"; die;
  47. #$seq = $ARGV[0];
  48.  
  49.  
  50.  
  51. $num = $ARGV[1];
  52. $aa2 = $ARGV[2];
  53. if($ARGV[4]){ $primer = $ARGV[4];} else { $primer = 7; }
  54.  
  55. $offset = $ARGV[3] + 0;
  56.  
  57. if($primer > 5){
  58. if(($num - $offset) < 6 || ($num - $offset) > (@seq - 7)){ print "Mutation to close to ends need more sequence\n";die; }
  59. elsif(($num - $offset) eq 6 || (($num - $offset) - (@seq)) eq -7) { $primer = 6; }
  60. }
  61.  
  62. #
  63. # If we need to define a sequence offset
  64. #
  65. foreach $seqcod (@seq) {
  66.   $seqer{$offset + $x} = $seqcod;
  67.   #print "$seqer{$offset + $x}\n";
  68.   $x++;
  69. }      
  70.  
  71. #
  72. # Find our mutation codons
  73. #
  74. $table = Bio::Tools::CodonTable->new();
  75. $mut = $table->translate($seqer{$num});
  76. $unmut = $table->translate($seqer{$num});
  77. @codons = $table->revtranslate($aa2);
  78.  
  79. @orig = $seqer{$num} =~ /(.)/g;
  80.  
  81. #
  82. # Find best mutation codon match to
  83. # original sequence
  84. #
  85. foreach $cod (@codons) {
  86. $val{$d} = 0;
  87. @co = $cod =~ /(.)/g;
  88. for($c=0;$c<3;$c++) {
  89.    if($orig[$c] eq $co[$c]) {
  90.    $val{$d}++;      
  91.    }
  92.  
  93. }
  94.  
  95. #print "@cod $val{$d}\n";
  96. $d++;
  97. }
  98.  
  99. #
  100. # Sort to find best mutation codon match
  101. #
  102. foreach $codonsers (sort {$val{$b} <=> $val{$a}} keys %val){
  103. $final[$e] = $codons[$codonsers];
  104.  
  105. $e++;
  106.  
  107. }
  108. #print "@orig\n@codons\n$final[0]\n";
  109.  
  110. #
  111. # print out forward primer and mutation  
  112. #
  113. print "$num $aa2\n";  
  114. for($z=$primer;$z>=1;$z--) {
  115. print $seqer{$num-$z};
  116. }
  117. print " $final[0] ";
  118. for($z=1;$z<=$primer;$z++) {
  119. print $seqer{$num+$z};
  120. }
  121. print "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement