Mercurial > repos > modencode-dcc > bamedit
comparison split.sh @ 3:0dc638ecc767 draft
Uploaded
| author | modencode-dcc |
|---|---|
| date | Mon, 21 Jan 2013 13:24:25 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 2:9f09ba6a5f2c | 3:0dc638ecc767 |
|---|---|
| 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 "${@}" |
