This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Getting The Number Of Chromosome From Gene Id For A Lot Of Genes

Hello,

I have a vcf file that instead of the number of the chromosomes, I have the gene IDs, such as this:

ENSGALG00000000011|ENSGALT00000000012|57|1123|1125
ENSGALG00000000011|ENSGALT00000000012|57|1123|1125 ENSGALG00000000011|ENSGALT00000000012|57|1123|1125

I want to know to which chromsome each of these gene IDs belong and extract all the genes that belong to the Z or W chromosome. Indeed, one way is to search for each gene ID in Ensemble but there are more than 7000 genes. I was wondering whether there is any automatic way of doing this.

Thank you very much in advance, Cheers, Sandra

The answer to most "map ID X to ID Y" questions is BioMart; see answer from lelle and numerous other answers at this site.

2 answers

You can use the Ensembl Biomart Instance to do this

You can extract all the gene IDs by using awk

awk -F "|" '{for(i=1;i<=NF;++i){print $i}}' input

You can get all the gene id this way (Assuming your input contain only what you've shown here) Then you can use those for biomart and quickly get the conversion as lelle stated

Thank you very much for your response. It was successful.

I have encountered another problem and that is when I give, for example 20 gene id, it gives me back the result for 13 and it claims that the gene id for the other 7 no longer exists in the ensemble database.

How can I overcome this problem? The assembly that was used to get the gene ID from was from the version 3 of chicken assembly. I know that I can use liftover to convert the coordinates between different assemblies but I do not understand what this means when an ID no longer exists in the database.

Thank you very much for your suggestions.

Some gene IDs do get retired, for various reasons. What you can do is the archive version of BioMart. Scroll down to the bottom of any page in Ensembl and you'll see "View in archive site". Click on this to select the version of Ensembl you want to use. If you know the date when the VCF file was produced, that will allow you to select the appropriate archive.

Log in to answer this question.