sort the homo sapiens genes by chromosome with Unix command lines
0
0
Entering edit mode
6.5 years ago
Huichen03 ▴ 40

Hi,

I want to sort homo sapiens gene by chromosome. I tried with sort -t _ -k 3 -g genes.txt > genes_by_chr.txt, while the result is not what I want. In my genes.txt file, the chromosome column includes numbers like 1, 2, 3 ... and characters like CHR_HG1_PATCH, CHR_HG26_PATCH, and GL000009.2. What is the easiest way to sort my genes by chromosome, if I only use Unix commands?

Thank you in advance!

gene sort • 1.5k views
ADD COMMENT
1
Entering edit mode

How about sort -kz,z genes.txt > genes_by_chr.txt, where z is the column of interest. In case you have positional information for your genes, you may add -kx,xn, where x is the column of the genomic coordinate and "n" indicates to sort numerically.

ADD REPLY
1
Entering edit mode

Paste add some example data, in additon to data description. Data description is good, but it is more helpful if you can post some example data.

try sort -V -k1 if chromsomes are in first column.

ADD REPLY

Login before adding your answer.

Traffic: 2613 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