<div>Hi,</div><div>I've used the code below on multiple occasions to convert external gene names to chromosome coords and it worked fine.</div><div>However when I tried it just now I get the error for the very first gene DNAI2 and the script crashes:</div>


<div><br></div><div>Can't call method "seq_region_name" on unblessed reference</div><div><br></div><div>When I tried fetch_by_display_label($id) - I get:</div><div><br></div><div>Can't call method "seq_region_name" on an undefined value</div>


<div><br></div><div>Have I missed something?</div><div>Thanks for any help,</div><div>Sean.</div><div><br></div><div>p.s. I tried connecting to the <a href="http://useastdb.ensembl.org/" target="_blank">useastdb.ensembl.org,</a> as I'm in the states, but It gave the following (maybe the 2 issues are related):</div>


<div><br></div><div>DBI connect('host=<a href="http://useastdb.ensembl.org/" target="_blank">useastdb.ensembl.org</a>;port=3306','anonymous',...) failed: Can't connect to MySQL server on '<a href="http://useastdb.ensembl.org/" target="_blank">useastdb.ensembl.org</a>' (111) at /home/sean/tools/ensembl_53/modules/Bio/EnsEMBL/Registry.pm line 1329</div>


<div>Can't call method "selectall_arrayref" on an undefined value at /home/sean/tools/ensembl_53/modules/Bio/EnsEMBL/Registry.pm line 1332.</div><div><br></div><div>==============</div><div><br></div><div>#!/usr/bin/perl</div>


<div><br></div><div>use strict;</div><div>use lib '/home/sean/tools/ensembl_53/modules';</div><div><br></div><div>use Bio::SeqIO;</div><div>use Bio::Root::IO;</div><div>use Bio::EnsEMBL::DBSQL::BaseAdaptor;</div>

<div>
use Bio::EnsEMBL::Registry;</div><div> </div><div>my $registry = 'Bio::EnsEMBL::Registry';</div><div>#$registry->load_registry_from_db(-host => '<a href="http://useastdb.ensembl.org/" target="_blank">useastdb.ensembl.org</a>',-user => 'anonymous');</div>


<div>$registry->load_registry_from_db(-host => '<a href="http://ensembldb.ensembl.org/" target="_blank">ensembldb.ensembl.org</a>',-user => 'anonymous');</div><div> </div><div>open OUT, ">$gene_file.coords";</div>


<div>for my $geneid ( @unique ) {</div><div>    chomp $geneid;</div><div>    ($chr,$start, $end) = ensembl_coords($geneid); </div><div>    print OUT join("\t", $chr,$start,$end,$geneid),"\n";</div><div>


}</div><div>  </div><div>sub ensembl_coords {</div><div>  my ($id) = @_;</div><div> </div><div>  my $adaptor = $registry->get_adaptor( 'Human', 'Core', 'gene' );</div><div> </div><div>  my $gene = $adaptor->fetch_all_by_external_name($id);</div>


<div>  # my $gene = $adaptor->fetch_by_display_label($id);</div><div><br></div><div>  $chr = $gene->seq_region_name();</div><div>  $start = $gene->seq_region_start();</div><div>  $end = $gene->seq_region_end();</div>


<div>  return ($chr,$start,$end);</div><div><br></div><div>}</div>