tenho o seguinte script e gostaria de imprimir/usar os dados do hash retornado pela subrotina blast_m8. Mas não tem dado certo. como que faço? obrigado Rondon #!/usr/bin/perl
use warnings;
use strict;
my $est = $ARGV[0];
my $CDS = $ARGV[1]
my %m8_est_VS_CDS = blast_m8($est, $CDS);
print %m8_est_VS_CDS;
exit;
##############################################
sub get_file_data {
use strict;
use warnings;
my $filename = $_[0];
print ("$filename\n");
my @filedata = ();
open(GET_FILE_DATA, $filename) || die ($!);
@filedata = <GET_FILE_DATA>;
close GET_FILE_DATA;
return @filedata;
}
##############################################
sub m8_into_hash {
use warnings;
use strict;
my $file = $_[0];
my %hash;
my @m8 = get_file_data($file);
foreach my $line (@m8){
chomp $line;
my @aux = split (/\t/, $line);
my $query_id = $aux[0];
my $subject_id = $aux[1];
my $identity = $aux[2];
my $ali_length = $aux[3];
my $mismatches = $aux[4];
my $gaps = $aux[5];
my $q_start = $aux[6];
my $q_end = $aux[7];
my $s_start = $aux[8];
my $s_end = $aux[9];
my $evalue = $aux[10];
my $score = $aux[11];
$hash{$query_id}{subject_id} = $subject_id;
$hash{$query_id}{identity} = $identity;
$hash{$query_id}{ali_length} = $ali_length;
$hash{$query_id}{mismatches} = $mismatches;
$hash{$query_id}{gaps} = $gaps;
$hash{$query_id}{q_start} = $q_start;
$hash{$query_id}{q_end} = $q_end;
$hash{$query_id}{s_start} = $s_start;
$hash{$query_id}{s_end} = $s_end;
$hash{$query_id}{evalue} = $evalue;
$hash{$query_id}{score} = $score;
}
return %hash;
}
##############################################
sub blast_m8 {
#perform blast (first "query" than "DB")
use strict;
my ($est, $CDS) = @_;
my $outfile = "megablast_results";
my $blast_commands = "megablast -i $est -d $CDS -m8 > $outfile";
my $blast_output = system($blast_commands);
my %m8 = m8_into_hash ($outfile);
return %m8;
}