annotate split.sh @ 9:b26743e971de draft

Deleted selected files
author modencode-dcc
date Fri, 18 Jan 2013 15:25:14 -0500
parents 1cea5a75f998
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
1 #!bin/bash
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
2
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
3 #purpose: shell script which performs the split option
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
4 #author: Ziru Zhou
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
5 #date: October, 2012
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
6
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
7 main()
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
8 {
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
9 output1="${1}"
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
10 output2="${2}"
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
11 input="${3}"
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
12
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
13 $(samtools view -H ${input} > tmp)
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
14 linecount=$(samtools view ${input} | wc -l)
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
15 half=$(((${linecount} + 1) / 2))
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
16 samtools view ${input} | shuf | split -d -l ${half}
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
17
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
18 $(cat tmp x00 > x00h)
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
19 $(cat tmp x01 > x01h)
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
20 samtools view -bSo ${output1} x00h
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
21 samtools view -bSo ${output2} x01h
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
22
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
23 rm tmp x00h x01h x00 x01
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
24 }
1cea5a75f998 Uploaded
modencode-dcc
parents:
diff changeset
25 main "${@}"