cumurph has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl; use strict; # installed bioperl locally, use local bioperl lib #use lib="/home/murphyr/lib/"; use Bio::Seq; use Bio::SeqIO::fasta; use Bio::Tools::Blast; use Bio::Tools::Run::StandAloneBlast; use Bio::Tools::SeqStats; use Data::Dumper; print "Program to blast subsequences \n"; print "Enter File name of Sequence in FASTA Format \n"; my $inputfile = <STDIN>; print "$inputfile \n"; my $inseq1 = Bio::SeqIO ->new('-file' => "$inputfile", '-format'=> 'fa +sta'); my $outseq1 = new Bio::SeqIO (-fh => \*STDOUT, -format => 'fasta'); my $seq1 = $inseq1 -> next_seq(); my $seq_stats1 = Bio::Tools::SeqStats->new(-seq=>$seq1); my $monomer_ref = $seq_stats1 -> count_monomers(); my @k = keys %$monomer_ref; my @v = values %$monomer_ref; print "@k\n"; print "@v\n"; my $mytotal = 0; foreach my $value (@v) { $mytotal = $mytotal + $value; } # print "$seq1 -> seq()\n"; my $did = $seq1 -> display_id(); print "$did\n"; print "Here \n"; # print $outseq1 -> write_seq($seq1); my $start_pos = 0; my $end_pos = 24; while ($end_pos != $mytotal) { $start_pos = $start_pos + 1; $end_pos = $end_pos + 1; my $subseq = $seq1 -> subseq($start_pos, $end_pos); print "$subseq \n"; print "Now doing blast on $subseq \n"; my @params = ('program' => 'blastn', 'database' => 'virus-db', 'outfile' => "$subseq.out"); my $factory = Bio::Tools::Run::StandAloneBlast->new(@params); my $subinput = Bio::Seq->new('-id'=>"sub test query", '-seq'=>"$subseq"); my $blast_report = $factory->blastall($subinput); # Get the report my $searchio = new Bio::SearchIO ('-format' => 'blast', '-file' => "$subseq.out"); my $result = $searchio->next_result; # Get info about the entire report $result->database_name; my $algorithm_type = $result->algorithm; # get info about the first hit my $hit = $result->next_hit; my $hit_name = $hit->name ; # get info about the first hsp of the first hit my $hsp = $hit->next_hsp; my $hsp_start = $hsp->query->start; print "Now parsing the blast reports using SearchIO \n"; # # Not being selective here ... print the whole she-bang! ... # print "Algorithm Type \n"; print "$algorithm_type \n"; while ( (my $khit, my $vhit) = each %{$hit}) { print "$khit => $vhit \n"; } print Dumper(\%$hit); print "Hit Name \n"; print "$hit_name\n"; while ( (my $khit,my $vhit) = each %{$hsp}) { if ($khit eq "_evalue") { print "$khit => $vhit \n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Parsing BLAST
by bowei_99 (Friar) on Apr 24, 2006 at 03:43 UTC | |
Re: Parsing BLAST
by educated_foo (Vicar) on Apr 24, 2006 at 05:52 UTC | |
Re: Parsing BLAST
by MadraghRua (Vicar) on Apr 24, 2006 at 19:19 UTC | |
by cumurph (Novice) on Apr 25, 2006 at 00:04 UTC | |
by Anonymous Monk on Apr 25, 2006 at 00:28 UTC | |
by srdst13 (Pilgrim) on Apr 25, 2006 at 01:58 UTC | |
by Anonymous Monk on Apr 25, 2006 at 09:03 UTC | |
by cumurph (Novice) on Apr 25, 2006 at 16:53 UTC | |
by MadraghRua (Vicar) on Apr 25, 2006 at 21:23 UTC | |
| |
by cumurph (Novice) on Apr 25, 2006 at 17:13 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |