Skip to contents

This function downsamples all repertoires in the dataset.

Users can choose the value to which all the samples are down-sampled. If not specified, the lowest number of sequences across all samples within the dataset will be used.

This strategy can be applied when studying different cell subsets with significant differences in their repertoire sizes.

Usage

sampleRepSeqExp(
  x,
  sample.size = min(mData(x)$nSequences),
  rngseed = FALSE,
  replace = TRUE,
  verbose = TRUE
)

Arguments

x

an object of class RepSeqExperiment

sample.size

an integer indicating the desired down-sampled size. The default is the smallest repertoire size among all samples of the dataset.

rngseed

a integer used as seed for a reproducible result.

replace

a boolean indicating if the resampling should be performed with or without replacement. Default is TRUE.

verbose

a boolean indicating whether or not to show the details of every computation step within the function. Default is TRUE.

Value

a new RepSeqExperiment with the downsized data.

Examples


data(RepSeqData)

RepSeqData_ds<- sampleRepSeqExp(x = RepSeqData,
                                rngseed = 1234,
                                replace = TRUE)
#> `set.seed( 1234 )` was applied for reproducibility of the random subsampling. Please save this seed for data reproduction 
#> You can try `set.seed( 1234 ); .Random.seed` for the full vector.
#> Down-sampling to 386373 sequences...
#> Creating a RepSeqExperiment object...
#> Done.

RepSeqData_ds<- sampleRepSeqExp(x = RepSeqData,
                                rngseed = FALSE,
                                replace = FALSE)
#> You set `rngseed` to FALSE. Make sure you've set & saved
#>   the random seed of your session for reproducibility.
#>  See `?set.seed`
#> Down-sampling to 386373 sequences...
#> Creating a RepSeqExperiment object...
#> Done.