Mercurial > repos > rmarenco > multi_fasta_glimmer_hmm
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0ddb5ee32ff6 |
---|---|
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} |