Intro

This Document will create the full phenotype and covariates table for GWA analysis (See this) as well as preparing the genotype data for use in R (see this).

Setup

Load Data Objects

data.env <- new.env() # create new environment
data(list = params$data, envir = data.env) #load data objects into environment

lookup table

This section may also not be needed if the full trait data contains the GWA ID information.

# load in lookup tables
lookup.tab <- read.csv(params$lookuptable)
## relable the GWA ID column to exaclty GWA.ID (in case it is something else)
names(lookup.tab)[match(params$GWA.ID,names(lookup.tab))] <- "GWA.ID"

These are the individuals whose genet has been updated in some way or another and the number of individuals in each genet that have been changedr:

lookup.tab$tmp.Genet.2014 <- factor(ifelse(is.na(lookup.tab$Genet.2014), 
                                       yes = "NA",
                                       no = as.character(lookup.tab$Genet.2014)))
# rows who's 2014 genet does not equal the SSR genet
(tmp <- lookup.tab[as.character(lookup.tab$Genet.SSRrev) !=
                   as.character(lookup.tab$tmp.Genet.2014),
              c("Genet.2014","Genet.SSRrev","GWA.ID")])
##      Genet.2014 Genet.SSRrev              GWA.ID
## 9           748      548.748 UME_303602_P14_WA09
## 12          357   357.358359 UME_303602_P11_WG02
## 30          210       112.21 UME_303602_P14_WD09
## 56          628    627.62863 UME_303602_P13_WE11
## 70        Wau-3      Wau-2.3                <NA>
## 77          364      364.365 UME_303602_P11_WG06
## 94         PG-3         PI-3 UME_301101_P01_WH02
## 95         PG-3         PI-3 UME_301101_P01_WH02
## 98          316      316.317 UME_303602_P11_WD05
## 115         365      364.365 UME_303602_P11_WG06
## 124         100      100.991 UME_303602_P09_WF05
## 134         359   357.358359 UME_303602_P11_WG02
## 145         101      100.101 UME_303602_P09_WF06
## 154         317      316.317 UME_303602_P11_WD05
## 159          66        66.67 UME_303602_P09_WD09
## 170         341      338.341 UME_303602_P11_WE11
## 181          27       26.991                <NA>
## 194         370       369.37 UME_303602_P12_WB09
## 195         370       369.37 UME_303602_P12_WB09
## 222         221      221.991 UME_303602_P10_WF09
## 237       Wau-2      Wau-2.3                <NA>
## 247          39         39.4 UME_303602_P09_WC05
## 252          46        46.47 UME_303602_P09_WC10
## 260         387      387.991                <NA>
## 265         285      285.991                <NA>
## 275          92        92.93 UME_303602_P09_WE11
## 286         728          511 UME_303602_P13_WA11
## 329         369       369.37 UME_303602_P12_WB09
## 340         334      334.991                <NA>
## 351         328   326.328329 UME_303602_P11_WE01
## 363         112       112.21 UME_303602_P14_WD09
## 365         627    627.62863 UME_303602_P13_WE11
## 377         326   326.328329 UME_303602_P11_WE01
## 384          26        26.27 UME_303602_P09_WB11
## 387         210       112.21 UME_303602_P14_WD09
## 388         329   326.328329 UME_303602_P11_WE01
## 392         338      338.341 UME_303602_P11_WE11
## 400          47        46.47 UME_303602_P09_WC10
## 411         548      548.748 UME_303602_P14_WA09
## 445         369       369.37 UME_303602_P12_WB09
## 461         166      166.991                <NA>
## 463         196          197 UME_303602_P10_WD12
## 466         341      338.341 UME_303602_P11_WE11
## 486         358   357.358359 UME_303602_P11_WG02
## 487         101      100.101 UME_303602_P09_WF06
## 507         326   326.328329 UME_303602_P11_WE01
## 513         748      548.748 UME_303602_P14_WA09
## 530       Wau-3      Wau-2.3                <NA>
## 544          26        26.27 UME_303602_P09_WB11
## 572         316      316.317 UME_303602_P11_WD05
## 582         359   357.358359 UME_303602_P11_WG02
## 589          39         39.4 UME_303602_P09_WC05
## 602          92        92.93 UME_303602_P09_WE11
## 633         328   326.328329 UME_303602_P11_WE01
## 645         628    627.62863 UME_303602_P13_WE11
## 654          46        46.47 UME_303602_P09_WC10
## 659          27        26.27 UME_303602_P09_WB11
## 667         753          755 UME_303602_P14_WB04
## 674         548      548.748 UME_303602_P14_WA09
## 680         317      316.317 UME_303602_P11_WD05
## 684          66        66.67 UME_303602_P09_WD09
## 701       Wau-2      Wau-2.3                <NA>
## 704          40         39.4 UME_303602_P09_WC05
## 715         338      338.341 UME_303602_P11_WE11
## 721         627    627.62863 UME_303602_P13_WE11
## 723         364      364.365 UME_303602_P11_WG06
## 733         365      364.365 UME_303602_P11_WG06
## 741          47        46.47 UME_303602_P09_WC10
## 746         100      100.991 UME_303602_P09_WF05
## 764         112       112.21 UME_303602_P14_WD09
## 766         210       112.21 UME_303602_P14_WD09
## 768        312X      316.317 UME_303602_P11_WD05
## 773         370       369.37 UME_303602_P12_WB09
## 774         370       369.37 UME_303602_P12_WB09
## 806          34           32 UME_303602_P14_WC11
## 813         329   326.328329 UME_303602_P11_WE01
## 818        PG-3         PI-3 UME_301101_P01_WH02
## 819        PG-3         PI-3 UME_301101_P01_WH02
## 831         387      387.992 UME_303602_P11_WH12
## 845         227      227.991 UME_303602_P10_WG02
## 861         628    627.62863 UME_303602_P13_WE11
## 869          39         39.4 UME_303602_P09_WC05
## 873         338      338.341 UME_303602_P11_WE11
## 876         370       369.37 UME_303602_P12_WB09
## 877         370       369.37 UME_303602_P12_WB09
## 891         540       539.54 UME_303602_P13_WC03
## 892          40         39.4 UME_303602_P09_WC05
## 905        PG-2         PG-1             PG1-1B4
## 906        PG-2         PG-1             PG1-1B4
## 923         210       112.21 UME_303602_P14_WD09
## 926          93        92.93 UME_303602_P09_WE11
## 930         748      548.748 UME_303602_P14_WA09
## 947         198      198.991                <NA>
## 959          47        46.47 UME_303602_P09_WC10
## 971         539       539.54 UME_303602_P13_WC03
## 995         630    627.62863 UME_303602_P13_WE11
## 1013         27       26.991                <NA>
## 1040        358   357.358359 UME_303602_P11_WG02
## 1047        174      174.991                <NA>
## 1048        328   326.328329 UME_303602_P11_WE01
## 1049       PG-3         PI-3 UME_301101_P01_WH02
## 1050       PG-3         PI-3 UME_301101_P01_WH02
## 1061        364      364.365 UME_303602_P11_WG06
## 1064        329   326.328329 UME_303602_P11_WE01
## 1073         92        92.93 UME_303602_P09_WE11
## 1099         66        66.67 UME_303602_P09_WD09
## 1109        627    627.62863 UME_303602_P13_WE11
## 1137        365      364.365 UME_303602_P11_WG06
## 1138        359   357.358359 UME_303602_P11_WG02
## 1152        326   326.328329 UME_303602_P11_WE01
## 1159      Wau-3      Wau-2.3                <NA>
## 1163        317      316.317 UME_303602_P11_WD05
## 1167        101      100.101 UME_303602_P09_WF06
## 1176        370       369.37 UME_303602_P12_WB09
## 1177        370       369.37 UME_303602_P12_WB09
## 1203        369       369.37 UME_303602_P12_WB09
## 1213        628    627.62863 UME_303602_P13_WE11
## 1218      Wau-2      Wau-2.3                <NA>
## 1219        112       112.21 UME_303602_P14_WD09
## 1248         46        46.47 UME_303602_P09_WC10
## 1261        112       112.21 UME_303602_P14_WD09
## 1264        210       112.21 UME_303602_P14_WD09
## 1269        248      248.991                <NA>
## 1271         70           68 UME_303602_P09_WD10
## 1273        312      316.317 UME_303602_P11_WD05
## 1278        628    627.62863 UME_303602_P13_WE11
## 1285        364      364.365 UME_303602_P11_WG06
## 1287         66        66.67 UME_303602_P09_WD09
## 1292         13       13.991                <NA>
## 1293      Wau-3      Wau-2.3                <NA>
## 1300        150          503                <NA>
## 1305        196          197 UME_303602_P10_WD12
## 1318        764          769 UME_303602_P14_WB10
## 1319        101      100.101 UME_303602_P09_WF06
## 1326         47        46.47 UME_303602_P09_WC10
## 1329        748      548.748 UME_303602_P14_WA09
## 1340        548      548.748 UME_303602_P14_WA09
## 1353        540       539.54 UME_303602_P13_WC03
## 1363        630    627.62863 UME_303602_P13_WE11
## 1371         39         39.4 UME_303602_P09_WC05
## 1373        317      316.317 UME_303602_P11_WD05
## 1376        100      100.101 UME_303602_P09_WF06
## 1392        370       369.37 UME_303602_P12_WB09
## 1393        370       369.37 UME_303602_P12_WB09
## 1399         95       95.991                <NA>
## 1403        326   326.328329 UME_303602_P11_WE01
## 1451         14       14.991                <NA>
## 1461        115      115.991                <NA>
## 1470        763          736 UME_303602_P14_WA01
## 1476        627    627.62863 UME_303602_P13_WE11
## 1483        336      336.991                <NA>
## 1484        387      387.993                <NA>
## 1496         27       26.991                <NA>
## 1530         28            7 UME_303602_P09_WA07
## 1536         92        92.93 UME_303602_P09_WE11
## 1547        338      338.341 UME_303602_P11_WE11
## 1568        365      364.365 UME_303602_P11_WG06
## 1592       PG-3         PI-3 UME_301101_P01_WH02
## 1593       PG-3         PI-3 UME_301101_P01_WH02
## 1596        197      196.999                <NA>
## 1600         40         39.4 UME_303602_P09_WC05
## 1606        210       112.21 UME_303602_P14_WD09
## 1607        328   326.328329 UME_303602_P11_WE01
## 1615        316      316.317 UME_303602_P11_WD05
## 1625      Wau-2      Wau-2.3                <NA>
## 1628         46        46.47 UME_303602_P09_WC10
## 1634        383      383.991                <NA>
## 1636        198      198.991                <NA>
## 1640         27       26.991                <NA>
## 1648        628    627.62863 UME_303602_P13_WE11
## 1660         29       29.991                <NA>
## 1671         40         39.4 UME_303602_P09_WC05
## 1674        365      364.365 UME_303602_P11_WG06
## 1681         27       26.991                <NA>
## 1683        748      548.748 UME_303602_P14_WA09
## 1686        338      338.341 UME_303602_P11_WE11
## 1687         66        66.67 UME_303602_P09_WD09
## 1690         67        66.67 UME_303602_P09_WD09
## 1700        112      112.991                <NA>
## NA         <NA>         <NA>                <NA>
## 1712        197          196 UME_303602_P10_WD11
## 1716        196          197 UME_303602_P10_WD12
## 1735        174      174.992                <NA>
## 1737        370       369.37 UME_303602_P12_WB09
## 1738        370       369.37 UME_303602_P12_WB09
## 1763        539       539.54 UME_303602_P13_WC03
## 1821          ?      338.341 UME_303602_P11_WE11
## 1830       <NA>          156 UME_303602_P10_WA10
## 1835        368      368.991                <NA>
## 1842         92        92.93 UME_303602_P09_WE11
## 1843         47        46.47 UME_303602_P09_WC10
## 1863        317      316.317 UME_303602_P11_WD05
## 1867        101      100.101 UME_303602_P09_WF06
## 1871        316      316.317 UME_303602_P11_WD05
## 1894        210       112.21 UME_303602_P14_WD09
## 1916          ?        Sau-1           Sau1-1B10
## 1920        334      334.991                <NA>
## 1923        316      316.317 UME_303602_P11_WD05
## 1925        100      100.101 UME_303602_P09_WF06
## 1928        336      336.991                <NA>
## 1933        150          503                <NA>
## 1935         92        92.93 UME_303602_P09_WE11
## 1936        326   326.328329 UME_303602_P11_WE01
## 1937         95       95.991                <NA>
## 1945       <NA>       93.991                <NA>
## 1946        518          517 UME_303602_P13_WB04
## 1949       PG-3         PI-3 UME_301101_P01_WH02
## 1950       PG-3         PI-3 UME_301101_P01_WH02
tmp %>% group_by(Genet.2014,Genet.SSRrev,GWA.ID) %>% tally()
## # A tibble: 81 x 4
## # Groups:   Genet.2014, Genet.SSRrev [81]
##    Genet.2014 Genet.SSRrev GWA.ID                  n
##    <fct>      <fct>        <fct>               <int>
##  1 ?          338.341      UME_303602_P11_WE11     1
##  2 ?          Sau-1        Sau1-1B10               1
##  3 100        100.101      UME_303602_P09_WF06     2
##  4 100        100.991      UME_303602_P09_WF05     2
##  5 101        100.101      UME_303602_P09_WF06     5
##  6 112        112.21       UME_303602_P14_WD09     4
##  7 112        112.991      <NA>                    1
##  8 115        115.991      <NA>                    1
##  9 13         13.991       <NA>                    1
## 10 14         14.991       <NA>                    1
## # … with 71 more rows

This also shows that, as of now (2019-05-15), the GWA IDs are assigned incorrectly (See Genet.2014 “100” and “101”).

## keep only SerialNO, Genet.SSRrev and GWA.ID
lookup.tab <- lookup.tab %>% 
  select(SerialNo,Genet.2014, Genet.SSRrev,GWA.ID, params$exclcol)
# load in full data
full.data <- data.env[[params$full.data]]
## index the lookup table rows that match full data SerialNo.
SN.index <- match(full.data$SerialNo,lookup.tab$SerialNo)

n.old <- nrow(full.data)
# re-assign the full gwa data file to the "full.data" identifier
full.data <- cbind(lookup.tab[SN.index,] %>% select(-SerialNo),
                   full.data %>% select(-Genet.SSRrev))
# check that n has not changed!
stopifnot(nrow(full.data) == n.old)

write phenotype and covariates file

Here, we’ll write the tab-separated phenos-and-covars.txt file as well as a .csv counterpart

write.csv(full.data,"data/phenos-and-covars.csv",row.names = FALSE)
write.table(full.data,"data/phenos-and-covars.txt",row.names = FALSE)

# copy data file to CHTC folder
system("cp data/phenos-and-covars.txt CHTC/data")

Example: here we will read the file, with only individual identifiers, common insects, and columns present in our trait data:

tmp <- fread("data/phenos-and-covars.txt",
             header = TRUE, 
             stringsAsFactors = TRUE,
      # only read in columns of interest       
      select = unique(c("SerialNo","GWA.ID","Genet", #identifiers
                 data.env$common.insects, #insects
                 names(data.env$trait.data) #trait data
                 )))

names(tmp);dim(tmp)
##  [1] "SerialNo"              "GWA.ID"               
##  [3] "Genet"                 "Harmandia"            
##  [5] "Phyllocolpa"           "Petiole.Gall"         
##  [7] "Leaf.Edge.Mine"        "Blotch.Mine"          
##  [9] "Lombardy.Mine"         "Weevil.Mine"          
## [11] "Blackmine"             "Cottonwood.Leaf.Mine" 
## [13] "Casebearer.Moth"       "Leafhoppers"          
## [15] "Green.Aphids"          "Smokey.Aphids"        
## [17] "Ants"                  "Pale.Green.Notodontid"
## [19] "Aspen.Leaf.Beetle"     "Green.Sawfly"         
## [21] "Cotton.Scale"          "Genet.SSRrev"         
## [23] "Latitude"              "Longitude"            
## [25] "Dist.Edge"             "Ploidy"               
## [27] "Hybrid.01"             "Hobs"                 
## [29] "PlantingYear"          "BA.2012"              
## [31] "Vol.2012"              "GrowLn.1516"          
## [33] "GrowLn.1617"           "GrowLn.1718"          
## [35] "GrowLn.1518"           "Sex.TEMP"             
## [37] "Venturia.2017"         "year"                 
## [39] "SLA"                   "ALA"                  
## [41] "CT"                    "PG"                   
## [43] "Npct"                  "CN"                   
## [45] "BA"                    "Vol"                  
## [47] "BBreakDegDay"          "FlTwigs"              
## [49] "Flprev"                "EFNMean"              
## [51] "LeafAreaSum"           "DiseaseEdgePct"       
## [53] "ScrapHolePct"          "DamagePct"            
## [55] "BA.2012sqrt"           "BAsqrt"               
## [57] "Age"
## [1] 6272   57

Prepare model selection data

Here we will prepare and save the data objects needed for model selection

mod.selection.env <- new.env()
# lists of names from full.data to use
mod.selection.env$all.vars <- names(full.data)
mod.selection.env$common.insects <- data.env$common.insects
mod.selection.env$all.insects <- data.env$all.insects
mod.selection.env$ins.func.grps <- c("Free.Feeding_cnt","Leaf.Modifying_cnt",
                                     "Wood.Modifying_cnt","ecto_cnt","endo_cnt")
mod.selection.env$environmental.vars <- c("Block","Dist.Edge",
                                           "Survey.Year","Survey.Month" #,"survey.event"
                                          )
mod.selection.env$weather.vars <- c("avg.temp_F","high.wind_mph")
mod.selection.env$tree.traits.of.interest <- c("Hobs","Age","BA.2012sqrt", #"BA.2012
                                               "Sex.TEMP","SLA","ALA",
                                               "CT","PG","Npct","CN",
                                               "BAsqrt","Vol", #"BA"
                                               "BBreakDegDay","Flprev"#,"FlTwigs",
                                               #"Genet.SSRrev"
                                               #"Latitude","Longitude"
                                               )
mod.selection.env$offset <- "Min.per.Tree"
mod.selection.env$all.covars <- c(mod.selection.env$environmental.vars,
                                  mod.selection.env$weather.vars,
                                  mod.selection.env$tree.traits.of.interest)
mod.selection.env$random.terms <- c("Survey.Year","Survey.Month","Genet.SSRrev")

## check that all variables are valid
stopifnot(
  all(mod.selection.env$ins.func.grps %in% names(full.data)) &
  all(mod.selection.env$environmental.vars %in% names(full.data)) &
  all(mod.selection.env$weather.vars %in% names(full.data)) &
  all(mod.selection.env$tree.traits.of.interest %in% names(full.data))
)



# save the objects
save(list = names(mod.selection.env),file = "data/variable-groups.RData", 
     envir = mod.selection.env)

## and to the CHTC folder
# save(list = names(mod.selection.env),file = "CHTC/data/variable-groups.RData", 
#      envir = mod.selection.env)

# create all combinations of variables
# len <- length(mod.selection.env$all.covars)
len = length(mod.selection.env$all.covars[! mod.selection.env$all.covars %in% 
                                            mod.selection.env$weather.vars])
# my computer can't do this part:
all.models <- as.data.frame(expand.grid(replicate(len, c(TRUE,FALSE),simplify = FALSE)))
names(all.models) <- mod.selection.env$all.covars[! mod.selection.env$all.covars %in% 
                                                      mod.selection.env$weather.vars]
all.models$model.names <- paste0("model.",1:nrow(all.models))
write.table(all.models,file = "data/model-variable-inclusions.txt",row.names = FALSE)
# write.table(all.models,file = "CHTC/data/model-variable-inclusions.txt",row.names = FALSE)

This R code is used by this model selection script

Pipeline:

Exhaustive model selection will be done on UW-Madison’s CHTC (high-throughput computing center) which uses a job-handling program called HTCondor.

The job submission (.sub) file for HTCondor is here and it’s purpose is to run as many tasks (models, in our case) in the shortest amount of time. For our models, we are considering 18 terms + Genet as predictor variables. Therefore, there are \(2^{18} = 2.62144\times 10^{5}\) possible models for each of our 18 insect response variables for a total of \(2^{18}\times18=4.718592\times 10^{6}\) models. Therefore, it is very important to parallelize the process.

the model-selection-submission.sub (HTCondor_files/) file executes run-model-selection.sh, which then calls model-selection-script.R (both in scripts/), passing the arguments from the “arguments” fields to each script. Currently, the submission file is set to run 9438 jobs, each of which will fit 500 models. Each job will create a .csv file called <insect>_proc<job>_mods<first.model>-<last.model>.csv. These csv files will each contain 500 rows.

In order to combine all csv files for a given insect, use:

bash `scripts/stack-CHTC-csv-files.sh` <insect>

Extract Covariates for Each insect

This step uses the result of model the model selection step (REFERENCE NEEDED) to determine which covariates should be included in each insect GWA model.

# Get the results:
results.folder <- "CHTC/output/full-run_27-May/full-run_27-May"
insect.folders = list.files(file.path(results.folder,"Insects-specific-results"))

for(i in 1:length(insect.folders)){
## current insect
insect <-  insect.folders[i]
## current file
file.location = file.path(results.folder,"Top-30-AIC",
                          paste0(insect,"-top-models.csv")
)
# Read in the files and remove duplicated rows
TOP.mods <- read.csv(file.location)
names(TOP.mods)[1] <- "model.names"
TOP.mods <- TOP.mods %>% distinct

# Get the variable table for each model
model.table <- NULL # empy frame
## read in each model row individually and then combine (speed)
for(j in TOP.mods$model.row){
  row.j <- fread("CHTC/data/model-variable-inclusions.txt",
                 header = FALSE, skip = j, nrows = 1)
  model.table <- rbind(model.table,row.j)
}
# add the column names to the model table
names(model.table) <- unname(unlist(
  fread("CHTC/data/model-variable-inclusions.txt",
        nrows = 1, header = FALSE)
))
# relevel the model names according to decreasing AIC
lvls <- TOP.mods[order(TOP.mods$AIC,decreasing = FALSE),"model.names"]
model.table$model.names <- factor(model.table$model.names, levels = lvls)

# Print the AIC of the top models
top.aic = min(TOP.mods$AIC)
full.mod <- TOP.mods %>% filter(model.row == 1)
full.aic = full.mod$AIC
top.table <- TOP.mods %>% select(model.names,AIC) %>% 
  mutate("dif.frm.top" = abs(AIC - top.aic) >= 2,
         "dif.frm.full" = abs(AIC - full.aic) >= 2)

sig.col <- ifelse(top.table$dif.frm.top,yes = "plain",no = "bold")

# Plot a variable plot of the top 30 models (plus the full model)
library(ggplot2)
  g <- ggplot(data = melt(model.table, id.vars = "model.names"), 
       aes(x = variable, y = model.names)) + 
  labs(y = "model", subtitle = paste("Top 30 Models by AIC for",insect)) +
  geom_tile(aes(fill = value), colour = "white") + 
  theme(axis.text.x = element_text(angle = 35, vjust = 1, hjust = 1),
        axis.text.y = element_text(face = sig.col),
        axis.text = element_text(face = "bold",size = 10, colour = "black"),
        text = element_text(face = "bold",colour = "black",size = 12),
        legend.key = element_rect(colour = "black")) +
  scale_fill_manual(values = c("TRUE" = "black", "FALSE" = "white"))

  print(top.table)
  plot(g)
}
## Registered S3 methods overwritten by 'ggplot2':
##   method         from 
##   [.quosures     rlang
##   c.quosures     rlang
##   print.quosures rlang
##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.230065 6794.285       FALSE         TRUE
## 2  model.230129 6794.369       FALSE         TRUE
## 3  model.197297 6794.700       FALSE         TRUE
## 4  model.197361 6794.891       FALSE         TRUE
## 5  model.229937 6794.904       FALSE         TRUE
## 6  model.230385 6794.999       FALSE         TRUE
## 7  model.230001 6795.114       FALSE         TRUE
## 8  model.197169 6795.133       FALSE         TRUE
## 9  model.230321 6795.292       FALSE         TRUE
## 10 model.197233 6795.459       FALSE         TRUE
## 11 model.230257 6795.564       FALSE         TRUE
## 12 model.246449 6795.656       FALSE         TRUE
## 13 model.197617 6795.675       FALSE         TRUE
## 14 model.230193 6795.722       FALSE         TRUE
## 15 model.230049 6795.764       FALSE         TRUE
## 16 model.229553 6795.765       FALSE         TRUE
## 17 model.229617 6795.860       FALSE         TRUE
## 18 model.197553 6795.888       FALSE         TRUE
## 19 model.230113 6795.896       FALSE         TRUE
## 20 model.230033 6795.983       FALSE         TRUE
## 21 model.197265 6796.008       FALSE         TRUE
## 22 model.197489 6796.065       FALSE         TRUE
## 23  model.99057 6796.100       FALSE         TRUE
## 24  model.98993 6796.114       FALSE         TRUE
## 25 model.197425 6796.135       FALSE         TRUE
## 26 model.229425 6796.190       FALSE         TRUE
## 27 model.246321 6796.204       FALSE         TRUE
## 28 model.197281 6796.205       FALSE         TRUE
## 29 model.196785 6796.224       FALSE         TRUE
## 30 model.164529 6796.284       FALSE         TRUE
## 31      model.1 6802.838        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1   model.45681 2756.252       FALSE         TRUE
## 2   model.45617 2756.816       FALSE         TRUE
## 3  model.111217 2757.510       FALSE         TRUE
## 4  model.176753 2757.605       FALSE         TRUE
## 5   model.45689 2757.716       FALSE         TRUE
## 6   model.41585 2757.751       FALSE         TRUE
## 7   model.37489 2757.953       FALSE         TRUE
## 8   model.45169 2758.071       FALSE         TRUE
## 9   model.12913 2758.093       FALSE         TRUE
## 10  model.45649 2758.152       FALSE         TRUE
## 11  model.45665 2758.178       FALSE         TRUE
## 12 model.111153 2758.208       FALSE         TRUE
## 13  model.45625 2758.234       FALSE         TRUE
## 14  model.41521 2758.272        TRUE         TRUE
## 15  model.37425 2758.480        TRUE         TRUE
## 16 model.176689 2758.578        TRUE         TRUE
## 17  model.45105 2758.673        TRUE         TRUE
## 18  model.12849 2758.724        TRUE         TRUE
## 19  model.45601 2758.742        TRUE         TRUE
## 20  model.45585 2758.806        TRUE         TRUE
## 21 model.107121 2758.838        TRUE         TRUE
## 22 model.176761 2758.942        TRUE         TRUE
## 23 model.103025 2759.028        TRUE         TRUE
## 24 model.172657 2759.135        TRUE         TRUE
## 25  model.78449 2759.196        TRUE         TRUE
## 26 model.110705 2759.304        TRUE         TRUE
## 27 model.168561 2759.335        TRUE         TRUE
## 28 model.242289 2759.350        TRUE         TRUE
## 29  model.33401 2759.374        TRUE         TRUE
## 30 model.111185 2759.409        TRUE         TRUE
## 31      model.1 2767.650        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.205747 3794.420       FALSE         TRUE
## 2  model.205235 3794.706       FALSE         TRUE
## 3  model.205107 3794.927       FALSE         TRUE
## 4  model.205619 3794.974       FALSE         TRUE
## 5  model.209843 3795.248       FALSE         TRUE
## 6  model.201651 3795.373       FALSE         TRUE
## 7  model.205715 3795.598       FALSE         TRUE
## 8  model.238515 3795.615       FALSE         TRUE
## 9  model.209715 3795.684       FALSE         TRUE
## 10 model.201139 3795.775       FALSE         TRUE
## 11 model.209331 3795.807       FALSE         TRUE
## 12 model.238003 3795.855       FALSE         TRUE
## 13 model.201523 3795.868       FALSE         TRUE
## 14 model.205203 3795.885       FALSE         TRUE
## 15 model.209203 3795.929       FALSE         TRUE
## 16 model.201011 3795.941       FALSE         TRUE
## 17 model.205731 3795.966       FALSE         TRUE
## 18 model.197555 3795.973       FALSE         TRUE
## 19  model.74675 3795.991       FALSE         TRUE
## 20 model.237875 3796.100       FALSE         TRUE
## 21 model.205745 3796.105       FALSE         TRUE
## 22 model.197043 3796.178       FALSE         TRUE
## 23 model.238387 3796.195       FALSE         TRUE
## 24 model.205075 3796.204       FALSE         TRUE
## 25 model.205491 3796.216       FALSE         TRUE
## 26 model.242611 3796.229       FALSE         TRUE
## 27 model.205587 3796.247       FALSE         TRUE
## 28  model.74163 3796.291       FALSE         TRUE
## 29 model.140211 3796.406       FALSE         TRUE
## 30 model.196915 3796.446        TRUE         TRUE
## 31      model.1 3806.702        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.102369 3490.719       FALSE         TRUE
## 2  model.102337 3491.006       FALSE         TRUE
## 3  model.233441 3491.325       FALSE         TRUE
## 4  model.233409 3491.692       FALSE         TRUE
## 5  model.101857 3491.958       FALSE         TRUE
## 6  model.101825 3492.247       FALSE         TRUE
## 7   model.69569 3492.313       FALSE         TRUE
## 8  model.100321 3492.438       FALSE         TRUE
## 9   model.69601 3492.442       FALSE         TRUE
## 10 model.232929 3492.524       FALSE         TRUE
## 11 model.102385 3492.567       FALSE         TRUE
## 12 model.102113 3492.595       FALSE         TRUE
## 13 model.101345 3492.674       FALSE         TRUE
## 14 model.102305 3492.713       FALSE         TRUE
## 15 model.233457 3492.715       FALSE         TRUE
## 16  model.36833 3492.718       FALSE         TRUE
## 17 model.100289 3492.723        TRUE         TRUE
## 18 model.102353 3492.812        TRUE         TRUE
## 19 model.102273 3492.841        TRUE         TRUE
## 20 model.232897 3492.893        TRUE         TRUE
## 21 model.102081 3492.915        TRUE         TRUE
## 22 model.101313 3492.945        TRUE         TRUE
## 23  model.36801 3493.005        TRUE         TRUE
## 24 model.231393 3493.022        TRUE         TRUE
## 25 model.233425 3493.039        TRUE         TRUE
## 26 model.200641 3493.087        TRUE         TRUE
## 27 model.200673 3493.094        TRUE         TRUE
## 28 model.233185 3493.230        TRUE         TRUE
## 29 model.232417 3493.275        TRUE         TRUE
## 30 model.167905 3493.301        TRUE         TRUE
## 31      model.1 3506.191        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.178680 5019.073       FALSE         TRUE
## 2  model.178616 5019.173       FALSE         TRUE
## 3  model.178676 5020.033       FALSE         TRUE
## 4  model.178360 5020.224       FALSE         TRUE
## 5  model.178420 5020.269       FALSE         TRUE
## 6  model.178615 5020.326       FALSE         TRUE
## 7  model.174584 5020.358       FALSE         TRUE
## 8  model.178678 5020.504       FALSE         TRUE
## 9  model.170488 5020.614       FALSE         TRUE
## 10 model.178424 5020.657       FALSE         TRUE
## 11 model.174520 5020.690       FALSE         TRUE
## 12 model.145912 5020.716       FALSE         TRUE
## 13 model.178614 5020.719       FALSE         TRUE
## 14 model.145848 5020.825       FALSE         TRUE
## 15 model.170424 5020.860       FALSE         TRUE
## 16 model.176632 5020.984       FALSE         TRUE
## 17 model.176568 5020.989       FALSE         TRUE
## 18 model.178648 5021.050       FALSE         TRUE
## 19 model.178584 5021.055       FALSE         TRUE
## 20  model.47608 5021.064       FALSE         TRUE
## 21 model.178664 5021.072       FALSE         TRUE
## 22  model.47544 5021.141        TRUE         TRUE
## 23 model.178418 5021.162        TRUE         TRUE
## 24 model.178600 5021.170        TRUE         TRUE
## 25 model.178674 5021.262        TRUE         TRUE
## 26 model.244216 5021.283        TRUE         TRUE
## 27 model.178679 5021.299        TRUE         TRUE
## 28 model.178644 5021.449        TRUE         TRUE
## 29 model.179704 5021.512        TRUE         TRUE
## 30 model.178359 5021.521        TRUE         TRUE
## 31      model.1 5041.753        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.146674 2687.060       FALSE         TRUE
## 2  model.146641 2687.397       FALSE         TRUE
## 3   model.15602 2687.411       FALSE         TRUE
## 4  model.146642 2687.484       FALSE         TRUE
## 5  model.146676 2687.498       FALSE         TRUE
## 6  model.146673 2687.578       FALSE         TRUE
## 7   model.15570 2687.689       FALSE         TRUE
## 8  model.145650 2687.774       FALSE         TRUE
## 9   model.15569 2687.825       FALSE         TRUE
## 10 model.146643 2687.831       FALSE         TRUE
## 11 model.146644 2687.879       FALSE         TRUE
## 12  model.15604 2687.930       FALSE         TRUE
## 13 model.145617 2687.941       FALSE         TRUE
## 14 model.146675 2688.052       FALSE         TRUE
## 15 model.145649 2688.066       FALSE         TRUE
## 16 model.147186 2688.133       FALSE         TRUE
## 17  model.15601 2688.141       FALSE         TRUE
## 18  model.15572 2688.167       FALSE         TRUE
## 19  model.14578 2688.173       FALSE         TRUE
## 20 model.147188 2688.243       FALSE         TRUE
## 21 model.145618 2688.264       FALSE         TRUE
## 22 model.146578 2688.278       FALSE         TRUE
## 23  model.15571 2688.329       FALSE         TRUE
## 24  model.14545 2688.424       FALSE         TRUE
## 25 model.145652 2688.498       FALSE         TRUE
## 26 model.147153 2688.509       FALSE         TRUE
## 27  model.14546 2688.519       FALSE         TRUE
## 28  model.16114 2688.562       FALSE         TRUE
## 29 model.147155 2688.596       FALSE         TRUE
## 30 model.147185 2688.599       FALSE         TRUE
## 31      model.1 2701.331        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.179188 3168.667       FALSE         TRUE
## 2  model.177908 3168.743       FALSE         TRUE
## 3  model.177140 3168.759       FALSE         TRUE
## 4  model.178164 3168.799       FALSE         TRUE
## 5  model.166900 3169.148       FALSE         TRUE
## 6  model.146420 3169.506       FALSE         TRUE
## 7  model.177396 3169.578       FALSE         TRUE
## 8  model.176628 3169.627       FALSE         TRUE
## 9  model.144372 3169.675       FALSE         TRUE
## 10 model.176884 3169.700       FALSE         TRUE
## 11 model.178676 3169.748       FALSE         TRUE
## 12 model.177652 3169.809       FALSE         TRUE
## 13 model.170996 3169.822       FALSE         TRUE
## 14 model.194548 3169.855       FALSE         TRUE
## 15 model.145140 3169.886       FALSE         TRUE
## 16 model.145396 3169.887       FALSE         TRUE
## 17 model.194036 3169.995       FALSE         TRUE
## 18 model.166388 3170.094       FALSE         TRUE
## 19  model.48116 3170.125       FALSE         TRUE
## 20 model.178932 3170.190       FALSE         TRUE
## 21 model.243444 3170.255       FALSE         TRUE
## 22 model.161780 3170.294       FALSE         TRUE
## 23  model.46836 3170.302       FALSE         TRUE
## 24  model.46068 3170.315       FALSE         TRUE
## 25 model.194484 3170.341       FALSE         TRUE
## 26 model.166644 3170.376       FALSE         TRUE
## 27 model.168948 3170.398       FALSE         TRUE
## 28 model.194516 3170.408       FALSE         TRUE
## 29 model.183284 3170.415       FALSE         TRUE
## 30  model.47092 3170.417       FALSE         TRUE
## 31      model.1 3189.619        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.231093 3633.947       FALSE         TRUE
## 2  model.100021 3634.026       FALSE         TRUE
## 3   model.67253 3634.207       FALSE         TRUE
## 4  model.198325 3634.315       FALSE         TRUE
## 5  model.230581 3634.445       FALSE         TRUE
## 6  model.165557 3634.479       FALSE         TRUE
## 7   model.99509 3634.626       FALSE         TRUE
## 8   model.34485 3634.639       FALSE         TRUE
## 9   model.66741 3634.794       FALSE         TRUE
## 10 model.165045 3634.829       FALSE         TRUE
## 11 model.231061 3634.840       FALSE         TRUE
## 12 model.197813 3634.856       FALSE         TRUE
## 13 model.165525 3634.982       FALSE         TRUE
## 14  model.99989 3634.992       FALSE         TRUE
## 15 model.132789 3635.033       FALSE         TRUE
## 16  model.33973 3635.128       FALSE         TRUE
## 17 model.230069 3635.160       FALSE         TRUE
## 18 model.232117 3635.160       FALSE         TRUE
## 19 model.101045 3635.185       FALSE         TRUE
## 20 model.231605 3635.255       FALSE         TRUE
## 21  model.34453 3635.281       FALSE         TRUE
## 22   model.1717 3635.292       FALSE         TRUE
## 23  model.98997 3635.303       FALSE         TRUE
## 24 model.100533 3635.444       FALSE         TRUE
## 25 model.132277 3635.464       FALSE         TRUE
## 26 model.198293 3635.496       FALSE         TRUE
## 27 model.230549 3635.499       FALSE         TRUE
## 28  model.66229 3635.528       FALSE         TRUE
## 29  model.68277 3635.538       FALSE         TRUE
## 30 model.165013 3635.578       FALSE         TRUE
## 31      model.1 3686.772        TRUE        FALSE

##    model.names      AIC dif.frm.top dif.frm.full
## 1  model.81649 2881.442       FALSE         TRUE
## 2  model.81633 2881.773       FALSE         TRUE
## 3  model.81905 2882.071       FALSE         TRUE
## 4  model.81889 2882.366       FALSE         TRUE
## 5  model.79601 2882.576       FALSE         TRUE
## 6  model.78561 2882.819       FALSE         TRUE
## 7  model.78577 2882.840       FALSE         TRUE
## 8  model.81521 2882.892       FALSE         TRUE
## 9  model.79585 2882.907       FALSE         TRUE
## 10 model.66273 2883.067       FALSE         TRUE
## 11 model.80625 2883.087       FALSE         TRUE
## 12 model.81585 2883.104       FALSE         TRUE
## 13 model.81137 2883.119       FALSE         TRUE
## 14 model.81505 2883.146       FALSE         TRUE
## 15 model.66289 2883.246       FALSE         TRUE
## 16 model.77553 2883.278       FALSE         TRUE
## 17 model.81121 2883.286       FALSE         TRUE
## 18 model.80609 2883.289       FALSE         TRUE
## 19 model.81569 2883.421       FALSE         TRUE
## 20 model.79857 2883.423       FALSE         TRUE
## 21 model.73457 2883.427       FALSE         TRUE
## 22 model.81617 2883.427       FALSE         TRUE
## 23 model.16113 2883.442       FALSE         TRUE
## 24 model.81777 2883.548        TRUE         TRUE
## 25 model.77537 2883.572        TRUE         TRUE
## 26 model.81841 2883.572        TRUE         TRUE
## 27 model.79841 2883.718        TRUE         TRUE
## 28 model.73441 2883.745        TRUE         TRUE
## 29 model.81601 2883.753        TRUE         TRUE
## 30 model.16097 2883.765        TRUE         TRUE
## 31     model.1 2891.832        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.164587 5936.220       FALSE         TRUE
## 2   model.33515 5936.803       FALSE         TRUE
## 3  model.164459 5937.115       FALSE         TRUE
## 4  model.164585 5937.330       FALSE         TRUE
## 5  model.131819 5937.414       FALSE         TRUE
## 6  model.164075 5937.626       FALSE         TRUE
## 7     model.747 5937.878       FALSE         TRUE
## 8  model.164523 5937.901       FALSE         TRUE
## 9   model.33513 5937.901       FALSE         TRUE
## 10  model.33387 5937.987       FALSE         TRUE
## 11 model.164603 5938.020       FALSE         TRUE
## 12 model.164555 5938.105       FALSE         TRUE
## 13 model.164457 5938.135       FALSE         TRUE
## 14  model.33003 5938.224        TRUE         TRUE
## 15 model.163947 5938.308        TRUE         TRUE
## 16 model.131691 5938.334        TRUE         TRUE
## 17 model.131817 5938.492        TRUE         TRUE
## 18  model.33451 5938.558        TRUE         TRUE
## 19 model.164395 5938.679        TRUE         TRUE
## 20  model.33483 5938.699        TRUE         TRUE
## 21 model.164073 5938.826        TRUE         TRUE
## 22 model.131307 5938.853        TRUE         TRUE
## 23 model.164521 5938.883        TRUE         TRUE
## 24  model.33531 5938.906        TRUE         TRUE
## 25    model.745 5938.924        TRUE         TRUE
## 26 model.164427 5938.946        TRUE         TRUE
## 27  model.33385 5939.000        TRUE         TRUE
## 28 model.164601 5939.040        TRUE         TRUE
## 29 model.131755 5939.043        TRUE         TRUE
## 30    model.619 5939.083        TRUE         TRUE
## 31      model.1 5964.450        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.176369 4277.768       FALSE         TRUE
## 2  model.176305 4278.343       FALSE         TRUE
## 3  model.143601 4278.481       FALSE         TRUE
## 4  model.179697 4278.635       FALSE         TRUE
## 5  model.178673 4278.899       FALSE         TRUE
## 6  model.176625 4278.921       FALSE         TRUE
## 7  model.178417 4278.927       FALSE         TRUE
## 8  model.143537 4279.095       FALSE         TRUE
## 9  model.176561 4279.173       FALSE         TRUE
## 10 model.179633 4279.296       FALSE         TRUE
## 11 model.178609 4279.359       FALSE         TRUE
## 12 model.176353 4279.520       FALSE         TRUE
## 13 model.179441 4279.526       FALSE         TRUE
## 14 model.178353 4279.667       FALSE         TRUE
## 15 model.146929 4279.690       FALSE         TRUE
## 16 model.176337 4279.723       FALSE         TRUE
## 17  model.45297 4279.750       FALSE         TRUE
## 18 model.143857 4279.764       FALSE         TRUE
## 19 model.172273 4279.768       FALSE         TRUE
## 20 model.168177 4279.768       FALSE         TRUE
## 21 model.145649 4279.788        TRUE         TRUE
## 22 model.145905 4279.835        TRUE         TRUE
## 23 model.171505 4280.017        TRUE         TRUE
## 24 model.143793 4280.049        TRUE         TRUE
## 25 model.176289 4280.116        TRUE         TRUE
## 26 model.177649 4280.184        TRUE         TRUE
## 27 model.179681 4280.186        TRUE         TRUE
## 28 model.143585 4280.245        TRUE         TRUE
## 29 model.143569 4280.282        TRUE         TRUE
## 30  model.45233 4280.297        TRUE         TRUE
## 31      model.1 4292.093        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.142481 6976.995       FALSE         TRUE
## 2  model.142737 6977.010       FALSE         TRUE
## 3  model.140433 6977.301       FALSE         TRUE
## 4  model.142513 6977.486       FALSE         TRUE
## 5  model.142769 6977.543       FALSE         TRUE
## 6  model.140689 6977.694       FALSE         TRUE
## 7  model.140465 6977.733       FALSE         TRUE
## 8  model.175505 6977.774       FALSE         TRUE
## 9  model.175249 6977.852       FALSE         TRUE
## 10 model.139409 6977.998       FALSE         TRUE
## 11 model.140721 6978.177       FALSE         TRUE
## 12 model.173201 6978.227       FALSE         TRUE
## 13 model.140945 6978.290       FALSE         TRUE
## 14  model.11409 6978.450       FALSE         TRUE
## 15  model.11665 6978.490       FALSE         TRUE
## 16 model.173457 6978.513       FALSE         TRUE
## 17 model.139441 6978.535       FALSE         TRUE
## 18 model.140977 6978.658       FALSE         TRUE
## 19 model.142993 6978.660       FALSE         TRUE
## 20 model.134289 6978.683       FALSE         TRUE
## 21 model.143249 6978.728       FALSE         TRUE
## 22 model.141201 6978.808       FALSE         TRUE
## 23   model.9361 6978.812       FALSE         TRUE
## 24 model.134545 6978.844       FALSE         TRUE
## 25 model.142465 6978.864       FALSE         TRUE
## 26 model.142721 6978.872       FALSE         TRUE
## 27 model.141457 6978.905       FALSE         TRUE
## 28  model.11441 6978.935       FALSE         TRUE
## 29 model.172177 6978.954       FALSE         TRUE
## 30 model.141713 6979.009        TRUE         TRUE
## 31      model.1 6986.899        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.172769 6460.802       FALSE         TRUE
## 2  model.172785 6461.239       FALSE         TRUE
## 3  model.172705 6461.287       FALSE         TRUE
## 4  model.172257 6461.330       FALSE         TRUE
## 5  model.172273 6461.414       FALSE         TRUE
## 6  model.172721 6461.649       FALSE         TRUE
## 7  model.140001 6461.661       FALSE         TRUE
## 8  model.172193 6461.770       FALSE         TRUE
## 9  model.172209 6461.780       FALSE         TRUE
## 10 model.140017 6462.064       FALSE         TRUE
## 11 model.164577 6462.085       FALSE         TRUE
## 12 model.139937 6462.107       FALSE         TRUE
## 13 model.139489 6462.115       FALSE         TRUE
## 14 model.139505 6462.157       FALSE         TRUE
## 15 model.139953 6462.433       FALSE         TRUE
## 16 model.139441 6462.480       FALSE         TRUE
## 17 model.139425 6462.515       FALSE         TRUE
## 18 model.164593 6462.530       FALSE         TRUE
## 19 model.164065 6462.537       FALSE         TRUE
## 20 model.164513 6462.547       FALSE         TRUE
## 21 model.164081 6462.619       FALSE         TRUE
## 22 model.172737 6462.620       FALSE         TRUE
## 23 model.131809 6462.724       FALSE         TRUE
## 24  model.41697 6462.794       FALSE         TRUE
## 25 model.164529 6462.917        TRUE         TRUE
## 26 model.164001 6462.950        TRUE         TRUE
## 27 model.164017 6462.958        TRUE         TRUE
## 28 model.172753 6463.040        TRUE         TRUE
## 29 model.131297 6463.080        TRUE         TRUE
## 30 model.131313 6463.115        TRUE         TRUE
## 31      model.1 6470.916        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1   model.80689 3788.530       FALSE         TRUE
## 2   model.80657 3788.645       FALSE         TRUE
## 3  model.129809 3788.821       FALSE         TRUE
## 4   model.81713 3788.911       FALSE         TRUE
## 5   model.81681 3788.926       FALSE         TRUE
## 6   model.81745 3789.401       FALSE         TRUE
## 7   model.80721 3789.406       FALSE         TRUE
## 8   model.81841 3789.675       FALSE         TRUE
## 9  model.130833 3789.683       FALSE         TRUE
## 10  model.80817 3789.717       FALSE         TRUE
## 11  model.81809 3789.813       FALSE         TRUE
## 12  model.79665 3789.842       FALSE         TRUE
## 13  model.79633 3789.893       FALSE         TRUE
## 14 model.113425 3789.900       FALSE         TRUE
## 15  model.77585 3789.942       FALSE         TRUE
## 16  model.80785 3789.945       FALSE         TRUE
## 17  model.73489 3789.996       FALSE         TRUE
## 18  model.77617 3790.024       FALSE         TRUE
## 19 model.113489 3790.064       FALSE         TRUE
## 20  model.73521 3790.065       FALSE         TRUE
## 21  model.81873 3790.070       FALSE         TRUE
## 22 model.114513 3790.140       FALSE         TRUE
## 23  model.15153 3790.153       FALSE         TRUE
## 24  model.76593 3790.161       FALSE         TRUE
## 25 model.129937 3790.198       FALSE         TRUE
## 26  model.76561 3790.204       FALSE         TRUE
## 27 model.122641 3790.241       FALSE         TRUE
## 28 model.114449 3790.246       FALSE         TRUE
## 29 model.125713 3790.266       FALSE         TRUE
## 30  model.72497 3790.277       FALSE         TRUE
## 31      model.1 3801.333        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.230549 3886.851       FALSE         TRUE
## 2  model.232597 3887.065       FALSE         TRUE
## 3  model.231573 3887.651       FALSE         TRUE
## 4   model.99477 3887.898       FALSE         TRUE
## 5  model.101525 3888.155       FALSE         TRUE
## 6  model.165013 3888.332       FALSE         TRUE
## 7  model.197781 3888.443       FALSE         TRUE
## 8  model.229525 3888.449       FALSE         TRUE
## 9  model.199829 3888.709       FALSE         TRUE
## 10 model.100501 3888.709       FALSE         TRUE
## 11 model.230533 3888.812       FALSE         TRUE
## 12 model.167061 3888.841       FALSE         TRUE
## 13 model.232581 3889.083        TRUE         TRUE
## 14  model.33941 3889.347        TRUE         TRUE
## 15 model.166037 3889.432        TRUE         TRUE
## 16 model.198805 3889.444        TRUE         TRUE
## 17  model.98453 3889.508        TRUE         TRUE
## 18 model.231557 3889.656        TRUE         TRUE
## 19  model.66709 3889.720        TRUE         TRUE
## 20  model.35989 3889.880        TRUE         TRUE
## 21  model.99461 3889.881        TRUE         TRUE
## 22 model.230421 3889.924        TRUE         TRUE
## 23  model.68757 3889.936        TRUE         TRUE
## 24 model.163989 3890.000        TRUE         TRUE
## 25 model.132245 3890.014        TRUE         TRUE
## 26 model.101509 3890.152        TRUE         TRUE
## 27 model.196757 3890.162        TRUE         TRUE
## 28 model.232469 3890.201        TRUE         TRUE
## 29 model.164997 3890.306        TRUE         TRUE
## 30 model.197765 3890.429        TRUE         TRUE
## 31      model.1 4014.484        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.133817 6299.384       FALSE         TRUE
## 2    model.2745 6299.912       FALSE         TRUE
## 3  model.133801 6299.954       FALSE         TRUE
## 4  model.133881 6300.061       FALSE         TRUE
## 5    model.2729 6300.281       FALSE         TRUE
## 6    model.2809 6300.307       FALSE         TRUE
## 7  model.133865 6300.672       FALSE         TRUE
## 8    model.2793 6300.709       FALSE         TRUE
## 9  model.131769 6301.000       FALSE         TRUE
## 10 model.133785 6301.342       FALSE         TRUE
## 11 model.133305 6301.357       FALSE         TRUE
## 12    model.697 6301.462        TRUE         TRUE
## 13 model.131753 6301.493        TRUE         TRUE
## 14 model.133849 6301.585        TRUE         TRUE
## 15 model.131833 6301.703        TRUE         TRUE
## 16    model.681 6301.794        TRUE         TRUE
## 17   model.2233 6301.852        TRUE         TRUE
## 18 model.133689 6301.853        TRUE         TRUE
## 19   model.2777 6301.860        TRUE         TRUE
## 20   model.2713 6301.863        TRUE         TRUE
## 21 model.133769 6301.887        TRUE         TRUE
## 22    model.761 6301.899        TRUE         TRUE
## 23 model.133289 6301.914        TRUE         TRUE
## 24 model.133369 6302.030        TRUE         TRUE
## 25   model.2617 6302.045        TRUE         TRUE
## 26 model.133833 6302.174        TRUE         TRUE
## 27   model.2697 6302.233        TRUE         TRUE
## 28   model.2217 6302.257        TRUE         TRUE
## 29   model.2297 6302.260        TRUE         TRUE
## 30   model.2761 6302.261        TRUE         TRUE
## 31      model.1 6446.457        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.179347 3000.833       FALSE         TRUE
## 2  model.179859 3001.507       FALSE         TRUE
## 3  model.179345 3001.530       FALSE         TRUE
## 4   model.48275 3001.730       FALSE         TRUE
## 5  model.196307 3001.884       FALSE         TRUE
## 6  model.195795 3001.968       FALSE         TRUE
## 7  model.179857 3001.978       FALSE         TRUE
## 8  model.179411 3001.978       FALSE         TRUE
## 9  model.244883 3001.996       FALSE         TRUE
## 10 model.171155 3002.304       FALSE         TRUE
## 11 model.178323 3002.329       FALSE         TRUE
## 12  model.48273 3002.394       FALSE         TRUE
## 13 model.162963 3002.399       FALSE         TRUE
## 14 model.175251 3002.489       FALSE         TRUE
## 15  model.48787 3002.497       FALSE         TRUE
## 16 model.179331 3002.589       FALSE         TRUE
## 17 model.163027 3002.605       FALSE         TRUE
## 18 model.113811 3002.612       FALSE         TRUE
## 19 model.179923 3002.625       FALSE         TRUE
## 20 model.163475 3002.653       FALSE         TRUE
## 21 model.244881 3002.700       FALSE         TRUE
## 22 model.177299 3002.704       FALSE         TRUE
## 23  model.64723 3002.780       FALSE         TRUE
## 24 model.245395 3002.795       FALSE         TRUE
## 25 model.146579 3002.819       FALSE         TRUE
## 26 model.196305 3002.835        TRUE         TRUE
## 27  model.65235 3002.851        TRUE         TRUE
## 28  model.48785 3002.925        TRUE         TRUE
## 29 model.179409 3002.981        TRUE         TRUE
## 30 model.163539 3003.003        TRUE         TRUE
## 31      model.1 3016.859        TRUE        FALSE

##     model.names      AIC dif.frm.top dif.frm.full
## 1  model.146929 2702.395       FALSE         TRUE
## 2  model.212465 2702.816       FALSE         TRUE
## 3  model.146913 2703.708       FALSE         TRUE
## 4  model.146865 2703.725       FALSE         TRUE
## 5  model.144881 2703.793       FALSE         TRUE
## 6  model.138737 2703.863       FALSE         TRUE
## 7  model.212449 2703.898       FALSE         TRUE
## 8  model.142833 2703.950       FALSE         TRUE
## 9   model.15857 2703.983       FALSE         TRUE
## 10 model.212401 2704.075       FALSE         TRUE
## 11  model.81393 2704.200       FALSE         TRUE
## 12 model.146673 2704.214       FALSE         TRUE
## 13 model.145905 2704.239       FALSE         TRUE
## 14 model.146897 2704.282       FALSE         TRUE
## 15 model.204273 2704.368       FALSE         TRUE
## 16 model.208369 2704.395       FALSE         TRUE
## 17 model.210417 2704.510        TRUE         TRUE
## 18 model.211441 2704.668        TRUE         TRUE
## 19 model.212433 2704.678        TRUE         TRUE
## 20 model.212209 2704.775        TRUE         TRUE
## 21 model.146849 2705.065        TRUE         TRUE
## 22 model.144865 2705.089        TRUE         TRUE
## 23 model.143857 2705.093        TRUE         TRUE
## 24 model.138721 2705.117        TRUE         TRUE
## 25 model.144817 2705.151        TRUE         TRUE
## 26 model.212385 2705.195        TRUE         TRUE
## 27 model.142817 2705.220        TRUE         TRUE
## 28 model.138673 2705.263        TRUE         TRUE
## 29 model.146833 2705.271        TRUE         TRUE
## 30 model.142769 2705.342        TRUE         TRUE
## 31      model.1 2719.941        TRUE        FALSE

Prepare SNP data

Here, we will take a SNP file and convert it into a form that is usable by R.

Prepare files

First, convert the .bed, .fam, and .map files intoa flat .ped version using plink:

plink --noweb --bfile wisasp_gwa-data --recode --tab --out wisasp_gwa-flat

then read in the necessary files and make alterations:

# phenotype file
phen.covar <- fread("data/phenos-and-covars.txt",
             header = TRUE, 
             stringsAsFactors = TRUE,
      # only read in columns of interest       
      select = unique(c("SerialNo","GWA.ID","Genet", #identifiers
                 data.env$common.insects, #insects
                 names(data.env$trait.data) #trait data
                 )))
# .ped file (flat form of .bed, contains genotype information at each SNP)
ped <- fread("data/gwa-files/wisasp_gwa-flat.ped",drop = 2:6) #only ID and genotype cols
# .bim file (containes SNP information and major/minor allele info)
bim <- fread("data/gwa-files/wisasp_gwa-data.bim")

# Rename columns by SNP name
data.table::setnames(ped,old=names(ped), new = c("IID",
        unname(unlist(bim[,2]))))


# create vector with IIDs
## Rename Genet name (IID), remove .bam
IIDs <- ped[,1] <- gsub(unlist(ped[,1]), pattern = "\\.bam",replacement = "") #faster than loop

# Remove extra individuals in phenos-and-covar to match those present in SNP data.
phen.covar <- phen.covar[phen.covar$GWA.ID %in% IIDs,]

# get some statistics
obs.n <- nrow(phen.covar) # number of observations
snps.n <- (ncol(ped) - 1) # number of SNPs
IID.n <- length(unique(IIDs)) # number of Individuals (IIDs/genets)

Calculate allele number

The number of alleles equal to the reference is calculated by:

# # Calculate no. allele
# ## create empty matrix with the appropriate dimensions
# SNP.add <- matrix(nr=IID.n, nc=snps.n)
# 
# for(i in 2:114421) {
#   tmp <- unname(unlist(ped[,..i]))
#   # Reference allele from .bim
#   ref.allele <- unlist(bim[i-1,5])
#   SNP.add[,i-1] <- (substr(tmp,start=1,stop=1) == ref.allele) +
#     (substr(tmp,start=3,stop=3) == ref.allele)
# }
# 
# SNP.add <- as.data.frame(SNP.add)
# colnames(SNP.add) <- names(ped)[-1]
# rownames(SNP.add) <- ped$IID