outbreaker_data.Rd
This function performs various checks on input data given to outbreaker. It takes a list of named items as input, performs various checks, set defaults where arguments are missing, and return a correct list of data input. If no input is given, it returns the default settings.
outbreaker_data(..., data = list(...))
... | a list of data items to be processed (see description) |
---|---|
data | optionally, an existing list of data item as returned by |
Acceptables arguments for ... are:
dates a vector indicating the collection dates, provided either as
integer numbers or in a usual date format such as Date
or
POSIXct
format. By convention, zero will indicate the oldest date. If
the vector is named, the vector names will be used for matching cases to
contact tracing data and labelled DNA sequences.
the DNA sequences in DNAbin
format (see
read.dna
in the ape package); this can be imported from a
fasta file (extension .fa, .fas, or .fasta) using adegenet
's function
fasta2DNAbin.
the contact tracing data provided as a matrix/dataframe of two columns, indicating a reported contact between the two individuals whose ids are provided in a given row of the data, or an epicontacts object. In the case of the latter, linelist IDs will be used for matching dates and DNA sequences
a vector of numeric values indicating the generation time distribution, reflecting the infectious potential of a case t = 1, 2, ... time steps after infection. By convention, it is assumed that newly infected patients cannot see new infections on the same time step. If not standardized, this distribution is rescaled to sum to 1.
similar to w_dens
, except that this is the distribution
of the colonization time, i_e. time interval during which the pathogen can
be sampled from the patient.
Thibaut Jombart (thibautjombart@gmail.com)
x <- fake_outbreak outbreaker_data(dates = x$sample, dna = x$dna, w_dens = x$w)#> $dates #> [1] 3 5 6 6 7 9 8 9 9 9 11 10 10 10 10 11 11 12 11 13 12 13 11 12 11 #> [26] 11 13 12 14 14 #> #> $w_dens #> [1] 4.254894e-02 2.127447e-01 4.254894e-01 3.191170e-01 6.320574e-05 #> [6] 2.325209e-05 8.553966e-06 3.146828e-06 1.157653e-06 4.258769e-07 #> [11] 1.566714e-07 5.763617e-08 2.120316e-08 7.800208e-09 2.869536e-09 #> [16] 1.055643e-09 3.883495e-10 1.428658e-10 5.255739e-11 1.933478e-11 #> [21] 7.112869e-12 #> #> $f_dens #> [1] 4.254894e-02 2.127447e-01 4.254894e-01 3.191170e-01 6.320574e-05 #> [6] 2.325209e-05 8.553966e-06 3.146828e-06 1.157653e-06 4.258769e-07 #> [11] 1.566714e-07 5.763617e-08 2.120316e-08 7.800208e-09 2.869536e-09 #> [16] 1.055643e-09 3.883495e-10 1.428658e-10 5.255739e-11 1.933478e-11 #> [21] 7.112869e-12 #> #> $dna #> 30 DNA sequences in binary format stored in a matrix. #> #> All sequences of same length: 10000 #> #> Labels: #> 1 #> 2 #> 3 #> 4 #> 5 #> 6 #> ... #> #> Base composition: #> a c g t #> 0.251 0.242 0.251 0.256 #> (Total: 300 kb) #> #> $ctd #> NULL #> #> $N #> [1] 30 #> #> $L #> [1] 10000 #> #> $D #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #> 1 0 1 2 26 3 30 26 3 33 31 28 3 34 4 5 28 28 3 34 34 29 28 37 35 36 #> 2 1 0 1 27 2 31 27 2 34 32 29 2 35 3 4 29 29 2 35 35 30 29 38 36 37 #> 3 2 1 0 28 1 32 28 1 35 33 30 1 36 2 3 30 30 1 36 36 31 30 39 37 38 #> 4 26 27 28 0 29 4 0 29 7 5 2 29 8 30 31 2 2 29 8 8 3 2 11 9 10 #> 5 3 2 1 29 0 33 29 0 36 34 31 0 37 1 2 31 31 0 37 37 32 31 40 38 39 #> 6 30 31 32 4 33 0 4 33 3 1 6 33 4 34 35 6 6 33 4 4 7 6 7 5 6 #> 7 26 27 28 0 29 4 0 29 7 5 2 29 8 30 31 2 2 29 8 8 3 2 11 9 10 #> 8 3 2 1 29 0 33 29 0 36 34 31 0 37 1 2 31 31 0 37 37 32 31 40 38 39 #> 9 33 34 35 7 36 3 7 36 0 4 9 36 1 37 38 9 9 36 1 7 10 9 4 2 3 #> 10 31 32 33 5 34 1 5 34 4 0 7 34 5 35 36 7 7 34 5 3 8 7 8 6 7 #> 11 28 29 30 2 31 6 2 31 9 7 0 31 10 32 33 4 4 31 10 10 1 0 13 11 12 #> 12 3 2 1 29 0 33 29 0 36 34 31 0 37 1 2 31 31 0 37 37 32 31 40 38 39 #> 13 34 35 36 8 37 4 8 37 1 5 10 37 0 38 39 10 10 37 2 8 11 10 3 1 2 #> 14 4 3 2 30 1 34 30 1 37 35 32 1 38 0 3 32 32 1 38 38 33 32 41 39 40 #> 15 5 4 3 31 2 35 31 2 38 36 33 2 39 3 0 33 33 2 39 39 34 33 42 40 41 #> 16 28 29 30 2 31 6 2 31 9 7 4 31 10 32 33 0 4 31 10 10 5 4 13 11 12 #> 17 28 29 30 2 31 6 2 31 9 7 4 31 10 32 33 4 0 31 10 10 5 4 13 11 12 #> 18 3 2 1 29 0 33 29 0 36 34 31 0 37 1 2 31 31 0 37 37 32 31 40 38 39 #> 19 34 35 36 8 37 4 8 37 1 5 10 37 2 38 39 10 10 37 0 8 11 10 5 3 4 #> 20 34 35 36 8 37 4 8 37 7 3 10 37 8 38 39 10 10 37 8 0 11 10 11 9 10 #> 21 29 30 31 3 32 7 3 32 10 8 1 32 11 33 34 5 5 32 11 11 0 1 14 12 13 #> 22 28 29 30 2 31 6 2 31 9 7 0 31 10 32 33 4 4 31 10 10 1 0 13 11 12 #> 23 37 38 39 11 40 7 11 40 4 8 13 40 3 41 42 13 13 40 5 11 14 13 0 4 5 #> 24 35 36 37 9 38 5 9 38 2 6 11 38 1 39 40 11 11 38 3 9 12 11 4 0 3 #> 25 36 37 38 10 39 6 10 39 3 7 12 39 2 40 41 12 12 39 4 10 13 12 5 3 0 #> 26 29 30 31 3 32 7 3 32 10 8 5 32 11 33 34 5 1 32 11 11 6 5 14 12 13 #> 27 29 30 31 3 32 7 3 32 10 8 5 32 11 33 34 5 1 32 11 11 6 5 14 12 13 #> 28 28 29 30 32 31 36 32 31 39 37 34 31 40 32 33 34 34 31 40 40 35 34 43 41 42 #> 29 31 32 33 5 34 1 5 34 4 0 7 34 5 35 36 7 7 34 5 3 8 7 8 6 7 #> 30 36 37 38 10 39 6 10 39 3 7 12 39 2 40 41 12 12 39 4 10 13 12 5 3 4 #> 26 27 28 29 30 #> 1 29 29 28 31 36 #> 2 30 30 29 32 37 #> 3 31 31 30 33 38 #> 4 3 3 32 5 10 #> 5 32 32 31 34 39 #> 6 7 7 36 1 6 #> 7 3 3 32 5 10 #> 8 32 32 31 34 39 #> 9 10 10 39 4 3 #> 10 8 8 37 0 7 #> 11 5 5 34 7 12 #> 12 32 32 31 34 39 #> 13 11 11 40 5 2 #> 14 33 33 32 35 40 #> 15 34 34 33 36 41 #> 16 5 5 34 7 12 #> 17 1 1 34 7 12 #> 18 32 32 31 34 39 #> 19 11 11 40 5 4 #> 20 11 11 40 3 10 #> 21 6 6 35 8 13 #> 22 5 5 34 7 12 #> 23 14 14 43 8 5 #> 24 12 12 41 6 3 #> 25 13 13 42 7 4 #> 26 0 2 35 8 13 #> 27 2 0 35 8 13 #> 28 35 35 0 37 42 #> 29 8 8 37 0 7 #> 30 13 13 42 7 0 #> #> $max_range #> [1] 11 #> #> $can_be_ances #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] #> [1,] FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [2,] TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [3,] TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [4,] TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [5,] TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [6,] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE #> [7,] TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE #> [8,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE #> [9,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE #> [10,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE #> [11,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE #> [12,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE #> [13,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [14,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [15,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [16,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [17,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [18,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [19,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [20,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [21,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [22,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [23,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [24,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [25,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [26,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [27,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [28,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [29,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [30,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] #> [1,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [2,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [3,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [4,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [5,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [6,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [7,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [8,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [9,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [10,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [11,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [12,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [13,] FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [14,] TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [15,] TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [16,] TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [17,] TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [18,] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE #> [19,] TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE #> [20,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE #> [21,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE #> [22,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE #> [23,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE #> [24,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE #> [25,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [26,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [27,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [28,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [29,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [30,] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [,25] [,26] [,27] [,28] [,29] [,30] #> [1,] TRUE TRUE TRUE TRUE TRUE TRUE #> [2,] TRUE TRUE TRUE TRUE TRUE TRUE #> [3,] TRUE TRUE TRUE TRUE TRUE TRUE #> [4,] TRUE TRUE TRUE TRUE TRUE TRUE #> [5,] TRUE TRUE TRUE TRUE TRUE TRUE #> [6,] TRUE TRUE TRUE TRUE TRUE TRUE #> [7,] TRUE TRUE TRUE TRUE TRUE TRUE #> [8,] TRUE TRUE TRUE TRUE TRUE TRUE #> [9,] TRUE TRUE TRUE TRUE TRUE TRUE #> [10,] TRUE TRUE TRUE TRUE TRUE TRUE #> [11,] TRUE TRUE TRUE TRUE TRUE TRUE #> [12,] TRUE TRUE TRUE TRUE TRUE TRUE #> [13,] TRUE TRUE TRUE TRUE TRUE TRUE #> [14,] TRUE TRUE TRUE TRUE TRUE TRUE #> [15,] TRUE TRUE TRUE TRUE TRUE TRUE #> [16,] TRUE TRUE TRUE TRUE TRUE TRUE #> [17,] TRUE TRUE TRUE TRUE TRUE TRUE #> [18,] TRUE TRUE TRUE TRUE TRUE TRUE #> [19,] TRUE TRUE TRUE TRUE TRUE TRUE #> [20,] TRUE TRUE TRUE TRUE TRUE TRUE #> [21,] TRUE TRUE TRUE TRUE TRUE TRUE #> [22,] TRUE TRUE TRUE TRUE TRUE TRUE #> [23,] TRUE TRUE TRUE TRUE TRUE TRUE #> [24,] TRUE TRUE TRUE TRUE TRUE TRUE #> [25,] FALSE TRUE TRUE TRUE TRUE TRUE #> [26,] TRUE FALSE TRUE TRUE TRUE TRUE #> [27,] TRUE TRUE FALSE TRUE TRUE TRUE #> [28,] TRUE TRUE TRUE FALSE TRUE TRUE #> [29,] TRUE TRUE TRUE TRUE FALSE TRUE #> [30,] TRUE TRUE TRUE TRUE TRUE FALSE #> #> $log_w_dens #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] #> [1,] -3.1571 -1.547663 -0.8545153 -1.142197 -9.669115 -10.66912 -11.66912 #> [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] -12.66912 -13.66912 -14.66912 -15.66912 -16.66912 -17.66912 -18.66912 #> [,15] [,16] [,17] [,18] [,19] [,20] [,21] #> [1,] -19.66912 -20.66912 -21.66912 -22.66912 -23.66912 -24.66912 -25.66912 #> #> $log_f_dens #> [1] -3.1571004 -1.5476625 -0.8545153 -1.1421974 -9.6691155 -10.6691155 #> [7] -11.6691155 -12.6691155 -13.6691155 -14.6691155 -15.6691155 -16.6691155 #> [13] -17.6691155 -18.6691155 -19.6691155 -20.6691155 -21.6691155 -22.6691155 #> [19] -23.6691155 -24.6691155 -25.6691155 #> #> $contacts #> <0 x 0 matrix> #> #> $C_combn #> NULL #> #> $C_nrow #> NULL #> #> $ids #> [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" #> [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" #> #> $has_dna #> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> #> $id_in_dna #> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #> [26] 26 27 28 29 30 #>