rolandomantilla has asked for the wisdom of the Perl Monks concerning the following question:

I have the fallowing code(see below) and it is giving me this error

Use of /c modifier is meaningless without /g at hwk5.pl line 31. Barew +ord found where operator expected at hwk5.pl line 31, near "-database + => '/class" (Might be a runaway multi-line // string starting on line 4)(Missing + operator before lass?) Unquoted string "lass" may clash with future reserved word at hwk5.pl +line 31. syntax error at hwk5.pl line 31, near "-database=> '/class" Execution of hwk5.pl aborted due to compilation errors.

Here is the code and I will mark line 31 by ********

use Bio::SeqIO; use Bio::SearchIO; use Bio::Tools::Run::StandAloneBlast; use strict print "Write the file name from where you are getting the sequence form\n\n"; $file=<STDIN>; chomp $file; print "Write put the name of the output file\n\n"; $output=<STDIN>; chomp $output; #declare the required object my $seqio= ''; my $seqobj= ''; my $factory = ''; my $blast_report= ''; my $out_file= ''; $seqio= Bio::SeqIO->new(-file => $file, -format=> 'fasta'); while ($seqobj = $seqio->next_seq()) { $factory = Bio::Tools::Run::StandAloneBlast->new( -program =>'blastn', ***************-database => '/class/bi617a/share/blast/data/rat.rna.fn +a', -e=> 1e-6, _READMETHOD=> "Blast" ); $out_file = $seqobj->display_id . $outfile; $factory->outfile($out_file); $blast_report = $factory->blastall($seqobj); } #the blast output name my $filename= $outfile; #create an object tot he blast output file my $input= Bio::SearchIO->(-format => 'blastn', -file => $filename); #Print out the query, hit names and percent indenty, percent query ali +gned print "QueryName\tQueryLenght\tLengthMatch\tAccesionNumber\tDescription\tRan +k\tScore\%ID\tStartPostQ\tEndPosQ\tStartPosH\tEndPosH\n"; #Go thru the BLAST reports one by one while (my $result = $report->next_result) { while($hit=$result->next_hit) {#Go through eadch HSP for this sequence while ($hsp= $hit->next_hsp) { #Print some tab-delimited data about this HSP print $result->query_name, "\t"; print $result->query_length, "\t"; print $hsp->hsp_length, "\t"; print $result->query_accession, "\t"; print $hit->description, "\t"; print $hsp->rank, "\t"; print $hsp->score, "\t"; print $hsp->percent_identity, "\t"; print $hsp->start('query'), "\t"; print $hsp->end('query'), "\t"; print $hsp->start('hit'), "\t"; print $hsp->end('hit'), "\t"; } } }

Replies are listed 'Best First'.
Re: Bioperl FASTA parsing
by toolic (Bishop) on Aug 20, 2011 at 01:06 UTC
    use strict
    The ol' missing semicolon trick. Try this:
    use strict;
    But, then you'll have to declare all variables with my. Are you sure you posted the code you're running?

    It wouldn't hurt to run your code through perltidy either.