Skip to content

Commit b302b21

Browse files
committed
initial import of new script
1 parent ebd7908 commit b302b21

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

16.top_pop_figure

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
source globals
4+
5+
DAT=$0.tab
6+
IN=13.figures.otus_percent.tab
7+
8+
OTUS="OTU_115 OTU_4 OTU_3 OTU_1 OTU_239 OTU_5 OTU_2"
9+
10+
head -1 $IN | awk '{ printf("OTUid\t%s\n", $0); }' > $DAT
11+
12+
for otu in $OTUS
13+
do
14+
echo $otu
15+
awk -F'\t' -v otu="$otu" '{ if ($1 == otu) { print $0; exit } }' $IN >> $DAT
16+
done
17+
18+
\rm -rf $0.15uM.tab $0.45uM.tab $0.75uM.tab $0.150uM.tab $0.225uM.tab
19+
awk -F'\t' -f $0.awk $DAT
20+
21+
gnuplot $0.gplt

16.top_pop_figure.awk

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// {
2+
++line;
3+
for (i = 1; i <= NF; ++i) {
4+
data[line, i] = $i;
5+
}
6+
nf = NF;
7+
}
8+
END {
9+
for (i = 1; i <= nf; ++i) {
10+
split(data[1, i], a, "_");
11+
if (a[2] == "5A" || a[2] == "5B" || a[2] == "5C")
12+
of = "16.top_pop_figure.15uM.tab";
13+
else if (a[2] == "15A" || a[2] == "15B" || a[2] == "15C")
14+
of = "16.top_pop_figure.45uM.tab";
15+
else if (a[2] == "25A" || a[2] == "25B" || a[2] == "25C")
16+
of = "16.top_pop_figure.75uM.tab";
17+
else if (a[2] == "50A" || a[2] == "50B" || a[2] == "50C")
18+
of = "16.top_pop_figure.150uM.tab";
19+
else if (a[2] == "75A" || a[2] == "75B" || a[2] == "75C")
20+
of = "16.top_pop_figure.225uM.tab";
21+
else {
22+
files[1] = "16.top_pop_figure.15uM.tab";
23+
files[2] = "16.top_pop_figure.45uM.tab";
24+
files[3] = "16.top_pop_figure.75uM.tab";
25+
files[4] = "16.top_pop_figure.150uM.tab";
26+
files[5] = "16.top_pop_figure.225uM.tab";
27+
for (f in files) {
28+
of = files[f]
29+
for (j = 1; j <= line; ++j) {
30+
printf("%s\t", data[j, i]) >> of;
31+
}
32+
printf("\n") >> of;
33+
}
34+
continue;
35+
}
36+
for (j = 1; j <= line; ++j) {
37+
printf("%s\t", data[j, i]) >> of;
38+
}
39+
printf("\n") >> of;
40+
}
41+
}

16.top_pop_figure.gplt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
set terminal pdf color solid enhanced
2+
set output '16.top_pop_figure.pdf'
3+
#set datatfile separator "\t"
4+
set border 3 front linetype -1 linewidth 1.000
5+
set boxwidth 0.8 absolute
6+
set style fill solid 1.00 noborder
7+
set grid nopolar
8+
set grid noxtics nomxtics ytics nomytics noztics nomztics \
9+
nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
10+
set grid layerdefault linetype 0 linewidth 1.000, linetype 0 linewidth 1.000
11+
set key bmargin center horizontal Left reverse noenhanced autotitles columnhead nobox
12+
#unset key
13+
set style histogram rowstacked title offset character 2, 0.25, 0
14+
set datafile missing '-'
15+
set style data histograms
16+
#set xtics border in scale 0,0 nomirror rotate by -45 offset character 0, 0, 0 autojustify
17+
set xtics border in scale 0,0 nomirror rotate by -90 offset character 0, 0, 0 autojustify
18+
set xtics norangelimit font ",8"
19+
set xtics ()
20+
set ytics border in scale 0,0 mirror norotate offset character 0, 0, 0 autojustify
21+
set ztics border in scale 0,0 nomirror norotate offset character 0, 0, 0 autojustify
22+
set cbtics border in scale 0,0 mirror norotate offset character 0, 0, 0 autojustify
23+
set rtics axis in scale 0,0 nomirror norotate offset character 0, 0, 0 autojustify
24+
set xlabel "[O_2] in enrichment"
25+
set xlabel offset character 0, -2, 0 font "" textcolor lt -1 norotate
26+
set ylabel "Fraction of population"
27+
set yrange [ 0 : 100 ] noreverse nowriteback
28+
29+
# setup color blind palette
30+
#set palette model RGB defined (0 "#88CCEE", 1 "#44AA99", 1 "#117733", 2 "#999933", 2 "#DDCC77", 3 "#CC6677", 4 "#882255", 5 "#AA4499", 6 "grey")
31+
set linetype 1 lc rgb "#88CCEE" lw 1
32+
set linetype 2 lc rgb "#44AA99" lw 1
33+
set linetype 3 lc rgb "#117733" lw 1
34+
set linetype 4 lc rgb "#999933" lw 1
35+
set linetype 5 lc rgb "#DDCC77" lw 1
36+
set linetype 6 lc rgb "#CC6677" lw 1
37+
set linetype 7 lc rgb "#882255" lw 1
38+
set linetype 8 lc rgb "#AA4499" lw 1
39+
set linetype 9 lc rgb "gray80" lw 1
40+
set linetype cycle 9
41+
42+
#unset colorbox
43+
#unset key
44+
45+
plot \
46+
newhistogram "15 {/Symbol m}M" lt 2, '15uM.tab' using 2:xtic(1) t col, '' u 3:xtic(1) t col, 4:xtic(1) t col, 5:xtic(1) t col, 6:xtic(1) t col, 7:xtic(1) t col, 8:xtic(1) t col, \
47+
newhistogram "45 {/Symbol m}M" lt 2, '45uM.tab' using 2:xtic(1) t col, '' u 3:xtic(1) t col, 4:xtic(1) t col, 5:xtic(1) t col, 6:xtic(1) t col, 7:xtic(1) t col, 8:xtic(1) t col, \
48+
newhistogram "75 {/Symbol m}M" lt 2, '75uM.tab' using 2:xtic(1) t col, '' u 3:xtic(1) t col, 4:xtic(1) t col, 5:xtic(1) t col, 6:xtic(1) t col, 7:xtic(1) t col, 8:xtic(1) t col, \
49+
newhistogram "150 {/Symbol m}M" lt 2, '150uM.tab' using 2:xtic(1) t col, '' u 3:xtic(1) t col, 4:xtic(1) t col, 5:xtic(1) t col, 6:xtic(1) t col, 7:xtic(1) t col, 8:xtic(1) t col, \
50+
newhistogram "225 {/Symbol m}M" lt 2, '225uM.tab' using 2:xtic(1) t col, '' u 3:xtic(1) t col, 4:xtic(1) t col, 5:xtic(1) t col, 6:xtic(1) t col, 7:xtic(1) t col, 8:xtic(1) t col

0 commit comments

Comments
 (0)