User Password
|
Login / Create Account
<< Back to the Blog

A simple PERL script to retrieve a sequence from the ncbi website

Tags retrieve sequence fasta perl ncbi
By: matthieu chartier  
January 7 2012


Here's a sample PERL script to quickly retrieve a protein sequence in the fasta format from the NCBI database using the E-utilities URL syntax. The E-utilities provide simple ways to retrieve a wide variety of information using a simple URL. For more information. In this example we use the gi (Gene ID) 632964 but it also works with a gene accession id (i.e.: AAA61480.1).

#!/usr/bin/perl

use LWP::Simple;

my $id="632964";
my $url = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=sequences&id=$id&rettype=fasta&retmode=text";

@result = get($url);

foreach(@result){
print $_;
}



Comments (0)
Login to leave a comment.