Schrift
[thread]7519[/thread]

Bioperl: remoteblast speichert Output file nicht



<< |< 1 2 >| >> 19 Einträge, 2 Seiten
paidopoieo
 2005-12-02 02:27
#60680 #60680
User since
2005-12-02
96 Artikel
BenutzerIn
[default_avatar]
Hi,
Ich bin ziemlich verzweifelt, da ich seit zwei Tagen versuche meinen Output in einem file zu speichern, das file wird zwar angelegt, ist jedoch leer...Blast ist ein Bioinformatiktool, das ich uebers Netz anspreche.....da geht auch alles nur die files sind alle leer.....
hier der code......


Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/perl -w

use strict;
use warnings;
use Bio::SeqIO;
use Bio::Tools::Run::RemoteBlast;
use Bio::Seq;
use IO::String;
use Bio::SearchIO;



my $prog = 'blastp';
my $db = 'swissprot';
my $e_val= '20000';
my $matrix = 'PAM30';
#my $outfile = 'Output';

my @data;
my $line_dataArray;
my $rid;
my $count = 1;


my @params = ( '-prog' => $prog,
'-data' => $db,
'-expect' => $e_val,
'-matrix' => $matrix);


my $seqio_obj = Bio::SeqIO->new(-file => "Perm.txt",
-format => "raw",
);


print "entering blast....";
my $factory = Bio::Tools::Run::RemoteBlast->new (@params);
print "Blast entered successfully \n";




while( my $query = $seqio_obj->next_seq ) {
print "submit Sequence...just do it....\n";
my $r = $factory->submit_blast($query);
print $query->seq;
print "\n";

# Wait for the reply and save the output file
print "entering while loop for saving Output.... \n";
while ( my @rids = $factory->each_rid ) {
foreach my $rid ( @rids ) {
my $rc = $factory->retrieve_blast($rid);
print "retrieved Results successfully \n";
if( !ref($rc) ) {
if( $rc < 0 ) {
$factory->remove_rid($rid);
}
sleep 5;
} else {
#my $result = $rc->next_result;
print $rid;
print "\n";
my $filename = " $count .out";
$factory->save_output($filename);
print "File saved successfully \n";
$count++;
$factory->remove_rid($rid);
# }
}
}
print "\n";
print "\n";


}
}


Ich hoffe es kann mir jemand helfen, dankeschoen im voraus...

mfg
Hubert
esskar
 2005-12-02 02:33
#60681 #60681
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
ich kenn das modul nicht, aber gibt save_output vielleicht einen return wert zurück denn man irgendwie auswerten kann ?
paidopoieo
 2005-12-02 03:35
#60682 #60682
User since
2005-12-02
96 Artikel
BenutzerIn
[default_avatar]
Hallo esskar,

Title : saveoutput
Usage : my $saveoutput = $self->save_output($filename)
Function: Method to save the blast report
Returns : 1 (throws error otherwise)
Args : string [rid, filename]

das waere der beitrag zur methode save_output

und wenn ich mein programm starte dann laeuft es einwandfrei durch, speichert auch das file, nur leider ist es leer.....

das der Code zur methode save_output

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
sub save_output  {

my ($self, $filename) = @_;
if( ! defined $filename ) {
$self->throw("Can't save blast output. You must specify a filename to save to.");
}
#should be set when retrieving blast
my $blastfile = $self->file;
#open temp file and output file, have to filter out some HTML
open(TMP, $blastfile) or $self->throw("cannot open $blastfile");
open(SAVEOUT, ">$filename") or $self->throw("cannot open $filename");
my $seentop=0;
while(<TMP>) {
next if (/<pre>/);
if( /^(?:[T]?BLAST[NPX])\s*.+$/i ||
/^RPS-BLAST\s*.+$/i ) {
$seentop=1;
}
next if !$seentop;
if( $seentop ) {
print SAVEOUT;
}
}
close SAVEOUT;
close TMP;
return 1;

}


der output meines programms ist folgender:

entering blast....Blast entered successfully
submit Sequence...just do it....
RKKWWWRW
Sequence submitted successfully
entering while loop for saving Output....
retrieved Results successfully
1133487045-22411-147042628522.BLASTQ1
File saved successfully


submit Sequence...just do it....
RKKWWWWK
Sequence submitted successfully
entering while loop for saving Output....
retrieved Results successfully
1133487046-1295-107621241415.BLASTQ4
File saved successfully


vielen Dank fuer deine Bemuehungen
Dankeschoen
esskar
 2005-12-02 03:46
#60683 #60683
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
kannst du noch die perm.txt veröffentlichen?
dann könnt ich es mal testen... momentan bekomm ich nur

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Could not open Perm.txt for reading: No such file or directory
STACK: Error::throw
STACK: Bio::Root::Root::throw F:/Perl/site/lib/Bio/Root/Root.pm:342
STACK: Bio::Root::IO::_initialize_io F:/Perl/site/lib/Bio/Root/IO.pm:260
STACK: Bio::SeqIO::_initialize F:/Perl/site/lib/Bio/SeqIO.pm:437
STACK: Bio::SeqIO::raw::_initialize F:/Perl/site/lib/Bio\SeqIO\raw.pm:94
STACK: Bio::SeqIO::new F:/Perl/site/lib/Bio/SeqIO.pm:355
STACK: Bio::SeqIO::new F:/Perl/site/lib/Bio/SeqIO.pm:368
STACK: -:31
-----------------------------------------------------------
renee
 2005-12-02 11:01
#60684 #60684
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Sind die Leerzeichen im Output-Namen gewollt??

Hast Du auch die Sequenz mal per Hand geblastet und mit dem von Dir eingestellten e-Value verglichen?

Mach auch mal:
Code: (dl )
1
2
3
4
5
6
7
8
my $filename = $count.".out";
my $save_retval = $factory->save_output($filename);
print "Returnvalue of save_output(): $save_retval\n";

open(my $fh,"<$filename") or die $!;
while(<$fh>){
print;
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
paidopoieo
 2005-12-02 19:25
#60685 #60685
User since
2005-12-02
96 Artikel
BenutzerIn
[default_avatar]
Hi, ja Sorry natuerlich....

RKKWWWRW
RKKWWWKW
KRKWKRKW
RKRKWKRR
RKRKWKRW
RKRKWKWK
KRKWKWRW

ein einfaches Textfile, wo du das einfach reinkopierst, sonst nichts, wird dann Zeile fuer Zeile ausgelesen...

Danke
paidopoieo
 2005-12-02 20:52
#60686 #60686
User since
2005-12-02
96 Artikel
BenutzerIn
[default_avatar]
Hi Renee
*gg* nein, die leerzeichen waren nicht gewollt, danke
hab die Sequenzen per Hand geblastet, bekomm ich auch output...also hits sind jede menge vorhanden...
wenn ich deinen Code verwende funktioniert das auch....bekomme ausgabe auf commandline und in files, jedoch nur immer die erste Sequenz, es endet in einer endlosschleife.....es lest mir immer nur die erste Sequenz aus....
wenn ich die mehtode
$factory->remove_rid($rid); einbaue um die rid dann laeuft es durch legt mir soviele files an wie sequenzen geblastet wurden, jedoch steht nichts in den files.....
keine Ahnung was ich falsch mache, bin zu dumm, find den fehler einfach nicht....

mfg
Hubert
esskar
 2005-12-02 21:34
#60687 #60687
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
ich hab den code mal ge-perltidy-ed und ihn dann auf die daten losgelassen...

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/perl -w

use strict;
use warnings;
use Bio::SeqIO;
use Bio::Tools::Run::RemoteBlast;
use Bio::Seq;
use IO::String;
use Bio::SearchIO;

my $prog = 'blastp';
my $db = 'swissprot';
my $e_val = '20000';
my $matrix = 'PAM30';

#my $outfile = 'Output';

my @data;
my $line_dataArray;
my $rid;
my $count = 1;

my @params = (
'-prog' => $prog,
'-data' => $db,
'-expect' => $e_val,
'-matrix' => $matrix
);

my $seqio_obj = Bio::SeqIO->new(
-file => "Perm.txt",
-format => "raw",
);

print "entering blast....";
my $factory = Bio::Tools::Run::RemoteBlast->new(@params);
print "Blast entered successfully \n";

while ( my $query = $seqio_obj->next_seq ) {
print "submit Sequence...just do it....\n";
my $r = $factory->submit_blast($query);
print $query->seq;
print "\n";

# Wait for the reply and save the output file
print "entering while loop for saving Output.... \n";
while ( my @rids = $factory->each_rid ) {
foreach my $rid (@rids) {
my $rc = $factory->retrieve_blast($rid);
if ( !ref($rc) ) {
print '$rc is not a ref!', "\n";
if ( $rc < 0 ) {
print "Remove rid ...\n";
$factory->remove_rid($rid);
}
# sleep 5;
}
else {

print "retrieved Results successfully \n";
print $rid;
print "\n";
my $filename = "$count.out";
$factory->save_output($filename);
print "File saved successfully \n";
$count++;
$factory->remove_rid($rid);
}
}
print "\n";
print "\n";

}
}


und hier der output

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
entering blast....Blast entered successfully
submit Sequence...just do it....
RKKWWWRW
entering while loop for saving Output....

-------------------- WARNING ---------------------
MSG: <HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#660099" ALINK="#660099">
<IMG SRC="images/head_results.gif" ALT="Header of the page" BORDER="0"NAME="BlastHeaderGif" WIDTH="600" HEIGHT="45" ALIGN="middle">
<form action="Blast.cgi" enctype="application/x-www-form-urlencoded" method="POST"><hr><font color="red">ERROR: Invalid RID: 1133551880-19615-126416106060</font


---------------------------------------------------
$rc is not a ref!
Remove rid ...


submit Sequence...just do it....
RKKWWWKW
entering while loop for saving Output....

-------------------- WARNING ---------------------
MSG: <HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#660099" ALINK="#660099">
<IMG SRC="images/head_results.gif" ALT="Header of the page" BORDER="0"NAME="BlastHeaderGif" WIDTH="600" HEIGHT="45" ALIGN="middle">
<form action="Blast.cgi" enctype="application/x-www-form-urlencoded" method="POST"><hr><font color="red">ERROR: Invalid RID: 1133551883-28224-102103062411</font


---------------------------------------------------
$rc is not a ref!
Remove rid ...


submit Sequence...just do it....
KRKWKRKW
entering while loop for saving Output....

-------------------- WARNING ---------------------
MSG: <HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#660099" ALINK="#660099">
<IMG SRC="images/head_results.gif" ALT="Header of the page" BORDER="0"NAME="BlastHeaderGif" WIDTH="600" HEIGHT="45" ALIGN="middle">
<form action="Blast.cgi" enctype="application/x-www-form-urlencoded" method="POST"><hr><font color="red">ERROR: Invalid RID: 1133551891-20159-118320711185</font


---------------------------------------------------
$rc is not a ref!
Remove rid ...


submit Sequence...just do it....
RKRKWKRR
entering while loop for saving Output....

-------------------- WARNING ---------------------
MSG: <HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#660099" ALINK="#660099">
<IMG SRC="images/head_results.gif" ALT="Header of the page" BORDER="0"NAME="BlastHeaderGif" WIDTH="600" HEIGHT="45" ALIGN="middle">
<form action="Blast.cgi" enctype="application/x-www-form-urlencoded" method="POST"><hr><font color="red">ERROR: Invalid RID: 1133551897-20419-66770204654</font>


---------------------------------------------------
$rc is not a ref!
Remove rid ...


submit Sequence...just do it....
RKRKWKRW
entering while loop for saving Output....

-------------------- WARNING ---------------------
MSG: <HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#660099" ALINK="#660099">
<IMG SRC="images/head_results.gif" ALT="Header of the page" BORDER="0"NAME="BlastHeaderGif" WIDTH="600" HEIGHT="45" ALIGN="middle">
<form action="Blast.cgi" enctype="application/x-www-form-urlencoded" method="POST"><hr><font color="red">ERROR: Invalid RID: 1133551905-20883-151607413394</font


---------------------------------------------------
$rc is not a ref!
Remove rid ...


submit Sequence...just do it....
RKRKWKWK
entering while loop for saving Output....

-------------------- WARNING ---------------------
MSG: <HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#660099" ALINK="#660099">
<IMG SRC="images/head_results.gif" ALT="Header of the page" BORDER="0"NAME="BlastHeaderGif" WIDTH="600" HEIGHT="45" ALIGN="middle">
<form action="Blast.cgi" enctype="application/x-www-form-urlencoded" method="POST"><hr><font color="red">ERROR: Invalid RID: 1133551910-29540-201656722897</font


---------------------------------------------------
$rc is not a ref!
Remove rid ...


submit Sequence...just do it....
KRKWKWRW
entering while loop for saving Output....

-------------------- WARNING ---------------------
MSG: <HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#660099" ALINK="#660099">
<IMG SRC="images/head_results.gif" ALT="Header of the page" BORDER="0"NAME="BlastHeaderGif" WIDTH="600" HEIGHT="45" ALIGN="middle">
<form action="Blast.cgi" enctype="application/x-www-form-urlencoded" method="POST"><hr><font color="red">ERROR: Invalid RID: 1133551913-21163-178685964119</font


---------------------------------------------------
$rc is not a ref!
Remove rid ...
paidopoieo
 2005-12-02 22:36
#60688 #60688
User since
2005-12-02
96 Artikel
BenutzerIn
[default_avatar]
Hallo esskar
ich versteh das nicht, ich hab den Code von dir jetzt hergenommen, also wirklich 1:1, dasselbe File genommen, und bekomme einen total anderen Output als du
meiner ist folgender

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
entering blast....Blast entered successfully 
submit Sequence...just do it....
RKKWWWRW
entering while loop for saving Output....
retrieved Results successfully
1133555438-29092-124335031569.BLASTQ1
File saved successfully


submit Sequence...just do it....
RKKWWWKW
entering while loop for saving Output....
retrieved Results successfully
1133555439-4896-23908741072.BLASTQ1
File saved successfully


submit Sequence...just do it....
KRKWKRKW
entering while loop for saving Output....
retrieved Results successfully
1133555440-29328-95626490823.BLASTQ4
File saved successfully


submit Sequence...just do it....
RKRKWKRR
entering while loop for saving Output....
retrieved Results successfully
1133555444-29639-155573299435.BLASTQ4
File saved successfully


submit Sequence...just do it....
RKRKWKRW
entering while loop for saving Output....
retrieved Results successfully
1133555446-5204-89705951466.BLASTQ4
File saved successfully


submit Sequence...just do it....
RKRKWKWK
entering while loop for saving Output....
retrieved Results successfully
1133555451-29985-25534453809.BLASTQ1
File saved successfully


submit Sequence...just do it....
KRKWKWRW
entering while loop for saving Output....
retrieved Results successfully
1133555452-30075-83189027376.BLASTQ1
File saved successfully


Was in Gottes Namen laeuft da falsch..... er legt mir die Files an aber sie sind leer, bei mir geht er in die if bedingung gar nicht rein.....gleich else zweig...

mfg
renee
 2005-12-03 05:57
#60689 #60689
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Mach mal:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/perl -w

use strict;
use warnings;
use Bio::SeqIO;
use Bio::Tools::Run::RemoteBlast;
use Bio::Seq;
use IO::String;
use Bio::SearchIO;

my $prog = 'blastp';
my $db = 'swissprot';
my $e_val = '20000';
my $matrix = 'PAM30';

#my $outfile = 'Output';

my @data;
my $line_dataArray;
my $rid;
my $count = 1;

my @params = (
'-prog' => $prog,
'-data' => $db,
'-expect' => $e_val,
'-matrix' => $matrix
);

my $seqio_obj = Bio::SeqIO->new(
-file => "Perm.txt",
-format => "raw",
);

print "entering blast....";
my $factory = Bio::Tools::Run::RemoteBlast->new(@params);
print "Blast entered successfully \n";

while ( my $query = $seqio_obj->next_seq ) {
print "submit Sequence...just do it....\n";
my $r = $factory->submit_blast($query);
print $query->seq;
print "\n";

# Wait for the reply and save the output file
print "entering while loop for saving Output.... \n";
while ( my @rids = $factory->each_rid ) {
foreach my $rid (@rids) {
my $rc = $factory->retrieve_blast($rid);
if ( !ref($rc) ) {
print '$rc is not a ref!', "\n";
if ( $rc < 0 ) {
print "Remove rid ...\n";
$factory->remove_rid($rid);
}
# sleep 5;
}
else {

print "retrieved Results successfully \n";
print $rid;
print "\n";
my $filename = "$count.out";
#my $checkname = "check$count.out";
$factory->save_output($filename);
print "File saved successfully \n";
my $checkinput = $factory->file;
open(my $fh,"<$checkinput") or die $!;
while(<$fh>){
print;
}
close $fh;
$count++;
$factory->remove_rid($rid);
}
}
print "\n";
print "\n";

}
}


BTW: Auf welchem Betriebssystem arbeitest Du? Bioperl-Version? Perl-Version?
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
<< |< 1 2 >| >> 19 Einträge, 2 Seiten



View all threads created 2005-12-02 02:27.