# HG changeset patch # User modencode-dcc # Date 1358792665 18000 # Node ID 0dc638ecc767f29042e13ba1d4e45825b75ddb97 # Parent 9f09ba6a5f2c450001512945e3c1245ddcd6197d Uploaded diff -r 9f09ba6a5f2c -r 0dc638ecc767 split.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/split.sh Mon Jan 21 13:24:25 2013 -0500 @@ -0,0 +1,25 @@ +#!bin/bash + +#purpose: shell script which performs the split option +#author: Ziru Zhou +#date: October, 2012 + +main() +{ + output1="${1}" + output2="${2}" + input="${3}" + + $(samtools view -H ${input} > tmp) + linecount=$(samtools view ${input} | wc -l) + half=$(((${linecount} + 1) / 2)) + samtools view ${input} | shuf | split -d -l ${half} + + $(cat tmp x00 > x00h) + $(cat tmp x01 > x01h) + samtools view -bSo ${output1} x00h + samtools view -bSo ${output2} x01h + + rm tmp x00h x01h x00 x01 +} +main "${@}"