<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Mahmood,<br>
<br>
What you call the main instance of a gene is a gene located on a
chromosome or scaffold. These can be identified with the following
API call:<br>
$gene->slice->is_reference<br>
<br>
The "Human alternative sequence Gene" are genes located on alternate
sequences, either patch fixes or haplotypes.<br>
In some cases, there is a sequencing error on the reference
chromosome and the gene on the alternate sequence is a better
choice.<br>
You can select these with the following API call:<br>
<br>
my $aag_adaptor =
Bio::EnsEMBL::Registry->get_DBAdaptor("Human","core","AltAlleleGroup");<br>
my $aag = $aag_adaptor->fetch_Group_by_dbID($gene->dbID);<br>
my $reference_gene = $aag->get_representative_Gene;<br>
<br>
If you are looking at retrieving only one version of a gene name and
are looking for the most representative, I would recommend the
second solution rather than arbitrarily selecting the one on the
reference chromosome.<br>
<br>
<br>
I hope this helps,<br>
Magali<br>
<br>
<div class="moz-cite-prefix">On 18/11/2017 17:37, Mahmood Naderan
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CADa2P2X41CLJMRBdmX0mVwwN5DOSpZbrqXb3r+0bzP1Q4ASBZA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-family:tahoma,sans-serif">Hi,</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">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.</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">my
@genes = @{
$gene_adaptor->fetch_all_by_external_name('HLA-DRB1') };<br>
while (my $gene = shift @genes) {<br>
my $big_string = $gene->display_xref->display_id;<br>
my $pat = "HLA-DRB1";<br>
my $match_found = $big_string =~ /$pat/i;<br>
if ($match_found) {<br>
..</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">
}</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">}</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">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".</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">What
is the correct attribute to distinguish that?</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br
clear="all">
</div>
<div>
<div class="gmail_signature">
<div dir="ltr"><font face="tahoma,sans-serif">Regards,<br>
Mahmood</font><br>
<br>
<br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Dev mailing list <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a>
Posting guidelines and subscribe/unsubscribe info: <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
</pre>
</blockquote>
<br>
</body>
</html>