aboutsummaryrefslogtreecommitdiff
path: root/academic/perlprimer/sytaxerrors.patch
blob: 45b9cd570d565501c40d07b8f51bafbb835288a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Author: Steffen Moeller <steffen_moeller@gmx.de>
Description: Fixes a series of errors indicated by Perl 5.18.
Forwarded: https://sourceforge.net/p/perlprimer/patches/6/

Index: git/perlprimer.pl
===================================================================
--- git.orig/perlprimer.pl
+++ git/perlprimer.pl
@@ -3093,23 +3093,24 @@
 	# and because it's 3' primer-dimers that are the real problem in PCR.
 	
 	# create a binding array for each of the four bases
-	for $l (0 .. $pfl-1) {
+	foreach $l (0 .. $pfl-1) {
 		my $mbase = substr($fprimer_r, $l, 1);
 		$primer_hash{$mbase}[$l]=1;
-		for $k qw(a g c t) {
+		my @nucleotides = qw(a g c t);
+		foreach $k (@nucleotides) {
 			$primer_hash{$k}[$l] ||=0;
 		}
 	}
 		
 	# create the primer matrix
 	my @primer_comp;
-	for $k (0 .. $prl-1) {
+	foreach $k (0 .. $prl-1) {
 		$primer_comp[$k]=$primer_hash{substr($rcomprlc, $k, 1)};
 	}
 		
 	# read each combination from the matrix, calculate dG for each dimer
 	my $pd_len = ($pd_full ? $pfl+$prl-1 : $pl-2);
-	for $k (0 .. $pd_len) {
+	foreach $k (0 .. $pd_len) {
 		$score[$k]=0;
 		my $bind;
 		my $score_p=0;
@@ -3129,7 +3130,7 @@
 		# }
 		
 		# read the binding data
-		for $l (0 .. $prl-1) {
+		foreach $l (0 .. $prl-1) {
 			if (($k-$l)<$pfl) {
 				$bind .= $primer_comp[$l][$k-$l] if ($k-$l)>=0;
 			} else {
@@ -3148,7 +3149,7 @@
 		
 		# Find start and end of similarity
 		my ($pb_init,$pb_end);
-		for $l (0 .. length($bind)-1) {
+		foreach $l (0 .. length($bind)-1) {
 			# at first I tried finding the initiating terminal bases with
 			# regexps, but that was much slower ...
 			if (substr($bind, $l, 1) eq "1") {
@@ -3159,7 +3160,7 @@
 				
 		if (defined($pb_init)) {
 			# deltaG calculation
-			for $l ($pb_init .. $pb_end-1) {
+			foreach $l ($pb_init .. $pb_end-1) {
 				next if substr($bind, $l, 2) eq "00";
 				next if substr($bind, $l, 1) eq "2";
 				$score_p+=$oligo_dG{substr($primer_f, $pfl-$k+$l-1, 2).substr($rprimer_r, $l, 2)};
@@ -3228,44 +3229,44 @@
 	# and because it's 3' primer-dimers that are the real problem in PCR.
 	
 	# create a binding array for each of the four bases
-	for $l (0 .. $pfl-1) {
+	foreach $l (0 .. $pfl-1) {
 		my $mbase = substr($fprimer_r, $l, 1);
 		$primer_hash{$mbase}[$l]=1;
-		for $k qw(a g c t) {
+		foreach $k (qw(a g c t)) {
 			$primer_hash{$k}[$l] ||=0;
 		}
 	}
 		
 	# create the primer matrix
 	my @primer_comp;
-	for $k (0 .. $prl-1) {
-		$primer_comp[$k]=$primer_hash{substr($rcomprlc, $k, 1)};
+	foreach my $kk (0 .. $prl-1) {
+		$primer_comp[$kk]=$primer_hash{substr($rcomprlc, $kk, 1)};
 	}
 	
 	# print the matrix - for debugging
 	print "$primer_f vs. $primer_r - full pd = $pd_full\n";
 	print "  \t";
-	for $l (0 .. $pfl-1) {
+	foreach $l (0 .. $pfl-1) {
 		my $mbase = substr($fprimer_r, $l, 1);
 		print "$mbase ";
 	}
 	print "\n";
-	for $k (0 .. $prl-1) {
-		my $base = substr($rprimer_r, $k, 1);
-		print "$base:\t@{$primer_comp[$k]}\n";
+	foreach my $kk (0 .. $prl-1) {
+		my $base = substr($rprimer_r, $kk, 1);
+		print "$base:\t@{$primer_comp[$kk]}\n";
 	}
 	
 	my @binding_data;
 	# read each combination from the matrix, calculate dG for each dimer
 	my $pd_len = ($pd_full ? $pfl+$prl-1 : $pl-2);
-	for my $k (0 .. $pd_len) {
-		$score[$k]=0;
+	foreach my $kk (0 .. $pd_len) {
+		$score[$kk]=0;
 		my $bind;
 		my $score_p=0;
 		
 		# starting coords
-		my $pf_coord_start = ($k >= $pfl ? $pfl-1 : $k);
-		my $pr_coord_start = ($k - $pfl > 0 ? $k - $pfl : 0);
+		my $pf_coord_start = ($kk >= $pfl ? $pfl-1 : $kk);
+		my $pr_coord_start = ($kk - $pfl > 0 ? $kk - $pfl : 0);
 		my ($pf_coord, $pr_coord, $first, $flag);
 		
 		# read through each combination finding multiple matches
@@ -3285,7 +3286,7 @@
 				}
 			} elsif ($flag) {
 				# end of a binding stretch
-				push @binding_data, [$k, $first, $bind] if $bind > 1;
+				push @binding_data, [$kk, $first, $bind] if $bind > 1;
 				$bind=0;
 				$flag=0;
 			}
@@ -3325,7 +3326,7 @@
 		# # }
 				# 
 		# # read the binding data
-		# for $l (0 .. $prl-1) {
+		# foreach $l (0 .. $prl-1) {
 			# if (($k-$l)<$pfl) {
 				# $bind .= $primer_comp[$l][$k-$l] if ($k-$l)>=0;
 			# } else {
@@ -3344,7 +3345,7 @@
 		# 
 		# # Find start and end of similarity
 		# my ($pb_init,$pb_end);
-		# for $l (0 .. length($bind)-1) {
+		# foreach $l (0 .. length($bind)-1) {
 			# # at first I tried finding the initiating terminal bases with
 			# # regexps, but that was much slower ...
 			# if (substr($bind, $l, 1) eq "1") {
@@ -3355,7 +3356,7 @@
 				# 
 		# if (defined($pb_init)) {
 			# # deltaG calculation
-			# for $l ($pb_init .. $pb_end-1) {
+			# foreach $l ($pb_init .. $pb_end-1) {
 				# next if substr($bind, $l, 2) eq "00";
 				# next if substr($bind, $l, 1) eq "2";
 				# $score_p+=$oligo_dG{substr($primer_f, $pfl-$k+$l-1, 2).substr($rprimer_r, $l, 2)};