<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Joshua,<br>
    <br>
    Exons and other features tend to be stored on toplevel sequences,
    which are generally chromosomes.<br>
    Dna sequence however is stored on the contig level.<br>
    The assembly table contains information to map a contig sequence to
    a chromosome.<br>
    <br>
    Retrieving dna sequence directly from the mysql schema is tricky in
    the best of case.<br>
    This is why we recommend using Biomart, the perl API
    (<a class="moz-txt-link-freetext" href="http://www.ensembl.org/info/docs/api/index.html">http://www.ensembl.org/info/docs/api/index.html</a>) or REST queries
    (<a class="moz-txt-link-freetext" href="http://rest.ensembl.org">http://rest.ensembl.org</a>) for this type of use.<br>
    <br>
    <br>
    Regards,<br>
    Magali<br>
    <br>
    <div class="moz-cite-prefix">On 24/09/2014 22:53, Joshua Bradley
      wrote:<br>
    </div>
    <blockquote
      cite="mid:20140924215403.7BFDA134476_4233D7BB@hx-mx2.ebi.ac.uk"
      type="cite">
      <div dir="ltr">
        <div>
          <div style="font-family:arial,sans-serif;font-size:13px">I am
            using the the latest release of the human genome,
            homo_sapiens_core_76_38.</div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">I am
            trying to map exons to their corresponding dna sequence. I'm
            running a local instance of the sql tables to make things
            faster. My approach was to take the seq_region_id in the
            exon table and use that to find the sequence in the dna
            table. . The <a moz-do-not-send="true"
              href="http://www.ensembl.org/info/docs/api/core/core_schema.html"
              target="_blank">schema</a> online seems to suggest that I
            can use the seq_region_id to do this but I am not getting
            any results back from my sql queries.</div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">I've
            verified what the schema says, that the seq_region table has
            a 1-1 mapping to the dna table by comparing counts between
            the two with the following queries.</div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">SELECT
            COUNT(*) FROM seq_region INNER JOIN dna ON
            seq_region.seq_region_id=dna.seq_region_id;<br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <span style="font-family:arial,sans-serif;font-size:13px">SELECT
            COUNT(*) FROM dna;</span>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">This
            was to be expected, however when I try to do a join between
            the exon table and dna table, I get a count of 0</div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">SELECT
            COUNT(*) FROM exon INNER JOIN dna ON
            exon.seq_region_id=dna.seq_region_id;<br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">which
            tells me the seq_region_id is not a 1-1 mapping. I am able
            to use <a moz-do-not-send="true"
href="http://www.ensembl.org/biomart/martview/96b01e4e2043c838fc28f0969c5914a6?VIRTUALSCHEMANAME=default&ATTRIBUTES=hsapiens_gene_ensembl.default.sequences.ensembl_gene_id%7Chsapiens_gene_ensembl.default.sequences.ensembl_transcript_id%7Chsapiens_gene_ensembl.default.sequences.gene_exon%7Chsapiens_gene_ensembl.default.sequences.ensembl_exon_id&FILTERS=hsapiens_gene_ensembl.default.filters.source.%22ensembl%22&VISIBLEPANEL=resultspanel"
              target="_blank">biomart</a> (this is a sample query) to
            get the exon-to-sequence mapping but I would like a more
            automated approach. Can someone explain how biomart is able
            to do it? It's possible I am interpreting the schema wrong.
            How does seq_region_id in the exon table get mapped to
            seq_region_id in the dna table? I appreciate any help.</div>
        </div>
        <div><br>
        </div>
        <br clear="all">
        <div>Josh Bradley<br>
          Graduate Student<br>
          University of Maryland - College Park<br>
        </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>