comparison split.sh @ 3:e623e9c7bb23 draft

Uploaded
author ziru-zhou
date Tue, 18 Dec 2012 09:20:12 -0500
parents
children
comparison
equal deleted inserted replaced
2:5f4cb6ee3427 3:e623e9c7bb23
1 #!bin/bash
2
3 #purpose: shell script which performs the split option
4 #author: Ziru Zhou
5 #date: October, 2012
6
7 main()
8 {
9 output1="${1}"
10 output2="${2}"
11 input="${3}"
12
13 $(samtools view -H ${input} > tmp)
14 linecount=$(samtools view ${input} | wc -l)
15 half=$(((${linecount} + 1) / 2))
16 samtools view ${input} | shuf | split -d -l ${half}
17
18 $(cat tmp x00 > x00h)
19 $(cat tmp x01 > x01h)
20 samtools view -bSo ${output1} x00h
21 samtools view -bSo ${output2} x01h
22
23 rm tmp x00h x01h x00 x01
24 }
25 main "${@}"