Extract gene coordinates UCSC Table Browser
0
0
Entering edit mode
16 months ago
Marco Pannone ▴ 810

Hello!

I have a list of genes and I want to extract their genomic coordinates. I do so in UCSC Table Browser, but in the output .txt file I obtain the genes have been mixed up in their order.

For downstream plotting reasons, I want to get the genes in the output file in the same exact order as I provided in the input list, but I cannot find a way to do so.

Any help would be very appreciated.

Thanks!

ucsc table browser • 853 views
ADD COMMENT
1
Entering edit mode
ADD REPLY
0
Entering edit mode

I was aware of solutions like those ones (even much easier to do it in R as well). I was just wondering if there was a way to do so already in the Table Browser, without needing to do it myself afterwards. But thanks anyway for the answer!

ADD REPLY
0
Entering edit mode

Are you using the web interface or MySQL queries? The web interface may be returning the answers in random order. There is no option to keep the queries in the same order in GUI that I see. MariaDB (MySql) queries may give you more control.

ADD REPLY
0
Entering edit mode

Yes just using the web interface. I could notice I get the output in random order. I wished there was an option to keep the same order as the input, but I will fix it myself in R.

ADD REPLY
0
Entering edit mode

I am having a hard time finding a solution to the problem since the output file has many more rows than the input list (since one gene can produce multiple transcripts with slightly different starting and ending coordinates). Do you know how I can fix that? Thanks again!

ADD REPLY
1
Entering edit mode

Solution here will sort rows that contain multiple keys: https://unix.stackexchange.com/questions/274625/sorting-one-file-line-by-line-based-on-another-file

Be sure to change the last line to something like mv -f "$TMP_FILE" "some_other_file_name" to prevent overwriting original file.

Original file:

$ more data
cat animal
dog animal
apple fruit
cow animal
cat animal2
dog animal3

$ more key
cat
dog
apple
cow

will be sorted to

cat animal
cat animal2
dog animal
dog animal3
apple fruit
cow animal

Can't help with a R solution. Perhaps someone else will.

ADD REPLY

Login before adding your answer.

Traffic: 1942 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6