Debian Codegraph @

tests/manualtests/ms_vs_scrm-seg_with_recomb_Tifs.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 ## compare number of mutations with recombinations
4 # this pairwise_test.sh is a sub test of this
5
6 mkdirscip-shell system . . mkdir. test-seg-recomb
7 cd test-seg-recomb
8 rmscip-shell system . . rm. *pdf
9
10 msr=(11 21 10 50 100)
11 mst=(10 20 50 100 10)
12 #msr=(100)
13 #mst=(25)
14
15 rep=100000
16 seqlen=100000
17 msNsample=(2 3 7 10)
18 compareSEG=compareSEG-RECOMB
19 echoscip-shell system . . echo. -e "compare number of mutations with recombinations for ${rep} replicates
20 \t\t\t|\t\t\t|\t ms \t\t|\t scrm\t\t|\tTest1\t\t\t|\tTest2\t\t\t
21 Nsam\ttheta\trho\t|\tmean\tstdv\t|\tmean\tstdv\t|\tmean\tstdv \t|\tstats\tp-value\t\t|\tstats\tp-value\t\t" > ${compareSEG}
22
23
24 for t in "${mst[@]}"
25 do
26 for r in "${msr[@]}"
27 do
28 for nsam in "${msNsample[@]}"
29 do
30 prefix=${nsam}sample${r}rho${t}theta
31 nseg=${prefix}NumOfSeg
32 ms ${nsam} ${rep} -t ${t} -r ${r} ${seqlen} | tailscip-shell system . . tail. -n +4 | grepscip-shell system . . grep. -v "//" | grepscip-shell system . . grep. "segsites" | sedscip-shell system . . sed. -e "s/segsites: //" > ms${nseg}
33
34 scrm ${nsam} ${rep} -t ${t} -r ${r} ${seqlen} | tailscip-shell system . . tail. -n +4 | grepscip-shell system . . grep. -v "//" | grepscip-shell system . . grep. "segsites" | sedscip-shell system . . sed. -e "s/segsites: //" > scrm${nseg}
35
36 echoscip-shell system . . echo. "rm(list=ls());
37 source(\"../fun_src.r\");
38 msdata=read.table(\"ms${nseg}\")\$V1;
39 scrmdata=read.table(\"scrm${nseg}\")\$V1;
40 ee=ee_seg(${nsam},${t});
41 sdv=sd_seg_recomb(${nsam},${t},${r});
42 datamax=max(msdata,scrmdata);
43 mstable=table(factor(msdata,levels=1:datamax))
44 scrmtable=table(factor(scrmdata,levels=1:datamax))
45 pdf(\"${nsam}sample${t}mut${r}recomb_NUM_MUT.pdf\");
46 #plot(mstable,col=\"red\",ylab=\"Frequency\",xlab=\"Number of mutations\");
47 #lines(scrmtable,col=\"blue\");
48 plot(as.numeric(names(mstable)), mstable/length(msdata),pch=16,col=\"red\",ylab=\"Frequency\",xlab=\"Number of mutations\");
49 points(as.numeric(names(scrmtable)), scrmtable/length(scrmdata),pch=16,col=\"blue\")
50
51 ms_newtable=table(msdata);
52 scrm_mstable=table(factor(scrmdata,levels=names(table(msdata))));
53 combined_scrm_ms_test=chisq.test(cbind(scrm_mstable, ms_newtable));
54
55 scrm_newtable=table(scrmdata);
56 ms_scrmtable=table(factor(msdata,levels=names(table(scrmdata))));
57 combined_ms_scrm_test=chisq.test(cbind(scrm_newtable, ms_scrmtable));
58
59 legend(\"topright\",c(paste(\"Test 1 Statistics = \",combined_scrm_ms_test\$statistic,sep=\"\"), paste(\"p-value = \",format(combined_scrm_ms_test\$p.value,digits=4),sep=\"\"),paste(\"Test 2 Statistics = \",combined_ms_scrm_test\$statistic,sep=\"\"), paste(\"p-value = \",format(combined_ms_scrm_test\$p.value,digits=4),sep=\"\")))
60 legend(\"topleft\",c(\"ms\",\"scrm\"), col=c(\"red\",\"blue\"), pch=16)
61 dev.off();
62
63
64 cat(paste(${nsam},${t},${r},\"|\",format(ee,digits=4),format(sdv,digits=4),\"|\",
65 format(mean(msdata),digits=4),format(sd(msdata),digits=4),\"|\",
66 format(mean(scrmdata),digits=4),format(sd(scrmdata),digits=4),\"|\",
67 format(combined_scrm_ms_test\$statistic,digits=4),format(combined_scrm_ms_test\$p.value,scientific = TRUE),\"|\",
68 format(combined_ms_scrm_test\$statistic,digits=4),format(combined_ms_scrm_test\$p.value,scientific = TRUE),
69 sep=\"\t\"),file=\"${compareSEG}\",append=TRUE);cat(\"\n\",file=\"${compareSEG}\",append=TRUE);
70 " > dummy.r
71 R CMD BATCH dummy.r
72 rmscip-shell system . . rm. ms${nseg} scrm${nseg}
73 done
74 done
75 done
76
77
78