<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Dear Ensembl team,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">   I'd like some help with this. I am interested in using <a href="https://grch37.rest.ensembl.org/documentation/info/variant_recoder_post" style="font-family:Arial,Helvetica,sans-serif">https://grch37.rest.ensembl.org/documentation/info/variant_recoder_post</a> in obtaining VCF coordinates for a number of variants ( Input being HGVS coordinates)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I used the Python 3 sample code provided to check what the resulting output looks like (pasted further below)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">In similar fashion to how the GET request works ... I expected something like this</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">[{'vcf_string':' ... ', 'input':'NM_..'}</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">{'warning':' ... ', 'input':'NM_..'}]<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">i.e. each list item would correspond to one input value .. and each dictionary would be populated with the resultant 'vcf_string' .. or 'warning' .. if the HGVS input is malformed.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">However, the output does not appear to be consistent. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Example 1:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">For input values, "NM_000070.2:c.?", "NM_000070.2:c.328C>T", there appears to be only one list item</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">{'vcf_string': ['15-42676699-C-A', '15-42676699-C-T'], 'warnings': ["No variant found with ID 'NM_000070.2:c.?'"], 'input': 'NM_000070.2:c.328C>T'}<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">This erroneously (I think) mixes the warning from the first input value and the translated vcf coordinates from the second input value</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Example 2:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Some HGVS coordinates that are valid and are properly converted via the GET request, are not handled here:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">e.g. "No variant found with ID 'NM_000070.2:c.545T>A'"</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><b>Code</b></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style=""><font face="monospace">import requests, sys<br></font></div><div class="gmail_default" style=""><font face="monospace"><br></font></div><div class="gmail_default" style=""><font face="monospace">server = "<a href="https://grch37.rest.ensembl.org">https://grch37.rest.ensembl.org</a>"<br>ext = "/variant_recoder/homo_sapiens"<br>headers={ "Content-Type" : "application/json", "Accept" : "application/json"}<br>params={"fields":"vcf_string"}<br>hgvs_ids='{"ids": ["NM_000070.2:c.?", "NM_000070.2:c.328C>T", "NM_000070.2:c.545T>A", "NM_000070.2:c.701G>A", "NM_000070.2:c.1838del", "NM_000070.2:c.945+1del", "NM_000070.2:c.1061T>G", "NM_000070.2:c.1079G>A", "NM_000070.2:c.1342C>G", "NM_000070.2:c.1468C>T", "NM_000070.2:c.550delA?", "NM_000070.2:c.550del", "NM_000070.2:c.1715G>A", "NM_000070.2:c.2069_2070del", "NM_000070.2:c.2306G>A", "NM_000070.2:c.2314_2317del", "NM_000070.2:c.2362_2363delinsTCATCT", "NM_000070.2:c.946-1G>A", "NM_000070.2:c.1466G>A", "NM_000070.2:c.2230A>G", "NM_000070.2:c.19_23del", "NM_000070.2:c.257C>T", "NM_000070.2:c.402del", "NM_000070.2:c.1913A>C", "NM_000070.2:c.1622G>A", "NM_000070.2:c.598_612del", "NM_000070.2:c.801+1G>A", "NM_000070.2:c.664G>A", "NM_000070.2:c.2243G>A", "NM_000070.2:c.717del"]}'<br><br>r = requests.post(server+ext, headers=headers, data=hgvs_ids, params=params)<br> <br>if not r.ok:<br>  r.raise_for_status()<br></font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style=""><font face="monospace">decoded = r.json()<br>print(repr(decoded))<b style=""><br></b></font></div><div class="gmail_default" style=""><font face="monospace"><br></font></div><div class="gmail_default" style=""><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><b>Results</b></div><div class="gmail_default"></div></div><div class="gmail_default" style=""><br></div><div class="gmail_default" style=""><pre style="box-sizing:border-box;overflow:auto;padding:1px 0px;margin-top:0px;margin-bottom:0px;line-height:inherit;color:rgb(0,0,0);word-break:break-all;border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline"><pre style="box-sizing:border-box;overflow:auto;padding:1px 0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-break:break-all;border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline">[{'vcf_string': ['15-42676699-C-A', '15-42676699-C-T'], 'warnings': ["No variant found with ID 'NM_000070.2:c.?'"], 'input': 'NM_000070.2:c.328C>T'}, {'input': 'NM_000070.2:c.701G>A', 'warnings': ["No variant found with ID 'NM_000070.2:c.545T>A'"], 'vcf_string': ['15-42681194-G-A']}, {'vcf_string': ['15-42700445-AA-A'], 'input': 'NM_000070.2:c.1838del'}, {'input': 'NM_000070.2:c.1061T>G', 'warnings': ["No variant found with ID 'NM_000070.2:c.945+1del'"], 'vcf_string': ['15-42686485-T-G']}, {'vcf_string': ['15-42686503-G-A'], 'input': 'NM_000070.2:c.1079G>A'}, {'vcf_string': ['15-42691838-C-G', '15-42691838-C-T'], 'input': 'NM_000070.2:c.1342C>G'}, {'input': 'NM_000070.2:c.1468C>T', 'vcf_string': ['15-42693952-C-T']}, {'input': 'NM_000070.2:c.550del', 'vcf_string': ['15-42680001-AA-A'], 'warnings': ["No variant found with ID 'NM_000070.2:c.550delA?'"]}, {'input': 'NM_000070.2:c.1715G>A', 'vcf_string': ['15-42695170-G-A', '15-42695170-G-C', '15-42695170-G-T']}, {'vcf_string': ['15-42703124-G-A', '15-42703124-G-C'], 'warnings': ["No variant found with ID 'NM_000070.2:c.2069_2070del'"], 'input': 'NM_000070.2:c.2306G>A'}, {'input': 'NM_000070.2:c.2314_2317del', 'vcf_string': ['15-42703130-CAGAC-C']}, {'vcf_string': ['15-42703179-TAG-TTCATCT'], 'input': 'NM_000070.2:c.2362_2363delinsTCATCT'}, {'warnings': ["No variant found with ID 'NM_000070.2:c.946-1G>A'"], 'vcf_string': ['15-42693950-G-A'], 'input': 'NM_000070.2:c.1466G>A'}, {'input': 'NM_000070.2:c.2230A>G', 'vcf_string': ['15-42702831-A-G']}, {'warnings': ["No variant found with ID 'NM_000070.2:c.19_23del'"], 'vcf_string': ['15-42652260-C-T'], 'input': 'NM_000070.2:c.257C>T'}, {'vcf_string': ['15-42678386-CC-C'], 'input': 'NM_000070.2:c.402del'}, {'vcf_string': ['15-42695077-G-A'], 'warnings': ["No variant found with ID 'NM_000070.2:c.1913A>C'"], 'input': 'NM_000070.2:c.1622G>A'}, {'vcf_string': ['15-42680049-GTTCTGGAGTGCTCTG-G'], 'input': 'NM_000070.2:c.598_612del'}, {'vcf_string': ['15-42681157-G-A'], 'warnings': ["No variant found with ID 'NM_000070.2:c.801+1G>A'"], 'input': 'NM_000070.2:c.664G>A'}, {'input': 'NM_000070.2:c.2243G>A', 'vcf_string': ['15-42702844-G-A']}, {'vcf_string': ['15-42681205-TT-T', '15-42681205-TT-TTT'], 'input': 'NM_000070.2:c.717del'}]</pre><pre style="box-sizing:border-box;overflow:auto;padding:1px 0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-break:break-all;border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline"><font face="arial, sans-serif"><br></font></pre><pre style="box-sizing:border-box;overflow:auto;padding:1px 0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-break:break-all;border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline"><font face="arial, sans-serif">Thanks,</font></pre><pre style="box-sizing:border-box;overflow:auto;padding:1px 0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-break:break-all;border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline"><font face="arial, sans-serif">Josh</font></pre></pre></div></div>