I have genetic variant data with several columns, currently my variants/lines are in the wrong order and need to be sorted by chromosome. I've tried a few ways to do this using answers from similar questions but none work, mostly giving me empty files.
currently my chromosome order is:
1
10
11
12
13
14
15
16
17
18
19
2
20
21
22
3
4
5
6
7
8
9
these lines need to be sorted in order ascending from 1 to 22.
I've tried:
sort -k 1,1 -k2,2n file.avinput > test.avinput
sortBed -i file.avinput > test.avinput
sort -k1,1V -k2,2g file.avinput > test.avinput
bedtools sort -g file.bed> test.avinput #gives *ERROR: Need -i BED file.
These run but when I try head test.avinput it gives me nothing, or when I check with awk '{print $1}' test.avinput | sort -u the order is still wrong - what else can I try to change this?
An example of how a couple lines looks is this:
File.avinput: #3 columns are chromosome, start and end - I have no header
1 10 11
10 200 201
2 20 21
22 2000 2001
Expected ordered output
1 10 11
2 20 21
10 200 201
22 2000 2001
Currently trying any form of using sort -n gives me an empty file.
-nnumeric flag to sort them numerically versus lexically.-nbut having the same trouble