-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path13.figures
More file actions
executable file
·34 lines (24 loc) · 773 Bytes
/
13.figures
File metadata and controls
executable file
·34 lines (24 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
source globals
SQL=$0.read_sums.sql
XLS=$0.read_sums.xls
per_otus_xls=12.persistent_otus.xls
seq_table=final_otus_sequences
otu_table=final_otus
class_table=final_otus_classifications
blast_table=final_otus_vs_RDP
cat << EOF > $SQL
SELECT ot.OTUId
EOF
awk -F'\t' -v otu_table="$otu_table" '{ if (line >= 1) { printf("\t\t, SUM(%s) AS \"%s.%s\"\n", $1, $2, $3); } ++line; }' $SAMPLE_INFO_SUBSET >> $SQL
cat << EOF >> $SQL
FROM $otu_table AS ot
EOF
mysql -h $HOST $DB --local-infile < $SQL > $XLS
sed -i 's/\\t/\t/g' $XLS
samples=`awk '{ if (line > 0) print "O2_" $2; ++line }' $SAMPLE_INFO_SUBSET | sort | uniq`
for sample in $samples
do
awk -f $0.reshape.awk -v expt="$sample" $per_otus_xls > $0.persistent_otus.reshaped.tab
done
R --no-save < $0.R