annotate smalt_map.sh @ 0:77cc50d982c0 draft default tip

planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
author nml
date Tue, 19 Sep 2017 16:40:17 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
1 #/bin/bash
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
2
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
3
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
4 smi=$1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
5 shift
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
6 sma=$1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
7 shift
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
8 #get format type so we can do extra work if it is a bam file
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
9 format=$1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
10 shift
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
11
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
12 #get working directory so we can find the output files
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
13 CUR_DIR=`pwd`
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
14
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
15
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
16 cp "$smi" "$CUR_DIR/temp.smi"
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
17 cp "$sma" "$CUR_DIR/temp.sma"
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
18
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
19 #determine if we have 1 or 2
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
20 num_inputs=$1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
21 shift
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
22
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
23 inputs=()
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
24
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
25 #determine how many fasta/fastq were given. Needs to be provided by user
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
26 if [ $num_inputs -eq 1 ]; then
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
27 inputs+=$1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
28 shift
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
29 elif [ $num_inputs -eq 2 ]; then
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
30 inputs+=$1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
31 shift
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
32 inputs+=' '
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
33 inputs+=$1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
34 shift
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
35 else
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
36 exit 1
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
37 fi
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
38
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
39 smaltout=$2
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
40
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
41 smalt map $@ 'temp' $inputs
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
42
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
43
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
44 if [ "$format" == "bam" ]; then
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
45 if [ $GALAXY_SLOTS ]
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
46 then
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
47 samtools sort -@ $GALAXY_SLOTS $smaltout 'temp2'
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
48 else
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
49 samtools sort $smaltout 'temp2'
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
50 fi
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
51 mv 'temp2.bam' $smaltout
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
52 fi
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
53
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
54 #remove index files
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
55 rm "$CUR_DIR/temp.smi"
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
56 rm "$CUR_DIR/temp.sma"
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
57
77cc50d982c0 planemo upload for repository https://sourceforge.net/projects/smalt/ commit 008f4667b70be22e9ddf496738b3f74bb942ed28
nml
parents:
diff changeset
58 exit 0