#!usr/bin/perl -w print"\n********Running Fasta34********** \n \n"; print"\n Please enter the file sequence \n"; my $seqfile = ; #initial file querry sequence print "\n Please Enter the library file name \n"; #initial library my $library = ; my @orgarr; my @inparr; my $recall; my $main = "c:/perl/sam/main.fasta"; #main.fasta stores the output to the fasta program $result = system("c:/perl/sam/fasta34.exe -O $main -Q $seqfile $library"); if ($result >> 0) { warn "fasta34.exe ended with non-zero exit status \n"; } open(FASTA,"$main") or die "cant open the output file \n"; my $seqname; my $org = "c:/perl/sam/orginal.fasta"; #original.fasta stores the header and the sequences of all the matches in fasta file my $input = "c:/perl/sam/input.txt"; #input.txt stores the header and the sequences of matches above cut off print "Enter your cut off percentage"; $cut = ; while () { #compare the line of matching sequence if(m/>>(.{4,6})(.*)/) { $seqname = $1; $laterhalf = $2; } #print "SKIP A LINE iF A MATCH \n"; next if /^ini/; if (m/(\d+\.\d+)% identity/) { $per = $1; #check if match is above the cutoff percentage if ($per > $cut) { #print "\n\n$seqname$laterhalf \n"; #print "identity match $per % \n"; #store the first line of the input file open(ORG,">>$org"); open(INPUT,">>$input"); print INPUT ">$seqname$laterhalf \n"; print ORG ">$seqname$laterhalf \n"; #print all the sequences which matched the cutoff while() { if (m/^($seqname)(.*)/) { #store the match sequence print INPUT "$2 \n"; print ORG "$2 \n"; } if(m/>>/) { #check if next sequence if so rewind one line back"; seek(FASTA,-100,1); #break command last; } } print INPUT "\n"; print ORG "\n"; close(INPUT); close(ORG); } else { #printing all the sequences which is showed in fasta o/p file open(ORG,">>$org"); print ORG ">$seqname$laterhalf \n"; while() { if (m/^($seqname)(.*)/) { #store the match sequence print ORG "$2 \n"; } if(m/>>/) { #print "end of given loop"; seek(FASTA,-100,1); last; } } print ORG "\n"; close(ORG); } } } close (FASTA); open(ORG,"$org"); open(INPUT,"$input"); @inparr = ; @orgarr = ; close(INPUT); close(ORG); $length=@inparr; print "length of inparr array is $length \n"; $querry = "c:/perl/sam/querry.aa"; $compare = "c:/perl/sam/compare.fasta"; $segcompare = "c:/perl/sam/segcompare.txt"; my $seqname1; my $laterhalf1; open(QUERRY,">$querry") or die "cannot open querry file\n"; open(SEGCOMPARE,">$segcompare") or die "cannot open segcompare file\n";; my $temp=0; while($temp<=$length) { while ($inparr[$temp] ne "\n") { print QUERRY "$inparr[$temp]"; $temp++; } $recall = system("c:/perl/sam/fasta34.exe -O $compare -Q $querry $library"); print "hi \n"; if ($recall > 0) { warn "fasta34.exe ended with non-zero exit status \n"; } open(COMPARE,"$compare")or die "cant open the output file \n"; while() { if(m/>>(.{4,6})(.*)/) { print SEGCOMPARE "\n"; $seqname1 = $1; $laterhalf1 = $2; print SEGCOMPARE "$seqname1$laterhalf1 \n"; } elsif (m/^($seqname1)(.*)/) { #store the match sequence print SEGCOMPARE "$2 \n"; } } my @segcomp = ; #$count++; #$temp++; } close(COMPARE); close(SEGCOMPARE); close(QUERRY);