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