0
|
1 #!/bin/bash
|
|
2
|
|
3 #sort_chromosomal_position.sh $infile $chrcol $startcol $endcol $num_headerlines
|
|
4
|
|
5
|
|
6 cp $1 inputfile.tsv
|
|
7 chrcol=$2
|
|
8 startcol=$3
|
|
9 endcol=$4
|
|
10 num_headerlines=$5
|
|
11 outfile=$6
|
|
12
|
|
13 #remember header
|
|
14 head -$num_headerlines inputfile.tsv > header.tsv
|
|
15
|
|
16 #remove header
|
|
17 sed -i "1,$num_headerlines d" inputfile.tsv
|
|
18
|
|
19 #sort file
|
|
20 sort -k ${chrcol},${chrcol}V -k${startcol},${startcol}n inputfile.tsv > tmpout.txt
|
|
21
|
|
22 cat header.tsv tmpout.txt > $outfile
|
|
23
|
|
24
|
|
25
|
|
26
|