R/methods.R

#' Show method for PGx objects
#' @rdname PGx-class
#' @export
setMethod("show", "PGx", function(object) {
  cat(
    "Class: PGx\n",
    "PGx gene: ", object@gene, " \n",
    "Number of samples: ", ncol(object), " \n",
    "Number of Positions in the Reference: ", length(object@referencePositions), " \n",
    "Number of Positions in VCF present in Reference: ", length(object@matchingPositions), " \n",
    "Number of Positions in VCF not in Reference: ", length(object@missingPositions), " \n",
    sep = ""
  )
})

#' Getter method for the gene slot of a PGx object
#'
#' The 'gene' slot of a PGx object contains the gene name of the gene for which
#' the PGx locations were extracted from the input VCF.
#' @export
#' @rdname PGx-class
#' @return Name of the PGx gene
setMethod("gene", "PGx", function(x) x@gene)

#' Getter method for the referencePositions slot of a PGx object
#'
#' The 'referencePositions' slot of a PGx object contains a GRanges object of the
#' reference PGx positions that were used to subset the input VCF file
#' @export
#' @rdname PGx-class
#' @return GRanges object
setMethod("referencePositions", "PGx", function(x) x@referencePositions)

#' Getter method for the missingPositions slot of a PGx object
#'
#' The 'missingPositions' slot of a PGx object contains a GRanges object of any
#' position missing from the input VCF file that is present in the reference PGx
#' dataset.
#' @export
#' @rdname PGx-class
#' @return GRanges object
setMethod("missingPositions", "PGx", function(x) x@missingPositions)

#' Getter method for the matchingPositions slot of a PGx object
#'
#' The 'matchingPositions' slot of a PGx object contains a GRanges object of any
#' position that has a matching location with the reference PGx dataset.
#' @export
#' @rdname PGx-class
#' @return GRanges object
setMethod("matchingPositions", "PGx", function(x) x@matchingPositions)

#' Getter method for the referenceHaplotypes slot of a PGx object
#'
#' The 'referenceHaplotypes' slot of a PGx object contains a GRanges object of the
#' positions used to subset the VCF. These positions define the reference PGx
#' alleles.
#' @export
#' @rdname PGx-class
#' @return GRanges object
setMethod("referenceHaplotypes", "PGx", function(x) x@referenceHaplotypes)
coriell-research/pgx documentation built on June 4, 2022, 11:08 a.m.