Skip to content

Instantly share code, notes, and snippets.

@andrewyatz
Created March 28, 2011 10:15
Show Gist options
  • Save andrewyatz/890239 to your computer and use it in GitHub Desktop.
Save andrewyatz/890239 to your computer and use it in GitHub Desktop.
Searching for an INSDC accession using the EBI Search for Ensembl Genomes species which have not had their contig level sequences mapped to an INSDC accession
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
use SOAP::Lite;
# Use the import below if you want to see more information from webservices
# otherwise use the one above
# use SOAP::Lite +trace => 'debug';
my $species = 'aedes aegypti';
my $version = 61; #means go for Ensembl Genomes v8
my $verbose = 0; #set to 1 if you want to see what the registry is doing
my $accession = 'CH477234';
#Region is for http://www.mirbase.org/cgi-bin/mirna_entry.pl?acc=MI0013439
my $start = 1579552;
my $end = 1579622;
my $dba = get_dba();
my $slice = get_slice($dba);
my $genomic_dna = $slice->sub_Slice($start, $end)->seq();
warn $genomic_dna;
sub get_dba {
Bio::EnsEMBL::Registry->no_version_check(1);
Bio::EnsEMBL::Registry->load_registry_from_db(
-HOST => 'mysql.ebi.ac.uk', -PORT => 4157,
-USER => 'anonymous', -DB_VERSION => $version, -VERBOSE => $verbose
);
return Bio::EnsEMBL::Registry->get_DBAdaptor($species, 'core');
}
sub get_slice {
my ($dba) = @_;
my $stable_id = get_example_gene_id();
my $gene = $dba->get_GeneAdaptor()->fetch_by_stable_id($stable_id);
my $slice = $gene->slice();
return $slice;
}
sub get_example_gene_id {
my $service_endpint = 'http://www.ebi.ac.uk/ebisearch/service.ebi/';
my $wsdl = $service_endpint.'?wsdl';
my $service_namespace = 'http://www.ebi.ac.uk/EBISearchService';
my $service = SOAP::Lite->proxy($wsdl);
$service->uri($service_namespace);
my $result = $service->getResultsIds(
SOAP::Data->new(name => 'domain', value => 'ensemblGenomes_gene'),
SOAP::Data->new(name => 'query', value => $accession),
SOAP::Data->new(name => 'start', value => 1),
SOAP::Data->new(name => 'size', value => 1)
);
my ($gene_id) = $result->valueof('//arrayOfIds/string');
return $gene_id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment