#!/usr/bin/perl -w # # PURPOSE: If the user really screws up a read, to back out all changes. # You must reassemble after using this. # The difference # is that the edits are still in lower versions of phd files # in case you ever want them back, or in case you want to # to run consed on an older ace file that refers to those # older phd files that have edits in them. # # HOW IT WORKS: It copies the .1 version (which is the original phred calls) # to a new phd file with version one higher than the highest # version phd file. When you reassemble, phd2fasta uses this # new highest version and assembles using it. # # REV: 7/24/98 (DG) $szUsage = "Usage: revertToUneditedRead (read name without any .phd.# extension)"; die $szUsage if ( $#ARGV != 0 ); $szReadName = $ARGV[0]; $szUneditedPhdFile = "../phd_dir/" . $szReadName . ".phd.1"; die "The unedited phd file $szUneditedPhdFile doesn't exit\n" if (! -e $szUneditedPhdFile ); $szPattern = "\.\./phd_dir/" . $szReadName . "\.phd\."; $szGlobbing = "../phd_dir/" . $szReadName . ".phd.*"; @aFilesMatchingGlob = <${szGlobbing}>; $nHighestVersion = -1; foreach $szOneVersionOfPhdFile ( @aFilesMatchingGlob ) { # print "$szOneVersionOfPhdFile\n"; ($nExtensionOfPhdFile = $szOneVersionOfPhdFile) =~ s/${szPattern}//; die "The file extension of $szOneVersionOfPhdFile is not numeric so can't finish" if ( $nExtensionOfPhdFile !~ /^[0-9]+$/); if ( $nExtensionOfPhdFile > $nHighestVersion ) { $nHighestVersion = $nExtensionOfPhdFile; } } #print "highest version is $nHighestVersion\n"; $nNextHigherVersion = $nHighestVersion + 1; $szNextHigherPhdFile = "../phd_dir/" . $szReadName . ".phd." . $nNextHigherVersion; $szCommand = "cp $szUneditedPhdFile $szNextHigherPhdFile"; #print "Now executing $szCommand\n"; !system( $szCommand ) || die "command $szCommand failed"; print "Created $szNextHigherPhdFile\n"; print "Now reassemble and the resulting assembly will have $szReadName with no edits\n";