[ensembl-dev] Losing connection to MySQL for large queries
Will McLaren
wm2 at ebi.ac.uk
Tue Oct 4 10:04:32 BST 2011
Hi Chris,
Try adding the following line to your code before you create the slice adaptor:
$registry->set_reconnect_when_lost();
Cheers
Will
On 4 October 2011 09:20, Chris Raistrick <chris.raistrick at bristol.ac.uk> wrote:
> Dear all,
>
> Getting an error when trying to retrieve a complete list of variant
> IDs via the ensembl variation database:
>
> [example std out]
> name = 'rs79594517', source = 'dbSNP', chr = '3'
> name = 'rs78223957', source = 'dbSNP', chr = '3'
> name = 'rs112696692', source = 'dbSNP', chr = '3'
> name = 'rs9761692', source = 'dbSNP', chr = '3'
> Chromosome 4
> Connected to the Ensembl Registry
> Slice adaptor generated
> DBD::mysql::st execute failed: Lost connection to MySQL server during
> query at .../ensembl/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm line
> 287.
> DBD::mysql::st execute failed: Lost connection to MySQL server during
> query at .../ensembl/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm line
> 287.
>
> Each time I start a new chromosome using this code:
>
> print "Chromosome $chr\n";
>
> # connect to Ensembl registry
> my $registry = 'Bio::EnsEMBL::Registry';
> $registry->load_registry_from_db(
> -host => 'ensembldb.ensembl.org',
> -user => 'anonymous'
> );
>
> # get slice for chromosome
> my $slice_adaptor = $registry->get_adaptor('homo_sapiens', 'core', 'slice');
> my $slice = $slice_adaptor->fetch_by_region('chromosome',$chr);
>
> # get variations by slice
> my $vf_adaptor = $registry->get_adaptor('homo_sapiens', 'variation',
> 'variationfeature');
> my $vfs = $vf_adaptor->fetch_all_by_Slice($slice);
>
> foreach my $vf (@{$vfs}){
> my $var_id = $vf->variation_name;
> ..
>
> I read the last few messages I could find related on here and they
> said this fix would be in by release 64 (I downloaded the modules last
> week, so assume I'm on 64).
>
> Please help, I've never had this problem using the Ensembl API (in 4 years).
>
> Chris
>
> _______________________________________________
> 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/
>
More information about the Dev
mailing list