-
Notifications
You must be signed in to change notification settings - Fork 0
/
format_and_plot_STRUCTURE_results.sh
57 lines (35 loc) · 2.03 KB
/
format_and_plot_STRUCTURE_results.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# zip structure results for CLUMPAK and StructureHarvester
for species in Epinecrophylla_pyrrhonota_and_haematonota Epinecrophylla_pyrrhonota_1-5 Epinecrophylla_leucophthalma Epinecrophylla_gutturalis Epinecrophylla_ornata Epinecrophylla_pyrrhonota ; do
cd /Volumes/Backup_Plus/Epinecrophylla/1_analysis/Structure/structure_all_snps/${species}/
for K in {1..5}; do
zip K${K}.zip *snps_K${K}_*
done;
#for CLUMPAK
zip ${species}_byK.zip K*.zip
# for StructureHarvester
zip ${species}.zip *_f
done
# format output of CLUMPAK and StructureHarvester (after downloading results)
for species in Epinecrophylla_pyrrhonota_and_haematonota Epinecrophylla_pyrrhonota_1-4 Epinecrophylla_pyrrhonota_1-5 Epinecrophylla_gutturalis Epinecrophylla_leucophthalma Epinecrophylla_ornata Epinecrophylla_pyrrhonota ; do
for K in {1..5}; do
cp /Volumes/Backup_Plus/Epinecrophylla/1_analysis/Structure/structure_all_snps/${species}/CLUMPAK/K\=${K}/CLUMPP.files/ClumppIndFile.output /Volumes/Backup_Plus/Epinecrophylla/1_analysis/Structure/distruct_plots/${species}/ClumppIndFile.output.${K}
done;
cd /Volumes/Backup_Plus/Epinecrophylla/1_analysis/Structure/distruct_plots/${species}/
sed 's/.*://;s/ //' ClumppIndFile.output.1 > ClumppIndFile.output.1.meanQ
for K in {2..5}; do
sed 's/.*://;s/ //;s/ //' ClumppIndFile.output.${K} > ClumppIndFile.output.${K}.meanQ
done;
done
# Plot distruct plots
for species in Epinecrophylla_pyrrhonota Epinecrophylla_pyrrhonota_and_haematonota Epinecrophylla_pyrrhonota_1-4 Epinecrophylla_pyrrhonota_1-5 Epinecrophylla_leucophthalma Epinecrophylla_gutturalis Epinecrophylla_ornata ; do
cd /Volumes/Backup_Plus/Epinecrophylla/1_analysis/Structure/distruct_plots/${species}/
for K in {1..10}; do
python /Users/mharvey/src/distruct2.3/distruct23/distruct2.3.py -K ${K} \
--input=ClumppIndFile.output \
--output=${species}_K${K}_by_individual.pdf \
--title="${species} K=${K}" \
--popfile=${species}_popfile_by_individual \
--poporder=${species}_poporder_by_individual
done;
done