##
sub filter_by_Species()
# Don't use prototypes unless you NEED them. And even then, you probably don't.
open( NEWALIGN, ";
# Arggh. Read entire file into an array at once.
my @subjects = []; # reference to empty array
# nope. Array whose first element is a reference to an empty array
#so I produce a hash with key = >gi line of report and value = all lines after until next >gi
# I saw no "greater than" in the example data...
for (my $i = 0 ; $i/)
# again, no "greater than" in the example data...
{
$current_subject = $resultLine[ $i ];
chomp ($current_subject);
push (@subjects, $current_subject);
$alignment->{$current_subject} = "";
$alignment->{$current_subject}.$resultLine[ $i ];
}
# you never use the %$alignment hash anywhere so why bother?
my @elements;
my $boolean;
# declare variables in the smallest scope possible
foreach my $z (@subjects)
{
chomp $z;
# already chomped in previous loop
show_Output($boolean, $z, @elements);
# boolean ALWAYS equal 0. Why not just pass 0?
## ##
sub filter_by_Species
{
print 'New Blast File Opened
';
open(my $newalign, '<', "blast_files/$newBlastFile") or die $!;
print 'Filtering Data........Please wait';
my @subjects;
while <$newalign>
{
push @subjects, $_ if (/^>gi/)
}
print '
';
print 'Status ';
print 'Information on new hits ';
for (@subjects)
{
chomp;
my @elements = split '\|';
if($elements[-1] =~ /$species_filter/)
{
print "Match to $species_filter";
show_Output(0, $_, @elements);
}
}
print'
';
}