[ensembl-dev] Use of uninitialized value in print at HZ254_genedata.pl line .

mag mr6 at ebi.ac.uk
Mon Feb 10 09:10:47 GMT 2014


Hi Pengfei,

I am not entirely sure which data you are looking at, but depending on 
the databases, not all genes will have a description or an external_name.

For a given gene, we assign a display xref if we find an external 
reference from a trusted source matching the ensembl gene.
That xref (external reference) is then used to assign a display name to 
the gene.
If there is no such external reference, the gene will have no display 
name and we will use the ensembl stable id instead.

A similar rule applies to assigning descriptions.


Hope that helps,
Magali

On 10/02/2014 05:22, 刘鹏飞 wrote:
> Hi Magali and
> Hi all,
>
> I use following code to fetch all information of genes for a bacteria, 
> but get some errors (althouth I could get all data I wanted), but I 
> could not figure out where goes wrong, thanks:
> errors:
> Use of uninitialized value in print at HZ254_genedata.pl line 20.
>
> scripts:
> # methanocella_conradii_hz254
> #HZ254_genedata.pl
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Bio::EnsEMBL::LookUp;
> # load the lookup from the main Ensembl Bacteria public server
> my $lookup = Bio::EnsEMBL::LookUp->new(
>   -URL => "http://bacteria.ensembl.org/registry.json",
>   -NO_CACHE => 1
> );
> # find the correct database adaptor using a unique name
> my ($dba) = @{$lookup->get_by_name_exact(
>   'methanocella_conradii_hz254'
> )};
> my $genes = $dba->get_GeneAdaptor()->fetch_all();
> # get all gene infomation
> open (MYFILE, '>>HZ254gene_data.txt');
> foreach my $gene (@$genes){
> print $gene->stable_id,"\t",
> $gene->display_id,"\t",
> $gene->description,"\t",
> $gene->start, " - ",
> $gene->end, "\t",
> $gene->external_name, "\t",
> $gene->length,"\n";
> };
> close (MYFILE);
> ##API version 74
>
>
> -- 
> Pengfei Liu, PhD Candidate
>
> Lab of Microbial Ecology
> College of Resources and Environmental Sciences
> China Agricultural University
> No.2 Yuanmingyuanxilu, Beijing, 100193
> P.R. China
>
> Tel: +86-10-62731358
> Fax: +86-10-62731016
>
> E-mail: liupfskygre at gmail.com <mailto:liupfskygre at gmail.com>
> If you are afraid of tomorrow, how can you enjoy today!
> Keep hungry, Keep foolish!
> Moving forward!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20140210/26d1b3d3/attachment.html>


More information about the Dev mailing list