Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks a lotfor($i = -180; $i < 181; $i = $i+5) { $j = $i+5; $n++; $o = 0; for($k = -180; $k < 181; $k = $k+5) { $m = $k+5; $o++; my @ranges = ([$i, $j, $k, $m]); my @range_counts = (0) x @ranges; # open .out file created by secondary_structure.pl script to c +heck date of crystal structure # was structure created before or after the advent of procheck +? open(FILE, "$dir$file") || die "ERROR: Unable to open $dir$fil +e FILE: $!\n"; @file = <FILE>; foreach $record(@file) { # print "$record\n"; #extract relevant information from file # is residue a GLY or a NON-GLY residue? $residue = substr($record, 0, 3); if($residue ne "GLY") { $residue = "NONGLY"; } $phi = substr($record, 7, 6); $psi = substr($record, 14, 6); $secondary_structure = substr($record, 21, 1); #print "1 $secondary_structure $residue $procheck\n"; #print "2 $sec_struct $selectresidue $selectprocheck\n"; if(("$secondary_structure" eq "$sec_struct") && ("$residue" eq "$selectresidue") && ("$procheck" eq "$selectprocheck")) { for my $R (0..$#ranges) { if ($phi >=$ranges[$R][0] and $phi < $ranges[$R][1] and $psi >= $ranges[$R][2] and $psi < $ranges[$R][3]) { ++$range_counts[$R]; } } } } } } } for my $R (0..$#ranges) { if($v < 73) { printf "%d, ", $range_counts[$R]; $v++; } else { print "\n"; $v = 0; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: folow up to headache with array
by ikegami (Patriarch) on Sep 28, 2004 at 16:38 UTC | |
|
Re: folow up to headache with array
by BrowserUk (Patriarch) on Sep 28, 2004 at 16:41 UTC |