Answers.Body: <ol>
  <li><code>HFE|LOC108783645</code> is <a href="https://www.ncbi.nlm.nih.gov/gene/108783645" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/gene/108783645</a>. You can use biomaRt to go from the <code>LOCxxxx</code> ID to location. Searching by <code>HFE</code> will give you a different location though, so you might have to account for such eventualities. It is a long and often manually intensive process.</li>
  <li>You should be able to use entrez-direct/eutils to go from rsID to position</li>
  <li>Unless there's some sort of natural language processing API, <code>codon 109 of exon 3 of beta globin gene</code> cannot be parsed by existing APIs (Unless it's always <code>codon X of exon Y of Z</code>, in which case you could use <code>grep</code> too get the components. Even so, going from exon + codon + codon base change to exact base location will require a lot of wrangling.</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-18T23:58:47.787Z
Answers.LastActivityDate: 2020-05-18T23:58:47.787Z
Answers.UserDisplayName: Ram RS
Body: <p>I am looking for a given mutation in <a href="https://us.v-cdn.net/5019796/uploads/FileUpload/c4/d9900bc2df5ef6ed48c9709bb16de9.png" rel="nofollow noreferrer">IGV</a>, which accepts coordinates in the form of</p>
  
  <pre><code>chr&lt;X&gt;:&lt;Y&gt;
  </code></pre>
  
  <p>Where X is the chromosome number and Y is the base location in that chromosome.</p>
  
  <p>Eg. <code>chr6:26091179</code> which has the following attributes:</p>
  
  <pre><code>Gene: HFE|LOC108783645
  Marker: rs1799945
  Position: chr6:26091179
  </code></pre>
  
  <p>Additionally, an interval can be written like</p>
  
  <pre><code>chr&lt;X&gt;:&lt;Y&gt;-&lt;Z&gt;
  </code></pre>
  
  <p>So basically from base located at Y to Z.</p>
  
  <p><strong>My questions are:</strong></p>
  
  <p><strong>1)</strong> How do I convert <code>HFE|LOC108783645</code> to <code>chr6:26091179</code> (and vice-versa)?</p>
  
  <p><strong>2)</strong> How do I convert <code>rs1799945</code> to <code>chr6:26091179</code> (and vice-versa)?</p>
  
  <p><strong>3)</strong> On a different example, how do I convert something like <code>codon 109 of exon 3 of beta globin gene (GTG-&gt;TTG)</code> to <code>chr&lt;X&gt;:&lt;Y&gt;</code> (or <code>chr&lt;X&gt;:&lt;Y&gt;-&lt;Z&gt;</code>)?</p>
  
  <p>Why are there so many ways to specify positions in genes? For me the most clear way is <code>chr&lt;X&gt;:&lt;Y&gt;</code>, all the others leave me guessing...</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-18T23:53:54.103Z
Comments.Text: You should look at HGVS conventions used to refer to positions with respect to reference sequences. Remember, not even `chr:pos` notations are independent of reference sequence versions. `chr6:26091179` in GRCh38 is not the same in GRCh37.
Comments.UserDisplayName: Ram RS
Tags: <gene><genome><phylogenetics><igv>
Title: How can I convert codon coordinates to genomic position?
ThreadText: # How can I convert codon coordinates to genomic position?
  
  (Asked by: username_0 on 2020-05-18)
  
  I am looking for a given mutation in [IGV](https://us.v-cdn.net/5019796/uploads/FileUpload/c4/d9900bc2df5ef6ed48c9709bb16de9.png), which accepts coordinates in the form of
  
  ```
  chr<X>:<Y>
  
  ```
  
  Where X is the chromosome number and Y is the base location in that chromosome.
  
  Eg. `chr6:26091179` which has the following attributes:
  
  ```
  Gene: HFE|LOC108783645
  Marker: rs1799945
  Position: chr6:26091179
  
  ```
  
  Additionally, an interval can be written like
  
  ```
  chr<X>:<Y>-<Z>
  
  ```
  
  So basically from base located at Y to Z.
  
  **My questions are:**
  
  **1)** How do I convert `HFE|LOC108783645` to `chr6:26091179` (and vice-versa)?
  
  **2)** How do I convert `rs1799945` to `chr6:26091179` (and vice-versa)?
  
  **3)** On a different example, how do I convert something like `codon 109 of exon 3 of beta globin gene (GTG->TTG)` to `chr<X>:<Y>` (or `chr<X>:<Y>-<Z>`)?
  
  Why are there so many ways to specify positions in genes? For me the most clear way is `chr<X>:<Y>`, all the others leave me guessing...
  
  **Tags:** gene, genome, phylogenetics, igv
  
  > **Comments:**
  > **username_1**: You should look at HGVS conventions used to refer to positions with respect to reference sequences. Remember, not even `chr:pos` notations are independent of reference sequence versions. `chr6:26091179` in GRCh38 is not the same in GRCh37.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-18. Score: 1 | Accepted answer
  
  1. `HFE|LOC108783645` is <https://www.ncbi.nlm.nih.gov/gene/108783645>. You can use biomaRt to go from the `LOCxxxx` ID to location. Searching by `HFE` will give you a different location though, so you might have to account for such eventualities. It is a long and often manually intensive process.
  2. You should be able to use entrez-direct/eutils to go from rsID to position
  3. Unless there's some sort of natural language processing API, `codon 109 of exon 3 of beta globin gene` cannot be parsed by existing APIs (Unless it's always `codon X of exon Y of Z`, in which case you could use `grep` too get the components. Even so, going from exon + codon + codon base change to exact base location will require a lot of wrangling.
  
  
  ---
  
  