annotate multi_glimmer.sh @ 2:ae0b24f726c3 draft default tip

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