[ensembl-dev] Converting cDNA position to genomic position!

Oyediran Akinrinade oyediran.akinrinade at helsinki.fi
Thu Nov 22 14:07:41 GMT 2012


Hello,

Thanks for the help/info!

I tried using the REST API but it keeps stopping without completing.  
Here is my script for the query:

#!/usr/bin/python

import httplib2, sys
http = httplib2.Http(".cache")

map=[]
f=open("EXTRACTED_FILE.txt","a") ## file open in appending mode i.e 'a'

file=open('card_complete.txt', 'rU')
lines=file.readlines()
for line in lines:
     transcript, start = line.split('\t')
     start=int(start)
     end=start+1
     m=(transcript,start)
     map.append(m)
     server = "http://beta.rest.ensembl.org"
#ext = "/map/cdna/ENST00000379802/5513..5514?"
#ext = "/map/cdna/transcript/start..end?"
     ext="/map/cdna/"+transcript+"/"+str(start)+".."+str(end)+"?"
     resp, content = http.request(server+ext, method="GET",  
headers={"Content-Type":"application/json"})
     if not resp.status == 200:
         print "Invalid response: ", resp.status
         sys.exit()
     import json
     decoded = json.loads(content)
     print "fetching", m, "now"
     #f=open("EXTRACTED_FILE.txt","a") ## file open in appending mode i.e 'a'
     f.write(repr(decoded)) ## writing the contain decoded  to file
     #print repr(decoded)
     #print decoded
f.close()
print "completed"

And it only works for few:

fetching ('ENST00000070846', 76) now
fetching ('ENST00000070846', 84) now
fetching ('ENST00000070846', 156) now
fetching ('ENST00000070846', 176) now
fetching ('ENST00000070846', 184) now
fetching ('ENST00000070846', 193) now
fetching ('ENST00000070846', 227) now
fetching ('ENST00000070846', 235) now
fetching ('ENST00000070846', 258) now
fetching ('ENST00000070846', 259) now
fetching ('ENST00000070846', 275) now
fetching ('ENST00000070846', 302) now
Invalid response:  429

# if not resp.status == 200:
         print "Invalid response: ", resp.status
         sys.exit()

Do you have an idea of what could be wrong here?



Quoting "Andy Yates" <ayates at ebi.ac.uk>:

> Hi,
>
> You can also use the REST API which can map from protein, cds and  
> cDNA to genomic locations:
>
> http://beta.rest.ensembl.org/map/cdna/ENST00000373968/123..554?content-type=application/json
>
> Brings back
>
> {"mappings":[{"seq_region_name":"10","gap":0,"coord_system":"chromosome","strand":-1,"rank":0,"end":54531338,"start":54531209},{"seq_region_name":"10","gap":0,"coord_system":"chromosome","strand":-1,"rank":0,"end":54530546,"start":54530430},{"seq_region_name":"10","gap":0,"coord_system":"chromosome","strand":-1,"rank":0,"end":54529075,"start":54529007},{"seq_region_name":"10","gap":0,"coord_system":"chromosome","strand":-1,"rank":0,"end":54528270,"start":54528155}]}
>
> The REST API is rate limited to 3 mappings per second so using the  
> Perl API will give you a higher throughput
>
> Andy
>
> Andrew Yates                   Ensembl Core Software Project Leader
> EMBL-EBI                       Tel: +44-(0)1223-492538
> Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
> Cambridge CB10 1SD, UK         http://www.ensembl.org/
>
> On 15 Nov 2012, at 10:59, Will McLaren wrote:
>
>> Hello Oyediran,
>>
>> You will need to use a TranscriptMapper object;  
>> http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1TranscriptMapper.html
>>
>> The method you should use is cdna2genomic. Note that this returns  
>> an array of coordinate objects; this is useful to know if, for  
>> example, your coordinates only partially overlap the transcript.
>>
>> Here's a bit of code to get you started:
>>
>> my $reg = 'Bio::EnsEMBL::Registry';
>> $reg->load_registry_from_db(-host => 'ensembldb.ensembl.org',-user  
>> => 'anonymous');
>>
>> my $ta = $reg->get_adaptor('human','core','transcript');
>>
>> my $t = $ta->fetch_by_stable_id('ENST00000373968');
>>
>> my $mapper = Bio::EnsEMBL::TranscriptMapper->new($t);
>>
>> @coords = $trmapper->cdna2genomic( 123, 554 );
>>
>> Regards
>>
>> Will McLaren
>> Ensembl Variation
>>
>>
>> On 15 November 2012 10:45, Oyediran Akinrinade  
>> <oyediran.akinrinade at helsinki.fi> wrote:
>>
>>
>> Hello,
>>
>> I have a list of ensembl transcripts IDs with their corresponding cDNA
>> positions and I will like to get their genomic positions using the
>> ensembl API. I have no experience with perl although I have
>> installed ensembl-api on my mac computer. There are about 6000 IDs
>> that I will like to get their genomic cordinates/positions, and
>> web-based queries will not be the best solution. To this end, I
>> write to request for your assistance.
>>
>> Looking forward to hearing from you soonest.
>>
>> Thanks,
>>
>> -Oyediran
>>
>>
>>
>>
>>
>> _______________________________________________
>> Dev mailing list    Dev at ensembl.org
>> Posting guidelines and subscribe/unsubscribe info:  
>> http://lists.ensembl.org/mailman/listinfo/dev
>> Ensembl Blog: http://www.ensembl.info/
>>
>> _______________________________________________
>> Dev mailing list    Dev at ensembl.org
>> Posting guidelines and subscribe/unsubscribe info:  
>> http://lists.ensembl.org/mailman/listinfo/dev
>> Ensembl Blog: http://www.ensembl.info/
>
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> Posting guidelines and subscribe/unsubscribe info:  
> http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/
>






More information about the Dev mailing list