I should not have to use a loop. I have tested the program locally and it works.
#!/usr/bin/perl use strict; use Data::Dumper; use warnings; use Bio::SeqIO; use IO::Handle; use Bio::SearchIO; use Bio::AlignIO; use LWP::Simple; use IO::String; use Bio::SearchIO::Writer::TextResultWriter; my @results_arr = get_info(); open( my $out,">C:/Documents and Settings/mgavi.brathwaite/Desktop/bl2 +seq_parsing/out.txt"); print $out "$results_arr[0]", "\n", "$results_arr[1]"; sub get_info{ my $maid = '10890'; my $maid_dir = "C:/Documents and Settings/mgavi.brathwaite/Desktop/bl2 +seq_parsing"; my $in = new Bio::SearchIO(-format => 'blast', -file => $maid_dir."/".$maid."aln_hu.aln" +, -report_type => 'blastn'); open(my $out, ">$maid_dir/".$maid."aln_hu_parsed.out"); #my $out = Bio::AlignIO->newFh(-file => ">$maid_dir/".$maid."aln_hu_pa +rsed.out", # -format => 'clustalw' ); my $result=$in->next_result; my($hu_aln,$hu_mismatches); # Get info about the first hit my $hit = $result->next_hit; my $name = $hit->name; # get info about the first hsp of the first hit my $hsp = $hit->next_hsp; # get the alignment object my $aln = $hsp->get_aln; #my $percent_id = $hsp->percent_identity; #my $aln_length = $hsp->length('total'); my @mismatches = $hsp->seq_inds('query','nomatch'); my $aln_str=""; # access the alignment string my $strIO=IO::String->new($aln_str); # write the string alignio in clustalw format my $alnio = Bio::AlignIO->new(-format => 'clustalw', -fh=>$strIO); # now the actual alignment string is accessable for printing or in thi +s case moving to a db table $alnio->write_aln($aln); $hu_aln=$aln_str; $hu_mismatches = scalar @mismatches; print $out $hu_mismatches, "\n",$hu_aln; return ($hu_aln, $hu_mismatches); }
When I use it as a subroutine in a larger program is when I run into trouble. I have checked and it is reading in the file. Any ideas?

In reply to Re^4: I don't understand error message by lomSpace
in thread I don't understand error message by lomSpace

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.