R/RawGenomicSignals.append.R

setMethodS3("append", "RawGenomicSignals", function(this, other, addId=TRUE, ...) {
  # Argument 'other':
  other <- Arguments$getInstanceOf(other, class(this)[1])

  if (addId) {
    # Keep track of origins, but updating the locus IDs
    if (is.null(this$id)) {
      this$id <- rep(1L, times=nbrOfLoci(this))
    }

    if (is.null(other$id)) {
      nextId <- max(this$id, na.rm=TRUE) + 1L
      other$id <- rep(nextId, times=nbrOfLoci(other))
    }
  }

  # Append
  res <- rbind(this, other)

  res
})

Try the aroma.core package in your browser

Any scripts or data that you put into this service are public.

aroma.core documentation built on June 25, 2024, 1:15 a.m.