Mercurial > repos > saskia-hiltemann > file_manipulation
comparison sort_chromosomal_position.sh @ 0:e77c9484b2d0 draft default tip
Uploaded
author | saskia-hiltemann |
---|---|
date | Thu, 22 Oct 2015 09:18:30 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e77c9484b2d0 |
---|---|
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 |