我試圖提交http://bioinfo.noble.org/TrSSP/
一種形式,要提取的結果。
我的查詢數據看起來像這樣
>ATCG00270
MTIALGKFTKDEKDLFDIMDDWLRRDRFVFVGWSGLLLFPCAYFALGGWFTGTTFVTSWYTHGLASSYLEGCNFLTAA VSTPANSLAHSLLLLWGPEAQGDFTRWCQLGGLWAFVALHGAFALIGFMLRQFELARSVQLRPYNAIAFSGPIAVFVSVFLIYPLGQSGWFFAPSFGVAAIFRFILFFQGFHNWTLNPFHMMGVAGVLGAALLCAIHGATVENTLFEDGDGANTFRAFNPTQAEETYSMVTANRFWSQIFGVAFSNKRWLHFFMLFVPVTGLWMSALGVVGLALNLRAYDFVSQEIRAAEDPEFETFYTKNILLNEGIRAWMAAQDQPHENLIFPEEVLPRGNAL
我的劇本是這樣的
use strict;
use warnings;
use File::Slurp;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new;
my $sequence = $ARGV[0];
$mech->get('http://bioinfo.noble.org/TrSSP');
$mech->submit_form(fields => { 'query_file' => $sequence, },);
print $mech->content;
#sleep (10);
open(OUT, ">out.txt");
my @a = $mech->find_all_links();
print OUT "\n", $a[$_]->url for (0 .. $#a);
print $mech->content
給出這樣
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>The job is running, please wait...</title>
<meta http-equiv="refresh" content="4;url=/TrSSP/?sessionid=1492435151653763">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="interface/style.css" type="text/css">
</head>
<body>
<table width="90%" align="center" border="0" cellpadding="0" cellspacing="0" class="table1">
<tr align="center">
<td width="50"> </td>
<td></td>
<td> </td>
</tr>
<tr align="left" height="30" valign="middle">
<td width="30"> </td>
<td bgColor="#CCCCFF"> Your sequences have been submitted to backend pipeline, please wait for result:</td>
<td width="30"> </td>
</tr>
<tr align="left">
<td> </td>
<td>
<br><br><font color="#0000FF"><strong>
</strong></font>
<BR><BR><BR><BR><BR><BR><br><br><BR><br><br><hr>
If you don't want to wait online, please copy and keep the following link to retrieve your result later:<br>
<strong>http://bioinfo.noble.org/TrSSP/?sessionid=1492435151653763</strong>
<script language="JavaScript" type="text/JavaScript">
function doit()
{
window.location.href="/TrSSP/?sessionid=1492435151653763";
}
setTimeout("doit()",9000);
</script>
</td>
<td> </td>
</tr>
</table>
</body>
</html>
我想提取這個環節
結果http://bioinfo.noble.org/TrSSP/?sessionid=1492435151653763
並在作業完成時下載結果。但find_all_links()
正在將/TrSSP/?sessionid=1492434554474809
識別爲鏈接。
*「在作業完成時下載結果」*您是否希望輪詢該地址直到它提供完成的結果? – Borodin
其實我的最終目標是提取出現在該地址上的結果。但我不確定需要多長時間。因此,我認爲要提取地址(http://bioinfo.noble.org/TrSSP/?sessionid=1492435151653763),然後稍後再提取結果。但是我不確定這是否是完成這項工作的最佳方式。謝謝。 – pali