<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Mahmood,<br>
    <br>
    To access all genes in a species, you can use directly the
    GeneAdaptor.<br>
    This will allow you to loop through all the genes without having to
    retrieve the chromosomes first.<br>
    <br>
    Additionally, there is a method called fetch_all_by_external_name<br>
<a class="moz-txt-link-freetext" href="http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1DBSQL_1_1GeneAdaptor.html#a940d6dc7e9273ad373a23eb563a455e6">http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1DBSQL_1_1GeneAdaptor.html#a940d6dc7e9273ad373a23eb563a455e6</a><br>
    which allows you to retrieve all Gene objects for a gene symbol.<br>
    <br>
    An example script would look like:<br>
    $registry->load_registry_from_db(<br>
      -host => 'ensembldb.ensembl.org',<br>
      -user => 'anonymous',<br>
      -port => 3337<br>
    );<br>
    my $gene_adaptor = $registry->get_adaptor('human', 'core',
    'Gene');<br>
    my @genes = @{ $gene_adaptor->fetch_all() };<br>
    my @brca_genes = @{
    $gene_adaptor->fetch_all_by_external_name('BRCA2') };<br>
    while (my $brca_gene = shift @brca_genes) {<br>
      print ">" . $brca_gene->stable_id . " " .
    $brca_gene->display_xref->display_id . "\n";<br>
      print $brca_gene->seq . "\n";<br>
    }<br>
    <br>
    I would recommend looking through our API course to get more
    familiar with it.<br>
    We have slides from our in-person workshops<br>
    <a class="moz-txt-link-freetext" href="https://github.com/Ensembl/ensembl-presentation/tree/master/API/Core">https://github.com/Ensembl/ensembl-presentation/tree/master/API/Core</a><br>
    a tutorial<br>
    <a class="moz-txt-link-freetext" href="http://www.ensembl.org/info/docs/api/core/core_tutorial.html">http://www.ensembl.org/info/docs/api/core/core_tutorial.html</a><br>
    and videos<br>
<a class="moz-txt-link-freetext" href="http://www.ebi.ac.uk/training/online/course/ensembl-filmed-api-workshop">http://www.ebi.ac.uk/training/online/course/ensembl-filmed-api-workshop</a><br>
    <br>
    <br>
    Hope that helps,<br>
    Magali<br>
    <br>
    <div class="moz-cite-prefix">On 28/06/2017 19:36, Mahmood Naderan
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADa2P2Wk2uhTtgmaOrS2vywtLcfU3195MUkiSaaTHM50c2+GmA@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_default" style="font-family:tahoma,sans-serif">Hi,<br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">Is
          exonerate the only tool to get the stable_id by the gene name?
          I was wondering if an ensemble perl api does this job. <br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">Also,
          I didn't see an api to access the database by the gene name.
          It seems that I have to get the chromosome first and then
          iterate over all genes in it.<br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br
            clear="all">
        </div>
        <div>
          <div class="gmail_signature" data-smartmail="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>