geteisA

Michael Somos somos at grail.cba.csuohio.edu
Tue Feb 5 22:12:46 CET 2002


seqfans,

I thought there may be more people like me who would like to have
a command line tool to retrieve a single sequence entry from EIS.
I am building a selective cache of sequences that I am interested
in and required such a tool although in the past I just used very
simple process of manual cut and paste. Now, you don't need to.

==================================================================
#!/usr/bin/perl -w
# get sequence from EIS by A number -- Michael Somos 05 Feb 2002
# --- Note: requires external 'nc' netcat utility in path
use strict;
die 'needs a positive sequence number' if ( $#ARGV < 0 ) ;
my $seqno = $ARGV[0] ;
die 'needs a positive sequence number' unless ( $seqno =~ /^\d+$/ ) ;
$seqno = int($seqno) ;
die 'needs a positive sequence number' if ( $seqno < 1 ) ;
# --- Note: use the old internal format query
my $q='GET /cgi-bin/access.cgi/as/njas/sequences/eisA2.cgi?Anum='.$seqno ;
# --- Note: use handy dandy 'nc' netcat utility
$_ =`echo "$q" | nc -w 15 www.research.att.com 80` ;
die 'temporary database error, try again please' if ( /open dbase:/ ) ;
die 'strange, did not get valid sequence entry' unless ( /%S A/ ) ;
# --- Note: undo HTML encoding transformations
s/</</g;          # convert HTML entity
s/>/>/g;          # convert HTML entity
s/\\\n  //g;         # merge split line
my @v = split /\n/ ; # split into line array
# --- Note: add optional HTML wrapper to the body
printf "<html><head><title>EIS: A%06d</title></head><body>\n",$seqno ;
print "EIS ".gmtime()." GMT\n";
print "<PRE>\n";
print '='x79,"\n";
foreach (@v) { print "$_\n" if (/^%/) } # select '%' lines only
print '='x79,"\n";
==================================================================

Shalom, Michael





More information about the SeqFan mailing list