slackbuilds/academic/perlprimer/01_sytaxerrors.patch

158 lines
4.7 KiB
Diff

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)};