#!/usr/local/bin/perl5 -w # # format_prediction # Builds a CASP3 prediction file, delimited by PFRMAT and END # # Arguments: # REQUIRED: # -target targetnum # -method # -al # # OPTIONAL: # -remark # $registrationFilename = "/projects/compbio/experiments/casp3/submit/registration.fold"; # Get inputs from command line &process_command_line; # # Step 1: put in the header information: PFRMAT, TARGET, and AUTHOR. # print "PFRMAT AL\n"; print "TARGET $targetId\n"; open REGISTRATION, $registrationFilename || die "Could not read registration file $registrationFilename\n"; print "AUTHOR ", ; close REGISTRATION; # # Step 2: echo the contents of the remark file, if there is one. # if (defined($remarkFile)) { open REMARK, $remarkFile || die "Could not read remark file $remarkFile\n"; while ( ) { print "REMARK $_"; } close REMARK; } # # Step 3: echo the contents of the method file # open METHOD, $methodFile || die "Could not read method file $methodFile\n"; while () { print "METHOD $_"; } close METHOD; # # Step 4: echo the contents of the AL alignment file # open AL, $alFile || die "Could not open alignment file $alFile\n"; print ; close AL; # # Step 5: put on the footer # print "END\n"; #-------------------------------------------------- # subroutines # parse arguments sub process_command_line { local($i) = 0; while ($i <= $#ARGV) { $_ = $ARGV[$i++]; if (/^-target/) { $targetId = $ARGV[$i++]; } elsif (/^-methods/) { $methodFile = $ARGV[$i++]; } elsif (/^-al/) { $alFile = $ARGV[$i++]; } elsif (/^-remark/) { $remarkFile = $ARGV[$i++] } } defined($targetId) || die "Error: must specify '-target '\n"; defined($methodFile) || die "Error: must specify '-method '\n"; defined($alFile) || die "Error: must specify '-al '\n"; return; }