On Fri, 2005-10-28 at 03:37 -0700, ZHAO, BING wrote: > Hi, > Is there a way to run unix command in perl? > To be specific, for the ftp command: > 1.ftp ftp.rcsb.org > 2.cd /pub/pdb/data/structures/divided/pdb/ > 3.cd nx > 4.get pdb1nxc.ent.Z > 5.bye > I need to automate this process to ftp get the file > pdb1nxc.ent.Z. > thank you. > > bing
Hello, To get PDBs from the PDB! try this: #!/usr/bin/perl #THIS SCRIPT WAS WRITTEN BY JAIME PRILUSKY @ WEIZMANN INSTITUTE use LWP::Simple; my @ids = @ARGV; die "\nUsage: $0 PDBid PDBid\n\n" if ($ARGV[0] =~ /^ *$/); foreach $id (@ids) { my $pdbfile = $id . "\.pdb"; my $status = mirror("http://bip.weizmann.ac.il/oca-bin/save-pdb?$id", $pdbfile); if (-z $pdbfile) { print "Unable to retrieve $pdbfile\n"; unlink($pdbfile); } else { print "Retrieved $pdbfile\n"; } } Thanks to Jaime Prilusky. I find this script rather handy. > -- Daniel Klose PhD Student - Taylor Group Mathematical Biology National Institute for Medical Research The Ridgeway Mill Hill London NW7 1AA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>