[ensembl-dev] retrieve DNA Sequence

William Spooner whs at eaglegenomics.com
Fri Apr 15 18:41:00 BST 2011


Hi Erik,

I would use the Ensembl perl API. The Core API tutorial at http://www.ensembl.org/info/data/api.html should be enough to get you started, but here's some pointers;

To get the gene from the name;
  my ($gene) = @{$gene_adaptor->fetch_all_by_external_name('Leptin')}

To get the region of the gene;
  my $slice = $gene->feature_Slice;

To get the region upstream of the gene;
  my $upstream_slice = $slice->extend(10000)->subslice(1,10000);

And the sequence;
  $upstream_slice->seq;

Will

On 12 Apr 2011, at 21:39, Erik van Renselaar wrote:

> Given an organism (say: human) and a gene name (say: Leptin) I am looking for the location of the gene in the DNA sequence. I then want to download 10KBp upstream. Is anyone aware of code that can help me do this? I understand I can use Ensembl’s web interface but I am working on a project that requires me to pull this data programmatically.
> 
>  Any pointers would be greatly appreciated.
> 
> Many thanks in advance,
> 
> Erik van Renselaar
> 
> _______________________________________________
> Dev mailing list
> Dev at ensembl.org
> http://lists.ensembl.org/mailman/listinfo/dev

--
William Spooner
whs at eaglegenomics.com
http://www.eaglegenomics.com







More information about the Dev mailing list