Mercurial > repos > modencode-dcc > bamedit
comparison split.sh @ 3:1cea5a75f998 draft
Uploaded
author | modencode-dcc |
---|---|
date | Fri, 18 Jan 2013 10:53:35 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:1ced8ed78013 | 3:1cea5a75f998 |
---|---|
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 "${@}" |