[ensembl-dev] API Perl Code Example Repository

Javier Herrero jherrero at ebi.ac.uk
Wed Feb 1 15:17:12 GMT 2012


Hi Sumir

Try to change

my $genes->  fetch_all;

to:

my $genes = $gene_adaptor->fetch_all;


After changing that line, the code should work.

Kind regards

Javier

On 01/02/12 15:10, Sumir Panji wrote:
> Hello,
>  I am new to both PERL and using the Ensembl PERL API (version 65). I 
> have been looking around for any example PERL API scripts that I could 
> use to learn as well as adapt for my own use other then what is 
> briefly provided in the API tutorial docs. Is there a central 
> repository that contains sample code that can be used to figure out 
> all the methods and classes for the API? The one example I came across 
> that I liked (taken from slide 11 : 
> http://www.docstoc.com/docs/55683571/Ensembl-Developers-Workshop-Core-API) 
> does not seem to work very well.
>
> #!/usr/bin/perl
>
> use Bio::EnsEMBL::Registry;
>
> my $registry = 'Bio::EnsEMBL::Registry';
>
> use Bio::EnsEMBL::Registry;
> Bio::EnsEMBL::Registry->load_registry_from_db(
>                    -host    => 'ensembldb.ensembl.org',
>                    -user    => 'anonymous'
>                    );
> my $gene_adaptor = $registry->get_adaptor('Human', 'Core', 'Gene');
>
> my $genes-> fetch_all;
>
> while (my $gene = shift @{$genes}){
>         print $gene->stable_id, "\n";
>         }
>
> Error message : Can't call method "fetch_all" on an undefined value at 
> test_gene_ensembldb.pl line 14.
>
>  Thank you,
>  sumir
>
> p.s I have been through all the mailing list archives 2006 - present
>
>
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> List admin (including subscribe/unsubscribe): 
> http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/
>

-- 
Javier Herrero, PhD
Ensembl Coordinator and Ensembl Compara Project Leader
European Bioinformatics Institute (EMBL-EBI)
Wellcome Trust Genome Campus, Hinxton
Cambridge - CB10 1SD - UK





More information about the Dev mailing list