/
5_PolyRelatednes.sh
75 lines (58 loc) · 2.31 KB
/
5_PolyRelatednes.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
## Companion script for the manuscript:
## "Estimation of Molecular Pairwise Relatedness in Autopolyploid Crops"
## by Rodrigo Amadeu, Leticia Lara, Patricio Munoz, Antonio Garcia
## Sep-2020
## This script:
## Computes the relationship matrix considering the multiallelic methods (LO, RI, WE, MM, ML) for all the files from 3 using PolyRelatedness V1.8
#Clonning data structure for the output
cp -r multiallelicdata PolyRelatedness_output_LO
cp -r multiallelicdata PolyRelatedness_output_RI
cp -r multiallelicdata PolyRelatedness_output_WE
cp -r multiallelicdata PolyRelatedness_output_MM
cp -r multiallelicdata PolyRelatedness_output_ML
#Listing files to loop
find multiallelicdata -name \*.txt -print > PolyRelatednessInput.txt
find PolyRelatedness_output_LO -name \*.txt -print > PolyRelatednessOutput_LO.txt
find PolyRelatedness_output_RI -name \*.txt -print > PolyRelatednessOutput_RI.txt
find PolyRelatedness_output_WE -name \*.txt -print > PolyRelatednessOutput_WE.txt
find PolyRelatedness_output_MM -name \*.txt -print > PolyRelatednessOutput_MM.txt
find PolyRelatedness_output_ML -name \*.txt -print > PolyRelatednessOutput_ML.txt
#Saving file names in a array
readarray -t in < PolyRelatednessInput.txt
readarray -t out_LO < PolyRelatednessOutput_LO.txt
readarray -t out_RI < PolyRelatednessOutput_RI.txt
readarray -t out_WE < PolyRelatednessOutput_WE.txt
readarray -t out_MM < PolyRelatednessOutput_MM.txt
readarray -t out_ML < PolyRelatednessOutput_ML.txt
#Doing the loop
len=${#in[@]}
echo $len
for (( i=0; i<$len; i++ ))
do
rm ${out_LO[$i]}
rm ${out_RI[$i]}
rm ${out_WE[$i]}
rm ${out_MM[$i]}
rm ${out_ML[$i]}
done
time for (( i=0; i<$len; i++ ))
do
echo ${in[$i]}
echo ${out_LO[$i]}
./PolyRelatedness_1.8/PolyRelatedness.out ${in[$i]} ${out_LO[$i]} e 6
echo ${out_RI[$i]}
./PolyRelatedness_1.8/PolyRelatedness.out ${in[$i]} ${out_RI[$i]} e 4
echo ${out_WE[$i]}
./PolyRelatedness_1.8/PolyRelatedness.out ${in[$i]} ${out_WE[$i]} e 7
echo ${out_MM[$i]}
./PolyRelatedness_1.8/PolyRelatedness.out ${in[$i]} ${out_MM[$i]} e 1
echo ${out_ML[$i]}
./PolyRelatedness_1.8/PolyRelatedness.out ${in[$i]} ${out_ML[$i]} e 2
done
rm PolyRelatednessInput.txt
rm PolyRelatednessOutput_LO.txt
rm PolyRelatednessOutput_RI.txt
rm PolyRelatednessOutput_WE.txt
rm PolyRelatednessOutput_MM.txt
rm PolyRelatednessOutput_ML.txt