-
Notifications
You must be signed in to change notification settings - Fork 2
/
evaluateFoundersFromInferV3.bash
executable file
·94 lines (86 loc) · 4.38 KB
/
evaluateFoundersFromInferV3.bash
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
##
# Arg one is a directory (the gold standard dir) in which there are
# lists of "1w" fasta files named nnnnnnn.list where nnnnnnn is a
# patient number. It expects a directories within that directory to
# be called hiv_founder_id_processed_nnnnnnn unless a fifth argument
# is provided, in which case it will expect directories to be called
# hiv_founder_id_nnnnnnn. Arg two is the analogous dir for the
# estimates (where unless a fifth arg is given, there should be list
# files called processed_nnnnn.list; otherwise just nnnnn.list), arg
# three is the writable dir to put outputs, and the fourth argument is
# ptid nnnnnnn. The fifth argument if present toggles the expected
# dir name and list file name (as just described in the previous
# sentences).
#
# D'OPTE 12/15
# Modified 2/16
##
export mainDir=$1
export estimateDir=$2
export outputDir=$3
export patient=$4
if [ -z $5 ]; then
export inputDir=${estimateDir}/hiv_founder_id_processed_${patient}
else
export inputDir=${estimateDir}/hiv_founder_id_${patient}
fi
export truthDir=${mainDir}/true_founders/${patient}
#rm -rf ${outputDir}
mkdir ${outputDir}
export truthListFile=${mainDir}/processed_${patient}.list
export inputDir=${estimateDir}/founder-inference-bakeoff_${patient}
# For V3 we do just V3 and get output for just ENV.
export evaluateFounders_proteinsList="V3";
export evaluateFounders_genomeRegion="V3";
# Ok, so do all four kinds. Append as we go.
export evaluateFounders_outputFilename="${outputDir}/evaluateFounders.tbl";
export evaluateFounders_append="FALSE";
if [ -e ${evaluateFounders_outputFilename} ]; then
rm ${evaluateFounders_outputFilename}
fi
if [ -z $5 ]; then
export listFile=${estimateDir}/processed_${patient}.list
else
export listFile=${estimateDir}/${patient}.list
fi
for fasta_prefix in `cat ${listFile} | rev | cut -d'/' -f-1 | rev | cut -d '.' -f 1`
do
echo ${fasta_prefix}
## Fix the suffixes first. Note the fixed files are put in the _output_ directory. Also note that we take this opporunity to somewhat recover if Infer didn't create the multiple-founder output file.
if [ -e "${inputDir}/${fasta_prefix}.outsingle.fa" ]; then
cp "${inputDir}/${fasta_prefix}.outsingle.fa" "${outputDir}/${fasta_prefix}_outsingle.fa";
else
if [ -e "${inputDir}/${fasta_prefix}.outmultiple.fa" ]; then
cp "${inputDir}/${fasta_prefix}.outmultiple.fa" "${outputDir}/${fasta_prefix}_outsingle.fa";
fi
fi
if [ -e "${inputDir}/${fasta_prefix}.outmultiple.fa" ]; then
cp "${inputDir}/${fasta_prefix}.outmultiple.fa" "${outputDir}/${fasta_prefix}_outmultiple.fa";
else
if [ -e "${inputDir}/${fasta_prefix}.outsingle.fa" ]; then
cp "${inputDir}/${fasta_prefix}.outsingle.fa" "${outputDir}/${fasta_prefix}_outmultiple.fa";
fi
fi
export evaluateFounders_estimatesFilename_single="${outputDir}/${fasta_prefix}_outsingle.fa";
export evaluateFounders_estimatesFilename_multiple="${outputDir}/${fasta_prefix}_outmultiple.fa";
for truth_fasta_prefix in `cat ${truthListFile} | rev | cut -d'/' -f-1 | rev | cut -d '.' -f 1`
do
echo ${truth_fasta_prefix}
export evaluateFounders_truthsFilename_single="${truthDir}/${truth_fasta_prefix}_singlefounder.fasta";
export evaluateFounders_truthsFilename_multiple="${truthDir}/${truth_fasta_prefix}_multifounder.fasta";
export evaluateFounders_estimatesFilename=${evaluateFounders_estimatesFilename_single};
export evaluateFounders_truthsFilename=${evaluateFounders_truthsFilename_single};
R -f ./evaluateFounders.R --vanilla --slave
export evaluateFounders_append="TRUE";
export evaluateFounders_estimatesFilename=${evaluateFounders_estimatesFilename_single};
export evaluateFounders_truthsFilename=${evaluateFounders_truthsFilename_multiple};
R -f ./evaluateFounders.R --vanilla --slave
export evaluateFounders_estimatesFilename=${evaluateFounders_estimatesFilename_multiple};
export evaluateFounders_truthsFilename=${evaluateFounders_truthsFilename_single};
R -f ./evaluateFounders.R --vanilla --slave
export evaluateFounders_estimatesFilename=${evaluateFounders_estimatesFilename_multiple};
export evaluateFounders_truthsFilename=${evaluateFounders_truthsFilename_multiple};
R -f ./evaluateFounders.R --vanilla --slave
done
done