生物信息:perl批量下载pdb数据
#!/perl 64/bin/perl -wuse WWW::Mechanize;
use Storable;
@pdb_code=qw(3ASU 3GED 3GUY 3IOY 3PK0 4DYV 4GH5 4IQG 4ITU 4ONE);#粘贴你要下载的pdb ID
$num1=@pdb_code;#下载的pdb文件数量
print "下载的pdb文件数为 $num1\n";
for(my $i=0;$i<$num1;$i++){
$url = 'http://www.rcsb.org/pdb/files/$pdb_code[$i].pdb';
$m = WWW::Mechanize->new();
$m->get($url);
$c = $m->content;
$b=$c;
open(A,">C:/Perl64/workplace/pdb/$pdb_code[$i].pdb")||die("Can not open the file!$!n");#pdb文件下载完成后的路径
print A $b;
}
页:
[1]