This function will generate an example dataset as either 1) input for matchRanges() (when matched = FALSE) or 2) a Matched Object (when matched = TRUE).

makeExampleMatchedDataSet(
  type = "DataFrame",
  matched = FALSE,
  method = "rejection",
  replace = FALSE,
  ...
)

# S4 method for character_OR_missing,logical_OR_missing,character_OR_missing,logical_OR_missing
makeExampleMatchedDataSet(type, matched, method, replace)

Arguments

type

Character designating which type of dataset to make. options are one of 'data.frame', 'data.table', 'DataFrame', 'GRanges', or 'GInteractions'.

matched

TRUE/FALSE designating whether to generate a Matched dataset (matched = TRUE) or an input dataset for matchRanges() (matched = FALSE).

method

Character describing which matching method to use. Supported options are either 'nearest', 'rejection', or 'stratified'.

replace

TRUE/FALSE describing whether to select matches with or without replacement.

...

Additional arguments

Value

Returns an example Matched dataset or an example dataset for input to matchRanges().

Details

When matched = FALSE, the data returned contains 3 different features that can be subset to perform matching.

Examples

## Make examples for matchRanges() (i.e matched = FALSE)
set.seed(123)
makeExampleMatchedDataSet()
#> DataFrame with 10500 rows and 3 columns
#>        feature1  feature2    feature3
#>       <logical> <numeric> <character>
#> 1          TRUE   2.87905           c
#> 2          TRUE   3.53965           c
#> 3          TRUE   7.11742           c
#> 4          TRUE   4.14102           a
#> 5          TRUE   4.25858           c
#> ...         ...       ...         ...
#> 10496     FALSE   1.23578           b
#> 10497     FALSE   1.69671           a
#> 10498     FALSE   6.11140           a
#> 10499     FALSE   2.21657           d
#> 10500     FALSE   5.33003           b
head(makeExampleMatchedDataSet(type = 'data.frame', matched = FALSE))
#>   feature1 feature2 feature3
#> 1     TRUE 3.636514        c
#> 2     TRUE 1.330261        c
#> 3     TRUE 4.236877        c
#> 4     TRUE 4.042873        b
#> 5     TRUE 3.081029        b
#> 6     TRUE 6.058335        c
makeExampleMatchedDataSet(type = 'data.table', matched = FALSE)
#>        feature1  feature2 feature3
#>     1:     TRUE 0.2032325        c
#>     2:     TRUE 7.4856837        d
#>     3:     TRUE 1.8105119        b
#>     4:     TRUE 4.3514990        c
#>     5:     TRUE 8.1239122        b
#>    ---                            
#> 10496:    FALSE 2.2574409        a
#> 10497:    FALSE 7.0427986        b
#> 10498:    FALSE 9.5341569        d
#> 10499:    FALSE 5.0367807        a
#> 10500:    FALSE 1.7628214        b
makeExampleMatchedDataSet(type = 'DataFrame', matched = FALSE)
#> DataFrame with 10500 rows and 3 columns
#>        feature1  feature2    feature3
#>       <logical> <numeric> <character>
#> 1          TRUE   2.17220           c
#> 2          TRUE   4.15337           e
#> 3          TRUE   4.12367           c
#> 4          TRUE   3.43931           a
#> 5          TRUE   7.77699           a
#> ...         ...       ...         ...
#> 10496     FALSE  1.046444           a
#> 10497     FALSE  8.549075           a
#> 10498     FALSE  0.454913           b
#> 10499     FALSE  0.358426           e
#> 10500     FALSE  4.262284           d
makeExampleMatchedDataSet(type = 'GRanges', matched = FALSE)
#> GRanges object with 10500 ranges and 3 metadata columns:
#>           seqnames      ranges strand |  feature1  feature2    feature3
#>              <Rle>   <IRanges>  <Rle> | <logical> <numeric> <character>
#>       [1]     chr1       1-100      * |      TRUE   1.78381           c
#>       [2]     chr1       2-101      * |      TRUE   6.14991           c
#>       [3]     chr1       3-102      * |      TRUE   4.44694           d
#>       [4]     chr1       4-103      * |      TRUE   2.97590           c
#>       [5]     chr1       5-104      * |      TRUE   7.72256           b
#>       ...      ...         ...    ... .       ...       ...         ...
#>   [10496]     chr1 10496-10595      * |     FALSE   6.25657           a
#>   [10497]     chr1 10497-10596      * |     FALSE   8.40767           b
#>   [10498]     chr1 10498-10597      * |     FALSE   5.10310           b
#>   [10499]     chr1 10499-10598      * |     FALSE   2.21031           b
#>   [10500]     chr1 10500-10599      * |     FALSE   9.02046           c
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
makeExampleMatchedDataSet(type = 'GInteractions', matched = FALSE)
#> GInteractions object with 10500 interactions and 3 metadata columns:
#>           seqnames1     ranges1     seqnames2     ranges2 |  feature1  feature2
#>               <Rle>   <IRanges>         <Rle>   <IRanges> | <logical> <numeric>
#>       [1]      chr1       1-100 ---      chr1       1-100 |      TRUE   3.68136
#>       [2]      chr1       2-101 ---      chr1       2-101 |      TRUE   6.20206
#>       [3]      chr1       3-102 ---      chr1       3-102 |      TRUE   3.18163
#>       [4]      chr1       4-103 ---      chr1       4-103 |      TRUE   3.12921
#>       [5]      chr1       5-104 ---      chr1       5-104 |      TRUE   5.95224
#>       ...       ...         ... ...       ...         ... .       ...       ...
#>   [10496]      chr1 10496-10595 ---      chr1 10496-10595 |     FALSE   5.58682
#>   [10497]      chr1 10497-10596 ---      chr1 10497-10596 |     FALSE   6.65464
#>   [10498]      chr1 10498-10597 ---      chr1 10498-10597 |     FALSE   4.18161
#>   [10499]      chr1 10499-10598 ---      chr1 10499-10598 |     FALSE   4.87692
#>   [10500]      chr1 10500-10599 ---      chr1 10500-10599 |     FALSE   7.84910
#>              feature3
#>           <character>
#>       [1]           b
#>       [2]           a
#>       [3]           c
#>       [4]           c
#>       [5]           c
#>       ...         ...
#>   [10496]           a
#>   [10497]           b
#>   [10498]           d
#>   [10499]           d
#>   [10500]           a
#>   -------
#>   regions: 10500 ranges and 0 metadata columns
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths

## Make Matched class examples (i.e. matched = TRUE)
set.seed(123)
makeExampleMatchedDataSet(matched = TRUE)
#> MatchedDataFrame with 500 rows and 3 columns
#>      feature1  feature2    feature3
#>     <logical> <numeric> <character>
#> 1       FALSE  2.108420           c
#> 2       FALSE  5.991699           b
#> 3       FALSE  5.696525           b
#> 4       FALSE  0.409923           a
#> 5       FALSE  9.330107           b
#> ...       ...       ...         ...
#> 496     FALSE   3.27301           b
#> 497     FALSE   8.05522           c
#> 498     FALSE   2.01576           a
#> 499     FALSE   6.60221           b
#> 500     FALSE   7.79926           c
makeExampleMatchedDataSet(type = 'DataFrame', matched = TRUE,
                          method = 'rejection',
                          replace = FALSE)
#> MatchedDataFrame with 500 rows and 3 columns
#>      feature1  feature2    feature3
#>     <logical> <numeric> <character>
#> 1       FALSE   3.25187           c
#> 2       FALSE   8.18426           b
#> 3       FALSE   6.00364           c
#> 4       FALSE   5.56505           b
#> 5       FALSE   5.02590           b
#> ...       ...       ...         ...
#> 496     FALSE  1.887820           c
#> 497     FALSE  0.259549           d
#> 498     FALSE  2.567883           d
#> 499     FALSE  4.346857           b
#> 500     FALSE  0.056791           c
makeExampleMatchedDataSet(type = 'GRanges', matched = TRUE,
                          method = 'rejection',
                          replace = FALSE)
#> MatchedGRanges object with 500 ranges and 3 metadata columns:
#>         seqnames    ranges strand |  feature1  feature2    feature3
#>            <Rle> <IRanges>  <Rle> | <logical> <numeric> <character>
#>     [1]     chr1 8001-8100      * |     FALSE  10.89607           d
#>     [2]     chr1 1710-1809      * |     FALSE   5.75671           c
#>     [3]     chr1 8659-8758      * |     FALSE   4.46443           c
#>     [4]     chr1 5458-5557      * |     FALSE   4.11386           a
#>     [5]     chr1 8661-8760      * |     FALSE   1.79914           b
#>     ...      ...       ...    ... .       ...       ...         ...
#>   [496]     chr1 6728-6827      * |     FALSE   6.20597           b
#>   [497]     chr1 1508-1607      * |     FALSE   7.09604           c
#>   [498]     chr1 7528-7627      * |     FALSE   2.43404           c
#>   [499]     chr1 3883-3982      * |     FALSE   5.03960           c
#>   [500]     chr1 1378-1477      * |     FALSE   3.08657           d
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
# throwing error (April 2023)
#makeExampleMatchedDataSet(type = 'GInteractions', matched = TRUE,
#                          method = 'rejection',
#                          replace = FALSE)