@@ -398,20 +398,17 @@ setMethod( "CTSSnormalizedTpmGR", "CAGEexp", function (object, samples) {
398
398
# ' extract tag clusters. If `samples = NULL`, a list of all the clusters for
399
399
# ' each sample is returned.
400
400
# '
401
- # ' @param returnInterquantileWidth Return the interquantile width for each tag cluster.
402
- # '
403
401
# ' @param qLow,qUp Position of which quantile should be used as a left (lower)
404
402
# ' or right (upper) boundary (for `qLow` and `qUp` respectively) when
405
403
# ' calculating interquantile width. Default value `NULL` results in using the
406
- # ' start coordinate of the cluster. Used only when
407
- # ' `returnInterquantileWidth = TRUE`, otherwise ignored.
404
+ # ' start coordinate of the cluster.
408
405
# '
409
406
# ' @return Returns a `GRangesList` or a `TagClusters` object with genomic coordinates,
410
407
# ' position of dominant TSS, total CAGE signal and additional information for
411
- # ' all TCs from specified CAGE dataset (sample). If
412
- # ' `returnInterquantileWidth = TRUE` , interquantile width for each TC is also
413
- # ' calculated using provided quantile positions. The [`S4Vectors::metadata`]
414
- # ' slot of the object contains a copy of the `CAGEexp` object's _column data_.
408
+ # ' all TCs from specified CAGE dataset (sample). If quantile information is
409
+ # ' provided , interquantile width for each TC is also calculated. The
410
+ # ' [`S4Vectors::metadata`] slot of the object contains a copy of the `CAGEexp`
411
+ # ' object's _column data_.
415
412
# '
416
413
# ' @author Vanja Haberle
417
414
# ' @author Charles Plessy
@@ -421,21 +418,18 @@ setMethod( "CTSSnormalizedTpmGR", "CAGEexp", function (object, samples) {
421
418
# ' @export
422
419
# '
423
420
# ' @examples
424
- # ' tagClustersGR( exampleCAGEexp, "Zf.high", TRUE, 0.1, 0.9 )
425
- # ' tagClustersGR( exampleCAGEexp, 1
426
- # ' , returnInterquantileWidth = TRUE, qLow = 0.1, qUp = 0.9 )
421
+ # ' tagClustersGR( exampleCAGEexp, "Zf.high", 0.1, 0.9 )
422
+ # ' tagClustersGR( exampleCAGEexp, 1, qLow = 0.1, qUp = 0.9 )
427
423
# ' tagClustersGR( exampleCAGEexp )@metadata$colData
428
424
# '
429
425
# ' @export
430
426
431
427
setGeneric ( "tagClustersGR "
432
- , function ( object , sample = NULL
433
- , returnInterquantileWidth = FALSE , qLow = NULL , qUp = NULL ) {
428
+ , function ( object , sample = NULL , qLow = NULL , qUp = NULL ) {
434
429
if (is.null(sample )) {
435
430
tc.list <- GRangesList( lapply( sampleLabels(object )
436
431
, tagClustersGR
437
432
, object = object
438
- , returnInterquantileWidth = returnInterquantileWidth
439
433
, qLow = qLow , qUp = qUp ))
440
434
names(tc.list ) <- sampleLabels(object )
441
435
metadata(tc.list )$ colData <- colData(object )
@@ -448,15 +442,12 @@ setGeneric( "tagClustersGR"
448
442
# ' @rdname tagClusters
449
443
450
444
setMethod ( "tagClustersGR ", "CAGEexp"
451
- , function (object , sample , returnInterquantileWidth , qLow , qUp ) {
445
+ , function (object , sample , qLow , qUp ) {
452
446
tc <- metadata(object )$ tagClusters [[sample ]]
453
447
if (is.null(tc ))
454
448
stop( " No clusters found, run " , sQuote(" clusterCTSS" ), " first." , call. = FALSE )
455
449
456
- if (returnInterquantileWidth ) {
457
- if (is.null(qLow ) | is.null(qUp ))
458
- stop( " No quantiles specified! Set the " , sQuote(" qLow" )
459
- , " and " , sQuote(" qUp" ), " arguments." )
450
+ if (! is.null(qLow ) & ! is.null(qUp )) {
460
451
qLowName <- paste0(" q_" , qLow )
461
452
qUpName <- paste0(" q_" , qUp )
462
453
if (! all( c(qLowName , qUpName ) %in% colnames(mcols(tc ))))
@@ -487,20 +478,9 @@ setMethod("filteredCTSSidx", "CAGEexp", function (object){
487
478
# ' @param object A [`CAGEr`] object.
488
479
# '
489
480
# ' @param sample Optional. Label of the CAGE dataset (experiment, sample) for
490
- # ' which to extract sample-specific information on consensus clusters.
491
- # ' When no sample is specified (NULL), sample-agnostic information
492
- # ' on consensus clusters is provided. This includes the `dominant_ctss`
493
- # ' and `tpm.dominant_ctss` for each consensus cluster.
494
- # '
495
- # ' @param returnInterquantileWidth Should the interquantile width of consensus
496
- # ' clusters be returned? When `sample` argument is specified, the
497
- # ' interquantile widths of the consensus clusters in that specified
498
- # ' sample are returned, otherwise, the (sample-agnostic) interquantile
499
- # ' width of the consensus cluster itself is returned.
481
+ # ' which to extract sample-specific information on consensus clusters.
500
482
# '
501
- # ' @param qLow,qUp Position of which quantile should be used as a left (lower)
502
- # ' or right (upper) boundary when calculating interquantile width. Used
503
- # ' only when `returnInterquantileWidth = TRUE`, otherwise ignored.
483
+ # ' @param qLow,qUp Lower and upper quantiles to compute interquantile width.
504
484
# '
505
485
# ' @return `consensusClustersGR` returns a [`ConsensusClusters`] object, which
506
486
# ' wraps the [`GRanges`] class. The `score` columns indicates the
@@ -510,10 +490,10 @@ setMethod("filteredCTSSidx", "CAGEexp", function (object){
510
490
# ' NOT specified, total CAGE signal across all CAGE datasets (samples) is
511
491
# ' returned in the `tpm` column. When `sample` argument is specified, the `tpm`
512
492
# ' column contains CAGE signal of consensus clusters in that specific sample.
513
- # ' When `returnInterquantileWidth = TRUE`, additional sample-specific information
514
- # ' is returned, including position of the dominant TSS, and interquantile width
515
- # ' of the consensus clusters in the specified sample or otherwise,
516
- # ' sample-agnostic information is returned.
493
+ # ' In addition, sample-specific information is returned, including position of
494
+ # ' the dominant TSS, and (if applicable) interquantile width of the consensus
495
+ # ' clusters in the specified sample or otherwise, sample-agnostic information is
496
+ # ' returned.
517
497
# '
518
498
# ' @author Vanja Haberle
519
499
# ' @author Charles Plessy
@@ -525,24 +505,22 @@ setMethod("filteredCTSSidx", "CAGEexp", function (object){
525
505
# '
526
506
# ' @examples
527
507
# ' consensusClustersGR( exampleCAGEexp, sample = 2
528
- # ' , returnInterquantileWidth = TRUE
529
508
# ' , qLow = 0.1, qUp = 0.9)
530
509
# '
531
510
# ' @importFrom GenomicRanges granges
532
511
# ' @export
533
512
534
513
setGeneric ( "consensusClustersGR "
535
514
, function ( object
536
- , sample = NULL
537
- , returnInterquantileWidth = FALSE
515
+ , sample = NULL
538
516
, qLow = NULL , qUp = NULL ) {
539
517
validSamples(object , sample )
540
518
standardGeneric(" consensusClustersGR" )})
541
519
542
520
# ' @rdname consensusClusters
543
521
544
522
setMethod ( "consensusClustersGR ", "CAGEexp"
545
- , function (object , sample , returnInterquantileWidth , qLow , qUp ) {
523
+ , function (object , sample , qLow , qUp ) {
546
524
cc <- rowRanges(consensusClustersSE(object ))
547
525
# # Comment and edits added: 2022-OCT-06
548
526
# # If sample is NULL, provide sample-agnostic information.
@@ -554,12 +532,9 @@ setMethod( "consensusClustersGR", "CAGEexp"
554
532
if (! is.null(qUp ))
555
533
mcols(cc )[[paste0(" q_" , qUp )]] <-
556
534
consensusClustersQuantile(object , sample , qUp )
557
- if (returnInterquantileWidth == TRUE ) {
558
- if (is.null(qLow ) | is.null(qUp ))
559
- stop( " Set " , sQuote(" qLow" ), " and " , sQuote(" qUp" )
560
- , " to specify the quantile positions used to calculate width." )
561
- mcols(cc )[[" interquantile_width" ]] = mcols(cc )[[paste0(" q_" , qUp )]] -
562
- mcols(cc )[[paste0(" q_" , qLow )]] + 1
535
+ if (! is.null(qLow ) & ! is.null(qUp )) {
536
+ mcols(cc )[[" interquantile_width" ]] = mcols(cc )[[paste0(" q_" , qUp )]] -
537
+ mcols(cc )[[paste0(" q_" , qLow )]] + 1
563
538
}
564
539
cc $ tpm <- cc $ score <- consensusClustersTpm(object )[,sample ]
565
540
@@ -570,7 +545,7 @@ setMethod( "consensusClustersGR", "CAGEexp"
570
545
score(ctss ) <- CTSSnormalizedTpmDF(object ) | > rowSums.RleDataFrame()
571
546
ctss <- ctss [ctss $ filteredCTSSidx ]
572
547
cc <- .ctss_summary_for_clusters(ctss , cc , removeSingletons = FALSE )
573
- if (isTRUE( returnInterquantileWidth )) {
548
+ if ( ! is.null( qLow ) & ! is.null( qUp )) {
574
549
qLowName <- paste0(" q_" , qLow )
575
550
qUpName <- paste0(" q_" , qUp )
576
551
mcols(cc )[[" interquantile_width" ]] <-
0 commit comments