hi guys

i m trying to rerun the system command, the first time it runs perfectly fine since i input the file names thru command line.

the program gets hanged up at the second system command, it states "could not open c"

$compare file will be created when the fasta34.exe application is complete, $library is entered thru the intial input command line,

$querry is the one i guess is creating the problem ... i wanted to know whether i m using the correct way of file handling ....since $querry file should be created before i call fasta34.exe as querry.aa is input to it

following is my code, can anybody guide me
#!usr/bin/perl -w use strict; use warnings; print"\n********Running Fasta34********** \n \n"; print"\n Please enter the file sequence \n"; my $seqfile = <STDIN>; #initial file querry sequence print "\n Please Enter the library file name \n"; #initial library my $library = <STDIN>; my @orgarr; my @inparr; my $recall; my $laterhalf; my $seqname; my $per; my $length; my $compare; my $querry; my $org; my $segcompare; my $main = "c:/perl/sam/main.fasta"; #main.fasta stores the output to the fasta program my $result = system("c:/perl/sam/fasta34.exe -O $main -Q $seqfile $lib +rary"); if ($result >> 8) { warn "fasta34.exe ended with non-zero exit status \n"; } open(FASTA,"$main") or die "cant open the output file \n"; $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 o +ff print "Enter your cut off percentage"; my $cut = <STDIN>; while (<FASTA>) { #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(<FASTA>) { 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 f +ile open(ORG,">>$org"); print ORG ">$seqname$laterhalf \n"; while(<FASTA>) { 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 = <INPUT>; @orgarr = <ORG>; 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++; } #system command is working check for further instruction $recall = system("c:/perl/sam/fasta34.exe -O $compare -Q $querry $ +library"); if ($recall >> 8) { warn "fasta34.exe ended with non-zero exit status \n"; } open(COMPARE,"$compare")or die "cant open the output file \n"; while(<COMPARE>) { open(SEGCOMPARE,">$segcompare") or die "cannot open segcompare + file\n";; 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 = <SEGCOMPARE>; } close(COMPARE); close(SEGCOMPARE); close(QUERRY);

In reply to Could not open by FarTech

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.