Each patient is identied through its id (patientID); with this function, you can remove patients, which consists in removing data and trees. If you have fit the models or clustered the cohort, you must re-run the analyses after this modification; for this reason, any previous result from those analyses is cancelled from the returned object.

Notice also that some drivers might be removed by this function.

remove_patients(x, patientID, check = TRUE)

Arguments

x

A REVOLVER cohort.

patientID

Id of the patient to remove. It can be a vector.

check

If TRUE, run revolver_check_cohort after removal.

Value

A modified cohort without the required patients.

Examples

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

print(TRACERx_NEJM_2017_REVOLVER)
#>  [ 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>

new_cohort = remove_patients(TRACERx_NEJM_2017_REVOLVER, "CRUK0001")
#> PASK: driver events that now are found in only one patient, will be now removed ...
#> ── Removing driver events ────────────────────────────────────────────── PASK ──
#> 
#> # A tibble: 1 × 7
#>   variantID numClonal p_clonal numSubclonal p_subclonal N_tot  p_tot
#>   <chr>         <dbl>    <dbl>        <dbl>       <dbl> <dbl>  <dbl>
#> 1 PASK              1   0.0102            0           0     1 0.0102
#>  Retained 98 patients after driver removal..
#> - The cohort has fits which will be cancelled, please re-compute the fits ...
#> - The cohort has clusters which will be cancelled, please re-compute the 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>
print(new_cohort)
#>  [ REVOLVER - Repeated Evolution in Cancer ] 
#> 
#> Dataset : TRACERx NEJM 2017 
#> Cohort  : 98 patients, 449 variants and 78 driver events. 
#> 
#> Trees per patient    : YES 
#> Fit via TL           : NO 
#> REVOLVER clustering  : NO 
#> 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>

new_cohort = remove_patients(TRACERx_NEJM_2017_REVOLVER, c("CRUK0002", "CRUK00024"))
#> IKZF1: driver events that now are found in only one patient, will be now removed ...
#> ── Removing driver events ───────────────────────────────────────────── IKZF1 ──
#> 
#> # A tibble: 1 × 7
#>   variantID numClonal p_clonal numSubclonal p_subclonal N_tot  p_tot
#>   <chr>         <dbl>    <dbl>        <dbl>       <dbl> <dbl>  <dbl>
#> 1 IKZF1             0        0            1      0.0102     1 0.0102
#>  Retained 98 patients after driver removal..
#> - The cohort has fits which will be cancelled, please re-compute the fits ...
#> - The cohort has clusters which will be cancelled, please re-compute the clusters ...
#> ┌───────────────────────────────────────────────────────────────────────────────────────────┐
#>                                                                                            
#>    WARNING - Some patients have only one clone with drivers; they will just be expanded.   
#>                                                                                            
#> └───────────────────────────────────────────────────────────────────────────────────────────┘
#> # A tibble: 55 × 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
#> # ℹ 45 more rows
#> # ℹ 2 more variables: numTruncalMutations <int>, numSubclonalMutations <int>
print(new_cohort)
#>  [ REVOLVER - Repeated Evolution in Cancer ] 
#> 
#> Dataset : TRACERx NEJM 2017 
#> Cohort  : 98 patients, 449 variants and 78 driver events. 
#> 
#> Trees per patient    : YES 
#> Fit via TL           : NO 
#> REVOLVER clustering  : NO 
#> 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: 55 × 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
#> # ℹ 45 more rows
#> # ℹ 2 more variables: numTruncalMutations <int>, numSubclonalMutations <int>