#!/usr/bin/perl -w # fixContigEnd.perl # used by consed for fixing a contig end. It is called by consed # when the user runs consed as: # consed -ace (acefile) -fixContigEnds # $szUsage = "fixContigEnd.perl (fasta file of reads for input) (fof for ace file, output)"; $szRelease = "100714"; defined( $szConsedHome = $ENV{'CONSED_HOME'} ) || ( $szConsedHome = "/usr/local/genome" ); $szPhrapExe = $szConsedHome . "/bin/phrap"; if ( $#ARGV == 0 ) { if ( $ARGV[0] eq "-v" || $ARGV[1] eq "-V" ) { print "$szRelease\n"; exit( 0 ); } } if ( $#ARGV != 1 ) { die "$szUsage"; } $szFasta = $ARGV[0]; $szAceFOF = $ARGV[1]; open( filAceFOF, ">$szAceFOF" ) || die "couldn't open $szAceFOF for output"; ( $szPhrapOut = $szFasta ) =~ s/\.fasta//; $szPhrapErr = $szPhrapOut; $szPhrapOut .= ".phrap.out"; $szPhrapErr .= ".phrap.err"; if ( -e "$szPhrapOut" ) { unlink( $szPhrapOut ) || die "couldn't delete $szPhrapOut $!"; } if ( -e "$szPhrapErr" ) { unlink( $szPhrapErr ) || die "couldn't delete $szPhrapErr $!"; } $szCommand = "$szPhrapExe $szFasta -new_ace -minscore 20 -retain_duplicates -vector_bound 0 -max_group_size 0 >$szPhrapOut 2>$szPhrapErr"; print "about to run: $szCommand\n"; !system( $szCommand ) || die "couldn't run $szCommand $!"; $szAceFile = $szFasta . ".ace"; print filAceFOF "$szAceFile\n"; close( filAceFOF ); # clean up is done by consed