[ensembl-dev] Main gene vs. alternate

Mahmood Naderan mahmood.nt at gmail.com
Sat Nov 18 17:37:37 GMT 2017


Hi,
I use the following code to retrieve all instances of a gene name. Then I
compare each display_id with the gene name that I have and if they match, I
go further to process them.

my @genes = @{ $gene_adaptor->fetch_all_by_external_name('HLA-DRB1') };
while (my $gene = shift @genes) {
  my $big_string = $gene->display_xref->display_id;
  my $pat = "HLA-DRB1";
  my $match_found = $big_string =~ /$pat/i;
  if ($match_found) {
     ..
  }
}

Problem is that I get multiple items and they display_id are equal to what
I have (HLA-DRB1). On the website, the main instance is named and the
others are named "Human Alternative sequence Gene". I don't want to store
them. I just need the main "Human Gene".

What is the correct attribute to distinguish that?


Regards,
Mahmood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20171118/4a58fac7/attachment.html>


More information about the Dev mailing list