comparison multi_glimmer.sh @ 0:b07a805758cc draft

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