Question: Using Ensembl API to get a Gene ID from a protein ID
0
gravatar for Joseph Hughes
4.1 years ago by
Joseph Hughes2.7k
Scotland, UK
Joseph Hughes2.7k wrote:

I am using a Homology adaptor:

  my $homology_adaptor = Bio::EnsEMBL::Registry->get_adaptor('Multi', 'compara', 'Homology');
  my $homologies = $homology_adaptor->fetch_all_by_Member($gene_member);

 

which in when I loop through:

foreach my $homology (@{$homologies}) {

   my $member=${$homology->get_all_Members}[1];​

Does not always return a member description:

   $member->description​

But does return an protein ID. I am wondering what is the best way to get the gene id from the protein id using the Ensembl API.

 

 

api ensembl • 2.0k views
ADD COMMENTlink modified 4.1 years ago • written 4.1 years ago by Joseph Hughes2.7k

I was trying to do something similar, convert GeneID to Gene Symbol. I was doing this for a large amount of genes and found it to be quite slow using the api. I had much more success downloading a TSV file from the UCSC Genome Browser, provided what your looking for is in there.

If you select the selected fields from primary and related tables option in the output format, you should be able to get the information you want in a text file, which you can either read into memory or store in mysql or something.

Hope this helps!

-Kyle

ADD REPLYlink written 4.1 years ago by mbio.kyle330
1
gravatar for Emily_Ensembl
4.1 years ago by
Emily_Ensembl18k
EMBL-EBI
Emily_Ensembl18k wrote:

You could use the protein ID to get a translation object, then use $translation->transcript->gene->stable_id to get the gene stable ID.

ADD COMMENTlink written 4.1 years ago by Emily_Ensembl18k

Hi Emily, that would actually be good if I could get it to work. I am running API version 81 and get the following error:

Can't locate object method "gene" via package "Bio::EnsEMBL::Transcript"

 

 

 

ADD REPLYlink modified 4.1 years ago • written 4.1 years ago by Joseph Hughes2.7k
1

Sorry, it's Get_gene, not gene. This is what happens when I write stuff from memory rather than check it.

ADD REPLYlink written 4.1 years ago by Emily_Ensembl18k

For the translation adaptor, is there a way I can specify the genome. In the examples I have seen it is usually the common name, e.g.:

my $translation_adaptor = $reg->get_adaptor('human','Core','Translation');

But it would be easier if I could use the genome name (e.g. homo_sapiens). Or is there an easy way to get from common name to species name?

 

ADD REPLYlink written 4.1 years ago by Joseph Hughes2.7k

Either work.

ADD REPLYlink written 4.1 years ago by Emily_Ensembl18k

 

Hi Emily,

I'm still getting:

Can't locate object method "Get_gene" via package "Bio::EnsEMBL::Transcript"

ADD REPLYlink written 4.1 years ago by Joseph Hughes2.7k

The capitalisation is wrong. It should be get_Gene.

Works a treat now.

Thanks

 

ADD REPLYlink written 4.1 years ago by Joseph Hughes2.7k
1
gravatar for Joseph Hughes
4.1 years ago by
Joseph Hughes2.7k
Scotland, UK
Joseph Hughes2.7k wrote:

Following Emily's suggestion I used the following to get the gene id:

my @members = @{$homology->get_all_Members()};
foreach my $this_member (@members) {
   my $translation_adaptor = $reg->get_adaptor($this_member->genome_db->name,'Core','Translation');
   my $translation = $translation_adaptor->fetch_by_stable_id($this_member->stable_id);
   print $translation->transcript->get_Gene->stable_id,"\n";

}

 

ADD COMMENTlink modified 4.1 years ago • written 4.1 years ago by Joseph Hughes2.7k
0
gravatar for Kamil
4.1 years ago by
Kamil1.9k
Boston
Kamil1.9k wrote:

I'm not sure if I understand your question, but I would skip BioPerl and use Ensembl BioMart.

(Also see the BioMaRt Bioconductor package to perform queries programmatically with R.)

Ensembl Gene ID
Ensembl Protein ID
ENSG00000198888 ENSP00000354687
ENSG00000198763 ENSP00000355046

 

ADD COMMENTlink written 4.1 years ago by Kamil1.9k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1360 users visited in the last hour