(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 11.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 77613, 1901] NotebookOptionsPosition[ 76709, 1878] NotebookOutlinePosition[ 77231, 1897] CellTagsIndexPosition[ 77188, 1894] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[{ RowBox[{ RowBox[{"Datadir", "=", " ", RowBox[{ "$HomeDirectory", "<>", "\"\<\\\\Desktop\\\\AfterDisert.Work\\\\Chr3Potential\\\\\>\""}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SNPsFileNames", "=", RowBox[{"FileNames", "[", RowBox[{"\"\<*\>\"", ",", " ", "Datadir"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"EnvParDA", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"FIN", ",", RowBox[{"{", RowBox[{"Alt", ",", "59.35"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "3.604"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "48.206"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "21.435"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "16.197"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "7.775"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "27.065"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "2.112"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "0.6"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "11.509"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "5.099"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "2.497"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "164.595"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "187.776"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"CHB", ",", RowBox[{"{", RowBox[{"Alt", ",", "134.56"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "14.138"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "74.709"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "21.145"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "15.612"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "8.391"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "24.658"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "3.466"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "0.884"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "9.992"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "1.360"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "1958.224"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "2.969"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "66.192"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "99.556"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"LWK", ",", RowBox[{"{", RowBox[{"Alt", ",", "1391.19"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "20.310"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "122.904"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "23.8"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "21"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "10.4"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "26.20"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "8.3"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "4.5"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "5.5"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "0.6"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "5977.528"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "1.607"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "68.97"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "85.22"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"TSI", ",", RowBox[{"{", RowBox[{"Alt", ",", "48.45"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "12.728"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "65.979"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "23.529"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "19.294"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "9.412"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "25.6"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "8.24"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "0.6"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "13.34"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "4.6"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "539.326"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "2.017"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "74.610"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "97.421"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"JPT", ",", RowBox[{"{", RowBox[{"Alt", ",", "58.46"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "13.035"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "126.549"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "22.538"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "14.725"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "8.963"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "25.880"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "2.648"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "1.679"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "8.151"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "1.9"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "1168.539"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "2.403"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "79.082"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "99.558"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"IBS", ",", RowBox[{"{", RowBox[{"Alt", ",", "441.462"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "14.555"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "43.058"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "25.904"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "20.239"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "10.206"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "28.246"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "8.705"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", ".6"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "7.924"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "2.751"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "1009.971"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "2.483"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "61.26"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "95.28"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"KHV", ",", RowBox[{"{", RowBox[{"Alt", ",", "5.373"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "26.253"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "158.593"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "21.77"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "17.354"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "9.663"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "16.188"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "14.439"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "3.101"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "7.611"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "1.648"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "3953.286"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "2.292"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "76.658"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "100.177"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"MSL", ",", RowBox[{"{", RowBox[{"Alt", ",", "74.3"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "25.805"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "246.568"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "21.741"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "20.744"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "7.440"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "25.035"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "10.1"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "3.4"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "9.8"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "0.6"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "4719.101"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "1.959"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "81.355"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "100.401"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"CLM", ",", RowBox[{"{", RowBox[{"Alt", ",", "1915.529"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "17.569"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "115.518"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "18.99"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "15.196"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "7.322"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "9.034"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "21.118"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "2.337"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "6.015"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "0.6"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "5036.091"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "1.173"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "78.997"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "83.530"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"YRI", ",", RowBox[{"{", RowBox[{"Alt", ",", "79.60"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "27.074"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "122.873"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "20.399"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "17.673"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "10.295"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "19.599"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "8.572"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "3.662"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "7.968"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "0.6"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "5115.505"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "1.670"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "83.621"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "99.997"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"PEL", ",", RowBox[{"{", RowBox[{"Alt", ",", "292.234"}], "}"}], ",", RowBox[{"{", RowBox[{"TEM", ",", "18.393"}], "}"}], ",", RowBox[{"{", RowBox[{"Ran", ",", "16.018"}], "}"}], ",", RowBox[{"{", RowBox[{"Bac", ",", "6.215"}], "}"}], ",", RowBox[{"{", RowBox[{"Vir", ",", "10.740"}], "}"}], ",", RowBox[{"{", RowBox[{"Pro", ",", "6.410"}], "}"}], ",", RowBox[{"{", RowBox[{"Hel", ",", "6.252"}], "}"}], ",", RowBox[{"{", RowBox[{"Chi", ",", "8.632"}], "}"}], ",", RowBox[{"{", RowBox[{"Pri", ",", "0.726"}], "}"}], ",", RowBox[{"{", RowBox[{"Rod", ",", "2.296"}], "}"}], ",", RowBox[{"{", RowBox[{"Sor", ",", "0.6"}], "}"}], ",", RowBox[{"{", RowBox[{"UVB", ",", "7747.893"}], "}"}], ",", RowBox[{"{", RowBox[{"WS2M", ",", "3.715"}], "}"}], ",", RowBox[{"{", RowBox[{"RH2M", ",", "80.339"}], "}"}], ",", RowBox[{"{", RowBox[{"PS", ",", "95.564"}], "}"}]}], "}"}]}], "}"}]}], ";"}]}], "Input", CellChangeTimes->{{3.7493917324434605`*^9, 3.7493917330372314`*^9}, { 3.7493920038643513`*^9, 3.7493920325138803`*^9}, 3.7495573999708977`*^9, 3.749557784371363*^9, {3.7495578258011484`*^9, 3.7495578382780666`*^9}, 3.749558824215047*^9, 3.752395830630184*^9, 3.7523960556881704`*^9, { 3.7564203441262927`*^9, 3.7564204394067235`*^9}, 3.7564204879533167`*^9, { 3.7564206196284385`*^9, 3.7564207510951853`*^9}, {3.7564208551745696`*^9, 3.756420978890465*^9}, {3.756421015924634*^9, 3.7564211071847267`*^9}, { 3.7564211430961895`*^9, 3.756421220965727*^9}, {3.7564212623667674`*^9, 3.7564212753507795`*^9}, {3.7564213732616186`*^9, 3.756421381140522*^9}, { 3.756421536430659*^9, 3.7564215367916555`*^9}, {3.756423079613356*^9, 3.7564230954538336`*^9}, {3.7564231287070055`*^9, 3.7564231606432047`*^9}, {3.7564237965808277`*^9, 3.7564237975783243`*^9}, {3.7564238510650063`*^9, 3.7564238513305697`*^9}, {3.756423900297054*^9, 3.756423901908802*^9}, { 3.7564241554186044`*^9, 3.756424157407044*^9}, {3.7564242071265144`*^9, 3.7564242580639205`*^9}, {3.756424289501463*^9, 3.7564242910333223`*^9}, { 3.7564243225798645`*^9, 3.756424324209697*^9}, {3.7564259362278023`*^9, 3.756425963235222*^9}, {3.756425997922149*^9, 3.756426138031655*^9}, { 3.7564261699790907`*^9, 3.756426226572733*^9}, {3.7564263517116747`*^9, 3.7564264162829685`*^9}, {3.7564264545950136`*^9, 3.7564268148900785`*^9}, {3.756426848484043*^9, 3.756427121218624*^9}, { 3.7564271633368216`*^9, 3.7564272115783744`*^9}, {3.756429329019084*^9, 3.7564293353204517`*^9}, {3.756429365533416*^9, 3.7564293867371063`*^9}, { 3.7564294226499677`*^9, 3.756429427111165*^9}, {3.756429458747237*^9, 3.7564294693204603`*^9}, {3.756429512992844*^9, 3.756429513648879*^9}, 3.7564295701811867`*^9, {3.756429613946516*^9, 3.7564296142120285`*^9}, { 3.756429652237681*^9, 3.7564296559467015`*^9}, {3.756429755663827*^9, 3.7564297753357515`*^9}, {3.756429811899844*^9, 3.7564298662105484`*^9}, { 3.756429951898946*^9, 3.7564300920401435`*^9}, {3.7564301230576735`*^9, 3.7564303019722104`*^9}, {3.7564303341982017`*^9, 3.756430383867607*^9}, { 3.756478223298015*^9, 3.756478224349906*^9}, {3.762550642874281*^9, 3.7625506541946974`*^9}, {3.7625521448866396`*^9, 3.7625521461213512`*^9}, {3.762552753639218*^9, 3.762552761082649*^9}, { 3.7625534795663996`*^9, 3.7625534803474607`*^9}, {3.7625549453432536`*^9, 3.7625549463466496`*^9}, {3.762556287613691*^9, 3.76255628851945*^9}, { 3.7634729721007414`*^9, 3.763473182813023*^9}, {3.7636557067410345`*^9, 3.7636557197765126`*^9}, {3.7636557695000467`*^9, 3.763655798576646*^9}, { 3.76365584332545*^9, 3.7636558837821016`*^9}, {3.7636559663178596`*^9, 3.763655993549632*^9}, 3.7636582996486197`*^9, 3.7636584141917715`*^9, { 3.7636584733169794`*^9, 3.7636584738951263`*^9}, 3.7636587166820126`*^9, { 3.7636591152538896`*^9, 3.763659209195566*^9}, {3.763659303189194*^9, 3.76365931334465*^9}, {3.76366149847553*^9, 3.7636615547855463`*^9}, { 3.833183588669594*^9, 3.833183592003969*^9}, {3.8331855521751585`*^9, 3.8331855658135676`*^9}, {3.8331856396981397`*^9, 3.8331856465075765`*^9}, 3.833185718290695*^9, {3.8331859068758717`*^9, 3.833185916282737*^9}, { 3.8349492741738033`*^9, 3.834949308212471*^9}, {3.834949354271716*^9, 3.8349493729972734`*^9}, {3.8349494186719837`*^9, 3.8349494264861317`*^9}, {3.881391368705906*^9, 3.8813913695350823`*^9}, { 3.8814218817379475`*^9, 3.8814218823120165`*^9}, {3.881580592399163*^9, 3.881580592559048*^9}, 3.8815975103522015`*^9, {3.8819753140382576`*^9, 3.8819753273055525`*^9}, {3.88460594350035*^9, 3.884605946165612*^9}, { 3.8853697311023006`*^9, 3.8853697322089524`*^9}, {3.885369765993803*^9, 3.885369767320999*^9}, {3.8856034222018805`*^9, 3.885603422602793*^9}, 3.885805102995695*^9, {3.885945461402007*^9, 3.885945461936869*^9}, { 3.886768815738838*^9, 3.8867688170836496`*^9}, 3.886995793263195*^9, { 3.887006460777492*^9, 3.887006460959719*^9}, {3.8890357774255276`*^9, 3.88903577754569*^9}, {3.8897191793243237`*^9, 3.8897191803549714`*^9}, { 3.8901611894674234`*^9, 3.8901611898980117`*^9}, {3.8907424813911448`*^9, 3.8907424821337137`*^9}, {3.8908292045021877`*^9, 3.8908292052230186`*^9}, {3.8917586319059486`*^9, 3.891758634904895*^9}, { 3.892631060873663*^9, 3.8926310617132034`*^9}, {3.892692045919114*^9, 3.8926920472087584`*^9}, {3.8932919768961506`*^9, 3.8932919769873233`*^9}, {3.9023897360345964`*^9, 3.902389736499045*^9}, { 3.9026216145281477`*^9, 3.9026216149629846`*^9}, {3.927651557860925*^9, 3.927651560023129*^9}},ExpressionUUID->"a084c151-f120-469b-9a31-\ 43abdb641f34"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"Print", "[", RowBox[{ "\"\\"", " ", ",", "Datadir"}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"AllelesSwitcher", "[", RowBox[{"alleles_", ",", "lst_"}], "]"}], ":=", RowBox[{"Which", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"ToString", "[", RowBox[{"lst", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "]"}], "\[Equal]", RowBox[{"ToString", "[", "alleles", "]"}]}], ",", "lst", ",", "\[IndentingNewLine]", "True", ",", " ", RowBox[{"ReplacePart", "[", RowBox[{"lst", ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], "\[Rule]", "alleles"}], ",", RowBox[{ RowBox[{"{", RowBox[{"2", ",", "1"}], "}"}], "\[Rule]", "alleles"}], ",", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}], "\[Rule]", RowBox[{"lst", "[", RowBox[{"[", RowBox[{"1", ",", "2", ",", "2"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"{", RowBox[{"2", ",", "2", ",", "3"}], "}"}], "\[Rule]", RowBox[{"lst", "[", RowBox[{"[", RowBox[{"2", ",", "2", ",", "2"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2", ",", "2"}], "}"}], "\[Rule]", RowBox[{"lst", "[", RowBox[{"[", RowBox[{"1", ",", "2", ",", "3"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"{", RowBox[{"2", ",", "2", ",", "2"}], "}"}], "\[Rule]", RowBox[{"lst", "[", RowBox[{"[", RowBox[{"2", ",", "2", ",", "3"}], "]"}], "]"}]}]}], "}"}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"RedOrBlue", "[", RowBox[{"dataset_", ",", "j_"}], "]"}], ":=", RowBox[{"Which", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Length", "[", RowBox[{"dataset", "[", RowBox[{"[", RowBox[{"j", ",", "3", ",", "1", ",", "2"}], "]"}], "]"}], "]"}], "\[Equal]", "3"}], ")"}], "||", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"dataset", "[", RowBox[{"[", RowBox[{"j", ",", "3", ",", "1", ",", "2"}], "]"}], "]"}], "[", RowBox[{"[", "4", "]"}], "]"}], "\[Equal]", "0."}], ")"}]}], ")"}], ",", "Blue", ",", "\[IndentingNewLine]", "True", ",", "Red"}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"SNPdata", "[", "rsno_", "]"}], ":=", RowBox[{"Block", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"SNPfile", "=", RowBox[{ RowBox[{"FileNames", "[", RowBox[{ RowBox[{"\"\<*\>\"", "<>", RowBox[{"ToString", "[", "rsno", "]"}]}], ",", "Datadir"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Get", "[", "SNPfile", "]"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"orderedAlleleData", "[", "dataset_", "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"finalorderedalleledata", "=", RowBox[{"{", RowBox[{"dataset", "[", RowBox[{"[", "1", "]"}], "]"}], "}"}]}], ",", "\[IndentingNewLine]", RowBox[{"jfoad", "=", "2"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"While", "[", RowBox[{ RowBox[{"jfoad", "\[LessEqual]", RowBox[{"Length", "[", "dataset", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"newpop", "=", RowBox[{"{", RowBox[{ RowBox[{"dataset", "[", RowBox[{"[", RowBox[{"jfoad", ",", "1"}], "]"}], "]"}], ",", RowBox[{"dataset", "[", RowBox[{"[", RowBox[{"jfoad", ",", "2"}], "]"}], "]"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"switchpop", "=", RowBox[{"AppendTo", "[", RowBox[{"newpop", ",", RowBox[{"AllelesSwitcher", "[", RowBox[{ RowBox[{"finalorderedalleledata", "[", RowBox[{"[", RowBox[{"1", ",", "3", ",", "1", ",", "1"}], "]"}], "]"}], ",", RowBox[{"dataset", "[", RowBox[{"[", RowBox[{"jfoad", ",", "3"}], "]"}], "]"}]}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"finalorderedalleledata", ",", "switchpop"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"jfoad", "++"}]}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "finalorderedalleledata"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]}], "Input", CellChangeTimes->{{3.7495578280713778`*^9, 3.7495578295866747`*^9}, { 3.7495590003499203`*^9, 3.7495590010548997`*^9}, {3.749559182668254*^9, 3.749559183134766*^9}}, CellLabel->"In[25]:=",ExpressionUUID->"853e8912-99ae-4069-b6d4-ed20b7cf77a2"], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Defining data retrieval Functions from directory \"\>", "\[InvisibleSpace]", "\<\"C:\\\\Users\\\\hp\\\\Desktop\\\\AfterDisert.Work\ \\\\Chr3Potential No.103\\\\\"\>"}], SequenceForm[ "Defining data retrieval Functions from directory ", "C:\\Users\\hp\\Desktop\\AfterDisert.Work\\Chr3Potential No.103\\"], Editable->False]], "Print", CellChangeTimes->{{3.7495584052528477`*^9, 3.7495584086001863`*^9}, 3.7495584620234556`*^9, 3.7495589483049393`*^9, 3.749559201399892*^9, 3.7501069672932568`*^9, 3.7501610921871243`*^9, 3.750162607028881*^9, 3.750163006103093*^9, {3.750163210035351*^9, 3.750163211152358*^9}, { 3.7523957673499146`*^9, 3.7523957714916573`*^9}, {3.7523958793761387`*^9, 3.7523958811443768`*^9}, {3.752396059510309*^9, 3.752396067943247*^9}, { 3.7530740755097733`*^9, 3.7530740779766026`*^9}, {3.756421473313883*^9, 3.75642147682738*^9}, 3.7564215521966734`*^9, 3.7564231695019855`*^9, 3.756430399376707*^9, 3.7564312842274866`*^9, 3.756478234772892*^9, 3.7625563030009365`*^9, 3.7636615944308453`*^9, 3.8331877610818*^9, 3.833188224040553*^9, 3.8333865600284433`*^9, 3.8334457006474695`*^9, 3.8334504303212748`*^9, 3.8399432251586494`*^9, 3.839943355227606*^9, 3.8399736612181187`*^9, 3.8813913943604364`*^9, 3.8813914317305827`*^9, 3.8815708167037773`*^9, 3.8815806243919754`*^9, 3.8815975173349724`*^9, 3.8815975528169775`*^9, 3.8819753390061135`*^9, 3.881975375985649*^9, 3.881975454481676*^9, 3.884605975122856*^9, 3.8853698302211266`*^9, 3.8856034577627587`*^9, 3.885805115550351*^9, 3.88580515493769*^9, 3.8859455182016344`*^9, 3.886768850930279*^9, {3.886995827619567*^9, 3.886995839857489*^9}, 3.8870064945791593`*^9, 3.889035810194985*^9, { 3.8897192512481484`*^9, 3.889719254152556*^9}, 3.890161233901305*^9, 3.8901613139871497`*^9, 3.890742540133614*^9, 3.890829246222045*^9, { 3.8908292917448187`*^9, 3.8908293049594793`*^9}, {3.8917586803666897`*^9, 3.8917586911584864`*^9}, 3.8926784501043773`*^9, 3.89269209575872*^9, 3.8926921554588614`*^9, {3.8932921576855783`*^9, 3.893292161297107*^9}, 3.902402563677764*^9, 3.902621745794941*^9, 3.9027385988540487`*^9, 3.902738678082718*^9}, CellLabel-> "During evaluation of \ In[25]:=",ExpressionUUID->"e11fcb0a-77fd-4bec-96d5-4d15c8c88676"] }, Open ]], Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno_", ",", "SNPfileno_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"populations", "=", RowBox[{ RowBox[{"Transpose", "[", "EnvParDA", "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"paramsandnames", "=", RowBox[{ RowBox[{"Transpose", "[", "EnvParDA", "]"}], "[", RowBox[{"[", RowBox[{"1", "+", "paramno"}], "]"}], "]"}]}], ",", RowBox[{"paramname", "=", RowBox[{ RowBox[{ RowBox[{"Transpose", "[", "EnvParDA", "]"}], "[", RowBox[{"[", RowBox[{"1", "+", "paramno"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], ",", RowBox[{"params", "=", RowBox[{ RowBox[{"Transpose", "[", RowBox[{ RowBox[{"Transpose", "[", "EnvParDA", "]"}], "[", RowBox[{"[", RowBox[{"1", "+", "paramno"}], "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"OAData", "=", RowBox[{"Which", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"dat", "=", RowBox[{"Get", "[", RowBox[{"SNPsFileNames", "[", RowBox[{"[", "SNPfileno", "]"}], "]"}], "]"}]}], ")"}], "\[NotEqual]", RowBox[{"{", "}"}]}], ",", RowBox[{"orderedAlleleData", "[", "dat", "]"}], ",", "\[IndentingNewLine]", "True", ",", RowBox[{"{", "}"}]}], "\[IndentingNewLine]", "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "This", " ", "will", " ", "be", " ", "a", " ", "loop", " ", "over", " ", "all", " ", "populations"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"finaldata", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"popno", "=", "1"}], ",", RowBox[{"popno", "\[LessEqual]", RowBox[{"Length", "[", "populations", "]"}]}], ",", RowBox[{"popno", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{"pos", "=", RowBox[{"Position", "[", RowBox[{"OAData", ",", RowBox[{"ToString", "[", RowBox[{"populations", "[", RowBox[{"[", "popno", "]"}], "]"}], "]"}]}], "]"}]}], ")"}], "!=", RowBox[{"{", "}"}]}], ")"}], "&&", " ", RowBox[{"(", RowBox[{ RowBox[{"params", "[", RowBox[{"[", "popno", "]"}], "]"}], "\[NotEqual]", "\"\\""}], ")"}]}], " ", ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"lstno", "=", RowBox[{"pos", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"finaldata", ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"populations", "[", RowBox[{"[", "popno", "]"}], "]"}], ",", RowBox[{"RedOrBlue", "[", RowBox[{"OAData", ",", "lstno"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"params", "[", RowBox[{"[", "popno", "]"}], "]"}], ",", RowBox[{"OAData", "[", RowBox[{"[", RowBox[{"lstno", ",", "3", ",", "1"}], "]"}], "]"}]}], "}"}]}], "}"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"Sortedfinaldata", "=", "\[IndentingNewLine]", RowBox[{"Sort", "[", RowBox[{"finaldata", ",", RowBox[{ RowBox[{ RowBox[{"#1", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], "\[LessEqual]", RowBox[{"#2", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}]}], " ", "&"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"SNPNum", "=", RowBox[{"Which", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"OAData", "\[NotEqual]", RowBox[{"{", "}"}]}], ",", RowBox[{"OAData", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "3"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "True", ",", RowBox[{"StringDrop", "[", RowBox[{ RowBox[{"SNPsFileNames", "[", RowBox[{"[", "SNPfileno", "]"}], "]"}], ",", RowBox[{ RowBox[{"StringPosition", "[", RowBox[{ RowBox[{"SNPsFileNames", "[", RowBox[{"[", "SNPfileno", "]"}], "]"}], ",", "\"\<\\\\\>\""}], "]"}], "[", RowBox[{"[", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"-", "1"}]}], "]"}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"SNPNum", ",", "paramname"}], "}"}], ",", "Sortedfinaldata"}], "}"}]}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"paramno_", ",", "SNPfileno_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"paramsandpots", "=", RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}]}], ",", RowBox[{"SNPPoints", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{"2", ",", "j", ",", "2", ",", "1"}], "]"}], "]"}], ",", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{ "2", ",", "j", ",", "2", ",", "2", ",", "2", ",", "1"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", RowBox[{"Length", "[", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}], ",", RowBox[{"Allele1Points", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{"2", ",", "j", ",", "2", ",", "1"}], "]"}], "]"}], ",", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{ "2", ",", "j", ",", "2", ",", "2", ",", "2", ",", "2"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", RowBox[{"Length", "[", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}], ",", RowBox[{"Allele2Points", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{"2", ",", "j", ",", "2", ",", "1"}], "]"}], "]"}], ",", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{ "2", ",", "j", ",", "2", ",", "2", ",", "2", ",", "3"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", RowBox[{"Length", "[", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}], ",", RowBox[{"Alleles", "=", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{"2", ",", "1", ",", "2", ",", "2", ",", "1"}], "]"}], "]"}]}], ",", RowBox[{"PopsAndColor", "=", RowBox[{ RowBox[{"Transpose", "[", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], " ", "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"SNPName", "=", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], ",", RowBox[{"envpar", "=", RowBox[{ RowBox[{"AdjParametersAndPotentials", "[", RowBox[{"paramno", ",", "SNPfileno"}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"SNPName", ",", "envpar"}], "}"}], ",", "PopsAndColor", ",", "SNPPoints", ",", "Alleles", ",", "Allele1Points", ",", "Allele2Points"}], "}"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"RMS", "[", RowBox[{"points_", ",", "Functions_"}], "]"}], ":=", RowBox[{"Sqrt", "[", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"points", "[", RowBox[{"[", RowBox[{"j", ",", "2"}], "]"}], "]"}], "-", RowBox[{"Functions", "[", RowBox[{"points", "[", RowBox[{"[", RowBox[{"j", ",", "1"}], "]"}], "]"}], "]"}]}], ")"}], "^", "2"}], "/", RowBox[{"Length", "[", "points", "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", RowBox[{"Length", "[", "points", "]"}]}], "}"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"muafunc", "[", RowBox[{"pa1_", ",", "Tp_", ",", "Mu_"}], "]"}], ":=", RowBox[{"Mu", "-", " ", RowBox[{"Tp", " ", RowBox[{"Log", "[", RowBox[{"2", ",", "pa1"}], "]"}]}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"musfunc", "[", RowBox[{"pa1_", ",", "Tp_", ",", "Mu_"}], "]"}], ":=", RowBox[{"Mu", "-", " ", RowBox[{"Tp", RowBox[{"(", RowBox[{ RowBox[{"pa1", " ", RowBox[{"Log", "[", RowBox[{"2", ",", "pa1"}], "]"}]}], " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{"1", "-", " ", "pa1"}], ")"}], " ", RowBox[{"Log", "[", RowBox[{"2", ",", RowBox[{"1", "-", "pa1"}]}], "]"}]}]}], " ", ")"}]}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"MyFun", "[", "type_", "]"}], "[", RowBox[{"ptlist_", ",", "funcform_", ",", "funcparams_", ",", "var_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Potentialrange", "=", RowBox[{"Abs", "[", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", "ptlist", "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", "ptlist", "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "]"}]}], ",", RowBox[{"ans", "=", RowBox[{"FindFit", "[", RowBox[{"ptlist", ",", "funcform", ",", "funcparams", ",", "var"}], "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"sss", "[", "type", "]"}], "=", RowBox[{"funcform", "/.", "ans"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Ftfunc", "[", "type", "]"}], "[", "xx_", "]"}], ":=", RowBox[{ RowBox[{"sss", "[", "type", "]"}], "/.", RowBox[{"var", "\[Rule]", "xx"}]}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"RMS", "[", RowBox[{"ptlist", ",", RowBox[{"Ftfunc", "[", "type", "]"}]}], "]"}], "/", "Potentialrange"}]}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"SNPfuncPlot", "[", RowBox[{"Plotinfo_", ",", "func_", ",", "flagval_"}], "]"}], ":=", RowBox[{"Block", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"height", "=", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], ")"}]}], ",", "\[IndentingNewLine]", RowBox[{"width", "=", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ")"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Plot", "[", RowBox[{ RowBox[{"func", "[", "var", "]"}], ",", RowBox[{"{", RowBox[{"var", ",", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"AbsoluteThickness", "[", RowBox[{"Min", "[", RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{"Maxflagvalue", "/", "flagval"}], ")"}], ",", "10"}], "}"}], "]"}], "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"0.05", "width"}]}], ",", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "+", RowBox[{"0.05", "width"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "-", RowBox[{"0.03", "*", "height"}]}], ")"}], ",", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "+", RowBox[{"0.05", "*", "height"}]}], ")"}]}], "}"}]}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Full"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ",", RowBox[{"\"\<\[Mu]\>\"", "<>", RowBox[{"ToString", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", RowBox[{ RowBox[{"ToString", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "]"}], "<>", "\"\< Relative RMS =\>\"", "<>", RowBox[{"ToString", "[", RowBox[{"N", "[", RowBox[{ RowBox[{"Round", "[", RowBox[{"flagval", "*", "1000"}], "]"}], "/", "1000"}], "]"}], "]"}]}]}], ",", RowBox[{"Epilog", "\[Rule]", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"2", ",", "i"}], "]"}], "]"}], ",", RowBox[{"PointSize", "[", "0.01", "]"}], ",", RowBox[{"Point", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"3", ",", "i"}], "]"}], "]"}], "]"}], ",", RowBox[{"Text", "[", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"2", ",", "i", ",", "1"}], "]"}], "]"}], ",", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"3", ",", "i"}], "]"}], "]"}], "+", RowBox[{"{", RowBox[{"0.0", ",", RowBox[{"0.03", "*", "height"}]}], "}"}]}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"MuAllele1FuncPlot", "[", RowBox[{"Plotinfo_", ",", "func_", ",", "flagval_"}], "]"}], ":=", RowBox[{"Block", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"height", "=", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], ")"}]}], ",", "\[IndentingNewLine]", RowBox[{"width", "=", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ")"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Plot", "[", RowBox[{ RowBox[{"func", "[", "var", "]"}], ",", RowBox[{"{", RowBox[{"var", ",", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"AbsoluteThickness", "[", RowBox[{"Min", "[", RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{"Maxflagvalue", "/", "flagval"}], ")"}], ",", "10"}], "}"}], "]"}], "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"0.05", "width"}]}], ",", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "+", RowBox[{"0.05", "width"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "-", RowBox[{"0.03", "*", "height"}]}], ")"}], ",", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "+", RowBox[{"0.05", "*", "height"}]}], ")"}]}], "}"}]}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Full"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ",", RowBox[{"\"\<\[Mu]\>\"", "<>", RowBox[{"ToString", "[", RowBox[{"StringDrop", "[", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", "4", "]"}], "]"}], ",", RowBox[{"-", "2"}]}], "]"}], "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", RowBox[{ RowBox[{"ToString", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "]"}], "<>", "\"\< Relative RMS =\>\"", "<>", RowBox[{"ToString", "[", RowBox[{"N", "[", RowBox[{ RowBox[{"Round", "[", RowBox[{"flagval", "*", "1000"}], "]"}], "/", "1000"}], "]"}], "]"}]}]}], ",", RowBox[{"Epilog", "\[Rule]", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"2", ",", "i"}], "]"}], "]"}], ",", RowBox[{"PointSize", "[", "0.01", "]"}], ",", RowBox[{"Point", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"5", ",", "i"}], "]"}], "]"}], "]"}], ",", RowBox[{"Text", "[", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"2", ",", "i", ",", "1"}], "]"}], "]"}], ",", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"5", ",", "i"}], "]"}], "]"}], "+", RowBox[{"{", RowBox[{"0.0", ",", RowBox[{"0.03", "*", "height"}]}], "}"}]}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"MuAllele2FuncPlot", "[", RowBox[{"Plotinfo_", ",", "func_", ",", "flagval_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"height", "=", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], ")"}]}], ",", "\[IndentingNewLine]", RowBox[{"width", "=", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ")"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Plot", "[", RowBox[{ RowBox[{"func", "[", "var", "]"}], ",", RowBox[{"{", RowBox[{"var", ",", RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"AbsoluteThickness", "[", RowBox[{"Min", "[", RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{"Maxflagvalue", "/", "flagval"}], ")"}], ",", "10"}], "}"}], "]"}], "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"0.05", "width"}]}], ",", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "+", RowBox[{"0.05", "width"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "-", RowBox[{"0.03", "*", "height"}]}], ")"}], ",", RowBox[{"(", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "+", RowBox[{"0.05", "*", "height"}]}], ")"}]}], "}"}]}], "}"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "Full"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ",", RowBox[{"\"\<\[Mu]\>\"", "<>", RowBox[{"ToString", "[", RowBox[{"StringDrop", "[", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", "4", "]"}], "]"}], ",", "2"}], "]"}], "]"}]}]}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", RowBox[{ RowBox[{"ToString", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "]"}], "<>", "\"\< Relative RMS =\>\"", "<>", RowBox[{"ToString", "[", RowBox[{"N", "[", RowBox[{ RowBox[{"Round", "[", RowBox[{"flagval", "*", "1000"}], "]"}], "/", "1000"}], "]"}], "]"}]}]}], ",", RowBox[{"Epilog", "\[Rule]", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"2", ",", "i"}], "]"}], "]"}], ",", RowBox[{"PointSize", "[", "0.01", "]"}], ",", RowBox[{"Point", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"6", ",", "i"}], "]"}], "]"}], "]"}], ",", RowBox[{"Text", "[", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"2", ",", "i", ",", "1"}], "]"}], "]"}], ",", RowBox[{ RowBox[{"Plotinfo", "[", RowBox[{"[", RowBox[{"6", ",", "i"}], "]"}], "]"}], "+", RowBox[{"{", RowBox[{"0.0", ",", RowBox[{"0.03", "*", "height"}]}], "}"}]}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", RowBox[{"Plotinfo", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.749387723513164*^9, 3.7493877759381666`*^9}, { 3.749391416160275*^9, 3.7493914167693567`*^9}, {3.7493919456436257`*^9, 3.749391945924638*^9}, {3.7493929585154505`*^9, 3.7493929589372263`*^9}, { 3.7493939605458994`*^9, 3.749393961249029*^9}, {3.7493940146271315`*^9, 3.7493940149081163`*^9}, {3.749394412892929*^9, 3.7493944226408167`*^9}, { 3.749394506183728*^9, 3.749394518649547*^9}, 3.749394677955761*^9, 3.749558481443941*^9, {3.7495592454569426`*^9, 3.749559249138298*^9}, { 3.7501067192313843`*^9, 3.7501069567255087`*^9}, {3.750160654720297*^9, 3.750160658079283*^9}, {3.750160984773989*^9, 3.75016098826266*^9}, { 3.7501615184142604`*^9, 3.7501615435430527`*^9}, {3.7501622148765574`*^9, 3.75016221622196*^9}, {3.7501624504752607`*^9, 3.7501624673422003`*^9}, 3.7501631525809383`*^9, {3.7517364897948713`*^9, 3.7517364909979186`*^9}}, CellLabel->"In[30]:=",ExpressionUUID->"8d8aa75e-6745-4f63-9d71-cc4a874a8721"], Cell[BoxData[{ RowBox[{ RowBox[{"Maxflagvalue", "=", "0.1"}], ";", " ", RowBox[{"MinPops", "=", "7"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "SNPsFileNames", "]"}]}], ",", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"k", "=", "1"}], ",", RowBox[{"k", "\[LessEqual]", RowBox[{ RowBox[{"Length", "[", RowBox[{"EnvParDA", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", "1"}]}], ",", RowBox[{"k", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"flagvalue1", "=", RowBox[{ RowBox[{"MyFun", "[", "1", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "3", "]"}], "]"}], ",", RowBox[{"musfunc", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Cos", "[", "b", "]"}], "^", "2"}], "*", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Tanh", "[", RowBox[{ RowBox[{"a", "*", RowBox[{"(", RowBox[{"x", "/", RowBox[{ RowBox[{"Sort", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"-", "1"}], "]"}], "]"}]}], ")"}]}], "+", "x0"}], "]"}], "+", "1"}], ")"}], "/", "2"}]}], "+", RowBox[{ RowBox[{"Sin", "[", "c", "]"}], "^", "2"}]}], ")"}], "/", "2"}], ",", RowBox[{"2", "*", "Tp"}], ",", "Mu"}], "]"}], ",", RowBox[{"{", RowBox[{ "x0", ",", "b", ",", "c", ",", "Tp", ",", "Mu", ",", "a"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue4", "=", RowBox[{ RowBox[{"MyFun", "[", "4", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "3", "]"}], "]"}], ",", RowBox[{ RowBox[{"a", "*", "x"}], "+", "b"}], ",", RowBox[{"{", RowBox[{"b", ",", "a"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue7", "=", RowBox[{ RowBox[{"MyFun", "[", "7", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "3", "]"}], "]"}], ",", RowBox[{ RowBox[{"a", "*", RowBox[{"(", RowBox[{"x", "^", "2"}], ")"}]}], "+", RowBox[{"b", "*", "x"}], "+", "c"}], ",", RowBox[{"{", RowBox[{"b", ",", "a", ",", "c"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue2", "=", RowBox[{ RowBox[{"MyFun", "[", "2", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "5", "]"}], "]"}], ",", RowBox[{"muafunc", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Cos", "[", "b", "]"}], "^", "2"}], "*", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Tanh", "[", RowBox[{ RowBox[{"a", "*", RowBox[{"(", RowBox[{"x", "/", RowBox[{ RowBox[{"Sort", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "5", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"-", "1"}], "]"}], "]"}]}], ")"}]}], "+", "x0"}], "]"}], "+", "1"}], ")"}], "/", "2"}]}], "+", RowBox[{ RowBox[{"Sin", "[", "c", "]"}], "^", "2"}]}], ")"}], "/", "2"}], ",", RowBox[{"2", "*", "Tp"}], ",", "Mu"}], "]"}], ",", RowBox[{"{", RowBox[{ "x0", ",", "b", ",", "c", ",", "Tp", ",", "Mu", ",", "a"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue5", "=", RowBox[{ RowBox[{"MyFun", "[", "5", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "5", "]"}], "]"}], ",", RowBox[{ RowBox[{"a", "*", "x"}], "+", "b"}], ",", RowBox[{"{", RowBox[{"b", ",", "a"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue8", "=", RowBox[{ RowBox[{"MyFun", "[", "8", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "5", "]"}], "]"}], ",", RowBox[{ RowBox[{"a", "*", RowBox[{"(", RowBox[{"x", "^", "2"}], ")"}]}], "+", RowBox[{"b", "*", "x"}], "+", "c"}], ",", RowBox[{"{", RowBox[{"b", ",", "a", ",", "c"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue3", "=", RowBox[{ RowBox[{"MyFun", "[", "3", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "6", "]"}], "]"}], ",", RowBox[{"muafunc", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Cos", "[", "b", "]"}], "^", "2"}], "*", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Tanh", "[", RowBox[{ RowBox[{"a", "*", RowBox[{"(", RowBox[{"x", "/", RowBox[{ RowBox[{"Sort", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "6", "]"}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"-", "1"}], "]"}], "]"}]}], ")"}]}], "+", "x0"}], "]"}], "+", "1"}], ")"}], "/", "2"}]}], "+", RowBox[{ RowBox[{"Sin", "[", "c", "]"}], "^", "2"}]}], ")"}], "/", "2"}], ",", RowBox[{"2", "*", "Tp"}], ",", "Mu"}], "]"}], ",", RowBox[{"{", RowBox[{ "x0", ",", "b", ",", "c", ",", "Tp", ",", "Mu", ",", "a"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue6", "=", RowBox[{ RowBox[{"MyFun", "[", "6", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "6", "]"}], "]"}], ",", RowBox[{ RowBox[{"a", "*", "x"}], "+", "b"}], ",", RowBox[{"{", RowBox[{"b", ",", "a"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"flagvalue9", "=", RowBox[{ RowBox[{"MyFun", "[", "9", "]"}], "[", RowBox[{ RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "6", "]"}], "]"}], ",", RowBox[{ RowBox[{"a", "*", RowBox[{"(", RowBox[{"x", "^", "2"}], ")"}]}], "+", RowBox[{"b", "*", "x"}], "+", "c"}], ",", RowBox[{"{", RowBox[{"b", ",", "a", ",", "c"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"AlleleOneValues", "=", RowBox[{"Sort", "[", RowBox[{"{", RowBox[{"flagvalue2", ",", "flagvalue5", ",", "flagvalue8"}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"AlleleTwoValues", "=", RowBox[{"Sort", "[", RowBox[{"{", RowBox[{"flagvalue3", ",", "flagvalue6", ",", "flagvalue9"}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"AllValuesSorted", "=", RowBox[{"Sort", "[", RowBox[{"{", RowBox[{ RowBox[{"AlleleOneValues", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"AlleleTwoValues", "[", RowBox[{"[", "1", "]"}], "]"}]}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"AllValuesSorted", "[", RowBox[{"[", "2", "]"}], "]"}], "<=", "Maxflagvalue"}], ")"}], "&&", RowBox[{"(", RowBox[{ RowBox[{"Length", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], "[", RowBox[{"[", "3", "]"}], "]"}], "]"}], "\[GreaterEqual]", "MinPops"}], ")"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"flagplots", "[", RowBox[{"k", ",", "j"}], "]"}], "=", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"SNPfuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "1", "]"}], ",", "flagvalue1"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"SNPfuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "4", "]"}], ",", "flagvalue4"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"SNPfuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "7", "]"}], ",", "flagvalue7"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"MuAllele1FuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "2", "]"}], ",", "flagvalue2"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"MuAllele1FuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "5", "]"}], ",", "flagvalue5"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"MuAllele1FuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "8", "]"}], ",", "flagvalue8"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"MuAllele2FuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "3", "]"}], ",", "flagvalue3"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"MuAllele2FuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "6", "]"}], ",", "flagvalue6"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"MuAllele2FuncPlot", "[", RowBox[{ RowBox[{"SNPAndAllelicMusvsParam", "[", RowBox[{"k", ",", "j"}], "]"}], ",", RowBox[{"Ftfunc", "[", "9", "]"}], ",", "flagvalue9"}], "]"}]}], "\[IndentingNewLine]", "}"}]}], ",", RowBox[{ RowBox[{"##", "&"}], "[", "]"}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", "//", "Print"}]}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "Input", CellChangeTimes->{3.8334538872535934`*^9}, CellLabel->"In[39]:=",ExpressionUUID->"fc545fda-f503-4d19-a22b-924c43789e66"] }, WindowSize->{1366, 685}, WindowMargins->{{-8, Automatic}, {Automatic, -8}}, TaggingRules->{ "WelcomeScreenSettings" -> {"FEStarting" -> False}, "TryRealOnly" -> False}, Magnification:>0.9 Inherited, FrontEndVersion->"12.3 for Microsoft Windows (64-bit) (July 9, 2021)", StyleDefinitions->"Default.nb", ExpressionUUID->"5c1d6f33-2e92-40bc-a0d6-5fcab14c0745" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[558, 20, 17966, 434, 352, "Input",ExpressionUUID->"a084c151-f120-469b-9a31-43abdb641f34"], Cell[CellGroupData[{ Cell[18549, 458, 5534, 145, 424, "Input",ExpressionUUID->"853e8912-99ae-4069-b6d4-ed20b7cf77a2"], Cell[24086, 605, 2375, 37, 23, "Print",ExpressionUUID->"e11fcb0a-77fd-4bec-96d5-4d15c8c88676"] }, Open ]], Cell[26476, 645, 35969, 888, 1306, "Input",ExpressionUUID->"8d8aa75e-6745-4f63-9d71-cc4a874a8721"], Cell[62448, 1535, 14257, 341, 622, "Input",ExpressionUUID->"fc545fda-f503-4d19-a22b-924c43789e66"] } ] *)