[ensembl-dev] all orthologs for species pair

Hardip Patel Hardip.Patel at anu.edu.au
Thu Oct 24 00:12:44 BST 2013


Dear All

I would like to extract all orthologs for any given two species. I am using following code to extract required information.

my $genome_db_adaptor = $reg->get_adaptor("Multi", "compara", "GenomeDB");
my $homology_adaptor  = $reg->get_adaptor('Multi', 'compara', 'Homology');
my $ref_genome_dbID = $genome_db_adaptor->fetch_by_registry_name($ref_species)->dbID();

foreach my $subject_species (keys %species){
  my $subject_genome_dbID = $genome_db_adaptor->fetch_by_registry_name($subject_species)->dbID;
  print "Getting homologs for $ref_species (dbID=$ref_genome_dbID) and $subject_species (dbID=$subject_genome_dbID)\n";
  my @homologues = @{$homology_adaptor->fetch_all_by_genome_pair($ref_genome_dbID,$subject_genome_dbID)};
  foreach my $homology (@homologues){
    my @gene_members = @{$homology->gene_list()};
    printf "%s\t%s\t%s\n", $gene_members[0]->stable_id(), $gene_members[1]->stable_id(), $homology->description;
  }
}

I am getting following results:

ENSG00000199168 ENSTBEG00000017892 ortholog_one2many
ENSG00000212161 ENSTBEG00000020962 apparent_ortholog_one2one
ENSG00000252139 ENSTBEG00000020505 ortholog_one2many
ENSG00000252139 ENSTBEG00000020751 ortholog_one2many
ENSG00000252139 ENSTBEG00000021130 ortholog_one2many
ENSG00000207639 ENSTBEG00000017976 ortholog_one2one
ENSG00000252691 ENSTBEG00000021086 ortholog_one2one

However this is extremely slow. I am guessing that once homologues are extracted for the pair (fast step), extraction of gene centric information one by one makes it slow in the following line of the code.

foreach my $homology (@homologues){}

Could you please let me know if there is an alternate way to get the same information but quicker? I am mainly interested in

ref_species_geneID, chromosome, start, end, strand, genename, subject_speciesgeneID, chromosome, start, end, strand, homologytype

When I query for the same using biomart, it is very quick and I am hoping that I can do the same using API.

Kind regards

Hardip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20131023/90bfe428/attachment.html>


More information about the Dev mailing list