http://qs321.pair.com?node_id=449545

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have a script that it sort of working, but not properly snd I can't really see why. First of all, it seems that although the OUTFILE's are being created, they are only created if the input file is below a certain size. So, for example, it will run on a input file with 500 entires but not 4000, ehich is what I want.

Secondly, its not deleting the .out and .dssp files at the end .. the naming strategy is correct as far as I am aware.

I would very much appreciate someone looking at my code to see where the problems might be. Thanks in advance.

#!/usr/bin/perl $pdbprep = "/home/users/alison/pdb_folder/pdb"; $pdbext = ".ent"; $dssp = ".dssp"; $pdblist = $ARGV[0]; $combodir = $ARGV[1]; $out = ".out"; open(PDBLIST, "$pdblist") || die "ERROR: Unable to open $pdblist for r +eading: $!\n"; while(<PDBLIST>) { my @fields = split; my $pdbcode = $fields[0]; $pdbcode =~ tr/[A-Z]/[a-z]/; my $dsspfile = "$pdbcode$dssp"; my $pdbstructure = "$pdbprep$pdbcode$pdbext"; $residuecombofile = "$combodir$residue1$residue2$residue3$out"; $outfile = "$pdbcode$out"; if(open(PDB,"$pdbstructure")) { system("dsspcmbi $pdbstructure $dsspfile"); CreateUniqueResidueFile($pdbstructure, $outfile); } else { $flag = 1; } if($flag == 0) { open(UNIQUE,"$outfile") || die "ERROR: Unable to open $outfile for + reading: $!\n"; @file = <UNIQUE>; $items = @file; for($j = 0; $j <$items-2; $j++) { $residuenumber1 = substr($file[$j], 1, 4); $residuename1 = substr($file[$j], 7, 3); $residuenumber2 = substr($file[$j+1], 1, 4); $residuename2 = substr($file[$j+1], 7, 3); $residuenumber3 = substr($file[$j+2], 1, 4); $residuename3 = substr($file[$j+2], 7, 3); $residuecombofile = "$combodir$residuename1$residuename2$resid +uename3$out"; ($phiangle, $psiangle) = ExtractFromDssp($residuenumber1, $re +siduenumber2, $residuenumber3, $dsspfile); if($phiangle != 0) { if($phiangle != 360) { if($psiangle !=360) { open(OUTFILE, ">>$residuecombofile") || die "ERROR: Unable + to open $residuecomdofile for writing: $!\n"; print OUTFILE "$phiangle\t$psiangle $pdbcode\n"; } } } } system("rm $dsspfile"); system("rm $outfile"); } else { print "No structure file. Moving to next structure in list\n"; } }

Janitored by Arunbear - added readmore tags, as per Monastery guidelines