Mercurial > repos > yating-l > multi_fasta_glimmer_hmm
annotate multi_glimmer.sh @ 9:81383b1c05d9 draft default tip
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 59eb9b27c7382ae4736eb7425615e4b575757378
author | yating-l |
---|---|
date | Thu, 04 May 2017 17:30:27 -0400 |
parents | 36f4ba558f9f |
children |
rev | line source |
---|---|
0
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
1 #!/bin/sh |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
2 set -e |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
3 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
4 reference_fasta=$1 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
5 trained_dir=$2 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
6 output=$3 |
36f4ba558f9f
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" |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
8 |
36f4ba558f9f
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 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
10 glimmerHMM_first () { |
36f4ba558f9f
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 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
12 } |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
13 |
36f4ba558f9f
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 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
15 glimmerHMM_without_comments () { |
36f4ba558f9f
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} |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
17 } |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
18 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
19 count=1 |
36f4ba558f9f
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 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
21 while read line |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
22 do |
36f4ba558f9f
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 |
36f4ba558f9f
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 |
36f4ba558f9f
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) |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
26 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
27 if [ ${first_char} = '>' ] |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
28 then |
36f4ba558f9f
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 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
30 if [ -f ${temp} ] |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
31 then |
36f4ba558f9f
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 ] |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
33 then |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
34 glimmerHMM_first ${temp}; |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
35 count=$((count+1)) |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
36 else |
36f4ba558f9f
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}; |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
38 fi |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
39 fi |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
40 echo ${line} > ${temp} |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
41 else |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
42 echo ${line} >> ${temp} |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
43 fi |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
44 done < "${reference_fasta}" |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
45 |
36f4ba558f9f
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 |
36f4ba558f9f
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}; |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
48 |
36f4ba558f9f
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 |
36f4ba558f9f
planemo upload for repository https://github.com/remimarenco/multi_fasta_glimmerhmm.git commit 1245031a7d52c922c86f33ebfd0f20eb9ddf84ac-dirty
yating-l
parents:
diff
changeset
|
50 rm ${temp} |