This function implements the main fitting function for REVOLVER, which is a 2-steps algorithm described in the REVOLVER paper (Caravagna et al., Nature Methods volume 15, pages 707–714, 2018; https://www.nature.com/articles/s41592-018-0108-x).

To run the fit the cohort needs not to throw any error when function revolver_check_cohort is run with parameter stopOnError = TRUE. The trees of the patients need to be computed as well.

The output object contains a new field `$fit` which contains the fit results, and is of a new S3 class called `rev_cohort_fit` which has its own S3 methods.

revolver_fit(x, initial.solution = 1, max.iterations = 10, n = 10, ...)

Arguments

x

A REVOLVER cohort where trees per patient have been already computed.

initial.solution

Either a scalar to fix one initial condition (rank id), or NA to sample it randomly across all possivle solutions. Notice that if the inital conditin is fixed the other parameter `n` should be 1.

max.iterations

Maximum number of EM steps before forcing stop.

n

Number of initial conditions sampled to compute optimal fit.

...

Parameters forwarded to a run call of package easypar, which can be customised for parallel fit, caching or other parameters.

Value

A new object of class "rev_cohort_fit" which represents a REVOLVER cohort object with fits available.

References

Caravagna et al., Nature Methods volume 15, pages 707–714, 2018; https://www.nature.com/articles/s41592-018-0108-x

See also

Other Analysis functions: revolver_cluster()

Examples

# Data released in the 'evoverse.datasets'
data('TRACERx_NEJM_2017_REVOLVER', package = 'evoverse.datasets')

revolver_fit(TRACERx_NEJM_2017_REVOLVER)
#>  [ REVOLVER Transfer Learning fit ~ TRACERx NEJM 2017 ] 
#> ┌───────────────────────────────────────────────────────────────────────────────────────────┐
#>                                                                                            
#>    WARNING - Some patients have only one clone with drivers; they will just be expanded.   
#>                                                                                            
#> └───────────────────────────────────────────────────────────────────────────────────────────┘
#> # A tibble: 54 × 7
#>    patientID numBiopsies numMutations numDriverMutations numClonesWithDriver
#>    <chr>           <int>        <int>              <int>               <int>
#>  1 CRUK0007            2            3                  3                   1
#>  2 CRUK0010            2            3                  3                   1
#>  3 CRUK0012            2            1                  1                   1
#>  4 CRUK0018            4            4                  4                   1
#>  5 CRUK0019            2            1                  1                   1
#>  6 CRUK0021            2            4                  4                   1
#>  7 CRUK0025            3            3                  3                   1
#>  8 CRUK0026            2            4                  4                   1
#>  9 CRUK0028            2            2                  2                   1
#> 10 CRUK0029            6            4                  4                   1
#> # ℹ 44 more rows
#> # ℹ 2 more variables: numTruncalMutations <int>, numSubclonalMutations <int>
#> Beware: because you have set a fixed initial condition `n` will be disregarded because this EM is exhaustive.
#> 
#> Fitting  N = 99 patients 
#> 
#> # A tibble: 99 × 6
#>    patientID hasTrees numTrees maxScore minScore combInfTransf
#>    <chr>     <lgl>       <int>    <dbl>    <dbl>         <int>
#>  1 CRUK0001  TRUE            3    0.111   0.111              3
#>  2 CRUK0002  TRUE            2    0.75    0.0833             2
#>  3 CRUK0003  TRUE            1    1       1                  1
#>  4 CRUK0004  TRUE            1    1       1                  1
#>  5 CRUK0005  TRUE            1    1       1                  1
#>  6 CRUK0006  TRUE            2    0.667   0.167              2
#>  7 CRUK0007  TRUE            1    1       1                  1
#>  8 CRUK0008  TRUE            1    1       1                  1
#>  9 CRUK0009  TRUE            1    1       1                  1
#> 10 CRUK0010  TRUE            1    1       1                  1
#> # ℹ 89 more rows
#> 
#> Initial solution : Fixed to #1 
#> 
#> Sampled solutions:  n = 1 
#> 
#> Parallel exectuion (via 'easypar') : TRUE 
#> REVOLVER Transfer Learning fit  COMPLETED 
#> 
#>  [ REVOLVER - Repeated Evolution in Cancer ] 
#> 
#> Dataset : TRACERx NEJM 2017 
#> Cohort  : 99 patients, 450 variants and 79 driver events. 
#> 
#> Trees per patient    : YES 
#> Fit via TL           : YES 
#> REVOLVER clustering  : YES 
#> Jackknife statistics : YES 
#>  
#> For summary statistics see `?Stats_*(x)` with * = {cohort, drivers, trees, fits, clusters, ...} 
#> 
#> ┌───────────────────────────────────────────────────────────────────────────────────────────┐
#>                                                                                            
#>    WARNING - Some patients have only one clone with drivers; they will just be expanded.   
#>                                                                                            
#> └───────────────────────────────────────────────────────────────────────────────────────────┘
#> # A tibble: 54 × 7
#>    patientID numBiopsies numMutations numDriverMutations numClonesWithDriver
#>    <chr>           <int>        <int>              <int>               <int>
#>  1 CRUK0007            2            3                  3                   1
#>  2 CRUK0010            2            3                  3                   1
#>  3 CRUK0012            2            1                  1                   1
#>  4 CRUK0018            4            4                  4                   1
#>  5 CRUK0019            2            1                  1                   1
#>  6 CRUK0021            2            4                  4                   1
#>  7 CRUK0025            3            3                  3                   1
#>  8 CRUK0026            2            4                  4                   1
#>  9 CRUK0028            2            2                  2                   1
#> 10 CRUK0029            6            4                  4                   1
#> # ℹ 44 more rows
#> # ℹ 2 more variables: numTruncalMutations <int>, numSubclonalMutations <int>