I am looking for a simple algorithm to translate transcript names to gene names. Here are few examples of ways in which transcript seems to be related to the gene name:
Example 1: http://www.wormbase.org/species/c_elegans/transcript/Y74C9A.2.2#042--10 The gene name is Y74C9A.2 but the transcript is Y74C9A.2.2
Example 2: http://www.wormbase.org/species/c_elegans/cds/B0304.1a#04--10 The gene name is B0304.1 and the transcript is B0304.1a
Example 3: http://www.wormbase.org/species/c_elegans/transcript/T07H6.5#042--10 The gene name is T07H6.5 and the transcript name is T07H6.5
If these all the possibilities, then I think I could write a simple script to get the gene name. My problem is I don't have any idea if there are all the possibilities.
1 answer
I haven't done this myself, but if you want to write a script that maps a transcript name to a gene name, you might use the WormBase REST API with curl or wget to ask questions of it.
The idea (untested) is that you build a URL (a web address, essentially) with the transcript name and use curl or wget to make a request (the equivalent of your web browser asking for a web page from a server).
You then parse the response to your request, which either gives you the gene name or gives you enough information to build a subsequent URL, which gets you a response with the gene name you're after.
Log in to answer this question.
You should first read worm gene naming convention. Your first example is probably wrong: Y74C9A.2 looks like the gene name. The it seems that worm genes are named as
/^[A-Z][A-Z0-9]+\.[0-9]+$/. If you can confirm it from official doc, you have the rule.@lh3: I fixed it.