annotate collectorcurve/collectorcurve.sh @ 7:13552951d226 draft default tip

Uploaded
author qfab
date Wed, 04 Jun 2014 01:55:29 -0400
parents f4d86766f766
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f4d86766f766 Uploaded
qfab
parents:
diff changeset
1 #!/bin/bash
f4d86766f766 Uploaded
qfab
parents:
diff changeset
2
f4d86766f766 Uploaded
qfab
parents:
diff changeset
3 echo $@
f4d86766f766 Uploaded
qfab
parents:
diff changeset
4
f4d86766f766 Uploaded
qfab
parents:
diff changeset
5 command=''
f4d86766f766 Uploaded
qfab
parents:
diff changeset
6 filetype=$1
f4d86766f766 Uploaded
qfab
parents:
diff changeset
7 input=$2
f4d86766f766 Uploaded
qfab
parents:
diff changeset
8 label=$3
f4d86766f766 Uploaded
qfab
parents:
diff changeset
9 echo label is $label
f4d86766f766 Uploaded
qfab
parents:
diff changeset
10 if [ $label != 'None' ]; then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
11 labelformatted=${label//,/-}
f4d86766f766 Uploaded
qfab
parents:
diff changeset
12 command+=', 'label=$labelformatted
f4d86766f766 Uploaded
qfab
parents:
diff changeset
13 fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
14 output=$4
f4d86766f766 Uploaded
qfab
parents:
diff changeset
15 outputid=$5
f4d86766f766 Uploaded
qfab
parents:
diff changeset
16 outputpath=$6
f4d86766f766 Uploaded
qfab
parents:
diff changeset
17 calc=$7
f4d86766f766 Uploaded
qfab
parents:
diff changeset
18 advanced=$8
f4d86766f766 Uploaded
qfab
parents:
diff changeset
19 if [ $advanced == True ]; then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
20 cabund=$9
f4d86766f766 Uploaded
qfab
parents:
diff changeset
21 abund=${10}
f4d86766f766 Uploaded
qfab
parents:
diff changeset
22 if [ $cabund == True ]; then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
23 command+=', 'abund=$abund
f4d86766f766 Uploaded
qfab
parents:
diff changeset
24 fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
25 csize=${11}
f4d86766f766 Uploaded
qfab
parents:
diff changeset
26 size=${12}
f4d86766f766 Uploaded
qfab
parents:
diff changeset
27 if [ $csize == True ]; then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
28 if [ $size != 0 ]; then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
29 command+=', 'size=$size
f4d86766f766 Uploaded
qfab
parents:
diff changeset
30 fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
31 fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
32 cfreq=${13}
f4d86766f766 Uploaded
qfab
parents:
diff changeset
33 freq=${14}
f4d86766f766 Uploaded
qfab
parents:
diff changeset
34 if [ $cfreq == True ]; then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
35 command+=', 'freq=$freq
f4d86766f766 Uploaded
qfab
parents:
diff changeset
36 echo $command
f4d86766f766 Uploaded
qfab
parents:
diff changeset
37 fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
38 fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
39
f4d86766f766 Uploaded
qfab
parents:
diff changeset
40
f4d86766f766 Uploaded
qfab
parents:
diff changeset
41 echo path: $outputpath id: $outputid
f4d86766f766 Uploaded
qfab
parents:
diff changeset
42 ## get filename only remove the extension
f4d86766f766 Uploaded
qfab
parents:
diff changeset
43 file="${input%.*}"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
44 echo `cp $input $file'.'$filetype`
f4d86766f766 Uploaded
qfab
parents:
diff changeset
45 inputfile=$file'.'$filetype
f4d86766f766 Uploaded
qfab
parents:
diff changeset
46 calculator=${calc//,/-}
f4d86766f766 Uploaded
qfab
parents:
diff changeset
47 IFS=',' read -a sum_calc <<< "$calc"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
48 for element in "${sum_calc[@]}"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
49 do
f4d86766f766 Uploaded
qfab
parents:
diff changeset
50 if [[ "$element" != "nseqs" ]] && [[ "$element" != "coverage" ]] && [[ "$element" != "sobs" ]]
f4d86766f766 Uploaded
qfab
parents:
diff changeset
51 then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
52 sum_calculator+='-'$element
f4d86766f766 Uploaded
qfab
parents:
diff changeset
53 fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
54 done
f4d86766f766 Uploaded
qfab
parents:
diff changeset
55 #echo "collect.single($filetype=$inputfile, calc=$calc)"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
56 ## use Mothur collect.single to calculate collector's curve - alpha diversity
f4d86766f766 Uploaded
qfab
parents:
diff changeset
57 #mothur "#summary.single($filetype=$inputfile, calc=$calculator$command)"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
58 mothur "#summary.single($filetype=$inputfile, calc=nseqs-coverage-sobs$sum_calculator$command)"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
59 mothur "#collect.single($filetype=$inputfile, calc=$calculator$command)"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
60 IFS=, read -a calcs <<< "${calc}"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
61 count=0
f4d86766f766 Uploaded
qfab
parents:
diff changeset
62 ##copy summary as main output
f4d86766f766 Uploaded
qfab
parents:
diff changeset
63 echo `cp $file'.summary' $output`
f4d86766f766 Uploaded
qfab
parents:
diff changeset
64 #copy calc files into directory
f4d86766f766 Uploaded
qfab
parents:
diff changeset
65 for i in "${calcs[@]}"
f4d86766f766 Uploaded
qfab
parents:
diff changeset
66 do
f4d86766f766 Uploaded
qfab
parents:
diff changeset
67 #if [ $count == 0 ]; then
f4d86766f766 Uploaded
qfab
parents:
diff changeset
68 # echo `cp $file'.'$i $output`
f4d86766f766 Uploaded
qfab
parents:
diff changeset
69 #else
f4d86766f766 Uploaded
qfab
parents:
diff changeset
70 echo `cp $file'.'$i $outputpath'/primary_'$outputid'_'$i'_visible_tabular'`
f4d86766f766 Uploaded
qfab
parents:
diff changeset
71 #fi
f4d86766f766 Uploaded
qfab
parents:
diff changeset
72 let count+=1
f4d86766f766 Uploaded
qfab
parents:
diff changeset
73 done