annotate multi_glimmer.sh @ 0:0ddb5ee32ff6 draft default tip

planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
author rmarenco
date Thu, 18 Aug 2016 18:50:00 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
1 #!/bin/sh
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
2 set -e
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
3
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
4 reference_fasta=$1
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
5 trained_dir=$2
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
6 output=$3
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
7 temp="temp_contig_file"
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
8
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
9 # Write the glimmerhmm, with the comments
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
10 glimmerHMM_first () {
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
11 glimmerhmm $1 ${trained_dir} -o ${output} -g
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
12 }
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
13
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
14 # Write the glimmerhmm output without the comments
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
15 glimmerHMM_without_comments () {
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
16 glimmerhmm $1 ${trained_dir} -g | tail -n +2 >> ${output}
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
17 }
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
18
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
19 count=1
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
20 # Loop through the contigs to run glimmer on each
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
21 while read line
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
22 do
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
23 # Get the content of actual contig
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
24 #samtools_faidx_show_contig ${reference_fasta} ${contig} > contig_content
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
25 first_char=$(echo ${line} | cut -c1-1)
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
26
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
27 if [ ${first_char} = '>' ]
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
28 then
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
29 # If true, it means we have finished reading at least the first contig
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
30 if [ -f ${temp} ]
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
31 then
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
32 if [ ${count} -eq 1 ]
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
33 then
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
34 glimmerHMM_first ${temp};
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
35 count=$((count+1))
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
36 else
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
37 glimmerHMM_without_comments ${temp};
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
38 fi
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
39 fi
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
40 echo ${line} > ${temp}
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
41 else
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
42 echo ${line} >> ${temp}
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
43 fi
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
44 done < "${reference_fasta}"
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
45
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
46 # Still last contig to process
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
47 glimmerHMM_without_comments ${temp};
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
48
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
49 # Delete the temp_contig_file
0ddb5ee32ff6 planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 28bd73b26b50165eded1d9ba995979acdf005ad1-dirty
rmarenco
parents:
diff changeset
50 rm ${temp}