annotate interpro/paso1.pl @ 0:c342ebb50f0b draft default tip

Uploaded
author fernando
date Thu, 22 May 2014 05:09:07 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
1 #Remote-blast "factory object" creation and blast-parameter initialization
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
2
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
3 use Bio::Tools::Run::RemoteBlast;
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
4 use strict;
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
5 my $prog = 'blastp';
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
6 my $db = 'swissprot';
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
7 my $e_val= '1e-10';
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
8 my ($input,$output)=@ARGV;
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
9 my @params = ( '-prog' => $prog,
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
10 '-data' => $db,
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
11 '-expect' => $e_val,
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
12 '-readmethod' => 'SearchIO' );
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
13
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
14 my $factory = Bio::Tools::Run::RemoteBlast->new(@params);
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
15
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
16 #change a paramter
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
17 # $Bio::Tools::Run::RemoteBlast::HEADER{'ENTREZ_QUERY'} = 'Homo sapiens [ORGN]';
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
18
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
19 #remove a parameter
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
20 # delete $Bio::Tools::Run::RemoteBlast::HEADER{'FILTER'};
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
21
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
22 my $v = 1;
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
23 #$v is just to turn on and off the messages
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
24
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
25 my $str = Bio::SeqIO->new(-file=>$input , '-format' => 'fasta' );
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
26
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
27 while (my $input = $str->next_seq()){
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
28 #Blast a sequence against a database:
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
29
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
30 #Alternatively, you could pass in a file with many
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
31 #sequences rather than loop through sequence one at a time
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
32 #Remove the loop starting 'while (my $input = $str->next_seq())'
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
33 #and swap the two lines below for an example of that.
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
34 my $r = $factory->submit_blast($input);
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
35 #my $r = $factory->submit_blast('amino.fa');
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
36
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
37 print STDERR "waiting..." if( $v > 0 );
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
38 while ( my @rids = $factory->each_rid ) {
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
39 foreach my $rid ( @rids ) {
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
40 my $rc = $factory->retrieve_blast($rid);
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
41 if( !ref($rc) ) {
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
42 if( $rc < 0 ) {
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
43 $factory->remove_rid($rid);
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
44 }
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
45 print STDERR "." if ( $v > 0 );
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
46 sleep 5;
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
47 } else {
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
48 my $result = $rc->next_result();
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
49 #save the output
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
50 # my $filename = $result->query_name()."\.out";
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
51 my $filename="";
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
52 $factory->save_output($output);
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
53 $factory->remove_rid($rid);
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
54 #print "\nQuery Name: ", $result->query_name(), "\n";
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
55 #while ( my $hit = $result->next_hit ) {
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
56 # next unless ( $v > 0);
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
57 # print "\nhit name is ", $hit->name, "\n";
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
58 # while( my $hsp = $hit->next_hsp ) {
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
59 # print "HSP Len is ", $hsp->length('total'), " ",
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
60 # " E-value is ", $hsp->evalue, " Bit score ",
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
61 # $hsp->score, " \t",
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
62 # " Query loc: ",$hsp->query->start, " ",
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
63 # $hsp->query->end," ",
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
64 # " Sbject loc: ",$hsp->hit->start, " ",
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
65 # $hsp->hit->end,"\n";
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
66 # }
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
67 #}
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
68 }
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
69 }
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
70 }
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
71 }
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
72
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
73 # This example shows how to change a CGI parameter:
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
74 # $Bio::Tools::Run::RemoteBlast::HEADER{'MATRIX_NAME'} = 'BLOSUM25';
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
75
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
76 # And this is how to delete a CGI parameter:
c342ebb50f0b Uploaded
fernando
parents:
diff changeset
77 # delete $Bio::Tools::Run::RemoteBlast::HEADER{'FILTER'};