Skip to content

Commit

Permalink
Added show and removed Info method; incremented version
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurits Evers committed Sep 11, 2019
1 parent 5a4a81b commit 7e02f26
Show file tree
Hide file tree
Showing 63 changed files with 246 additions and 281 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
data/tx_hg38.RData

.Rproj.user
*.RData
*.Rproj
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: RNAModR
Type: Package
Title: Functional Analysis of RNA Modifications
Version: 0.1.0
Version: 0.1.1
Author: Maurits Evers <maurits.evers@anu.edu.au>
Maintainer: Maurits Evers <maurits.evers@anu.edu.au>
Description: Transcriptome-wide analysis of RNA modifications.
Expand All @@ -27,5 +27,5 @@ Suggests:
testthat
License: GPL-3 | file LICENSE
LazyData: false
RoxygenNote: 5.0.1.9000
RoxygenNote: 6.1.1
VignetteBuilder: knitr
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exportMethods(GetLoci)
exportMethods(GetNumberOfLoci)
exportMethods(GetRef)
exportMethods(GetVersion)
exportMethods(Info)
exportMethods(show)
import(AnnotationDbi)
import(Biostrings)
import(GenomeInfoDb)
Expand Down
80 changes: 40 additions & 40 deletions R/classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@ setClass("txLoc",
version = "character"),
prototype = prototype(
loci = list(),
id = "",
refGenome = "",
version = ""),
);
id = NA_character_,
refGenome = NA_character_,
version = NA_character_)
)


###########################################################################
#################### GENERAL CLASS SLOT ACCESSORS #########################
###########################################################################


#' Method "GetLoci" for S4 object txLoc.
#'
#' Get the loci of a \code{txLoc} object
Expand Down Expand Up @@ -139,50 +138,51 @@ setMethod("GetVersion",
###################### SPECIFIC CLASS ACCESSORS ###########################
###########################################################################

#' Method "Info" for S4 object txLoc.
#'
#' Method "show" for S4 object txLoc.
#'
#' Print summary information about \code{txLoc} object.
#'
#'
#' @param x A \code{txLoc} object.
#'
#' @examples
#' \dontrun{
#' bedFile <- system.file("extdata",
#' "miCLIP_m6A_Linder2015_hg38.bed",
#' package = "RNAModR");
#' sites <- ReadBED(bedFile);
#' posSites <- SmartMap(sites, id = "m6A", refGenome = "hg38");
#' Info(posSites);
#' package = "RNAModR")
#' sites <- ReadBED(bedFile)
#' posSites <- SmartMap(sites, id = "m6A", refGenome = "hg38")
#' posSites
#' }
#'
#' @author Maurits Evers, \email{maurits.evers@@anu.edu.au}
#'
#' @exportMethod Info
setGeneric("Info", function(x) standardGeneric("Info"));

#' @rdname Info
setMethod("Info",
signature = "txLoc",
definition = function(x) {
cat("Object of class \"txLoc\".\n");
cat("\n");
cat(sprintf("ID = %s\n", slot(x, "id")));
cat(sprintf("Reference genome = %s\n", slot(x, "refGenome")));
cat(sprintf("Version = %s\n", slot(x, "version")));
cat(sprintf("Total # of sites = %i\n",
sum(sapply(slot(x, "loci"), nrow))));
cat(sprintf("Package = RNAModR"));
cat("\n");
loc <- slot(x, "loci");
nSec <- length(loc);
cat(sprintf("%i transcript sections: %s\n",
nSec,
paste0(names(loc), collapse = ", ")));
for (i in 1:nSec) {
cat(sprintf(" %10s: Number of loci = %i\n", names(loc)[i],
nrow(loc[[i]])));
}
});
#' @author Maurits Evers, \email{maurits.evers@anu.edu.au}
#'
#' @exportMethod show
#'
#' @rdname show
setMethod(
"show",
"txLoc",
function(object) {
cat("Object of class \"txLoc\".\n")
cat("\n")
cat(sprintf("ID = %s\n", slot(object, "id")))
cat(sprintf("Reference genome = %s\n", slot(object, "refGenome")))
cat(sprintf("Version = %s\n", slot(object, "version")))
cat(sprintf("Total # of sites = %i\n",
sum(sapply(slot(object, "loci"), nrow))))
cat(sprintf("Package = RNAModR (%s)", packageVersion("RNAModR")))
cat("\n")
loc <- slot(object, "loci")
nSec <- length(loc)
cat(sprintf("%i transcript sections: %s\n",
nSec,
paste0(names(loc), collapse = ", ")))
for (i in 1:nSec) {
cat(sprintf(" %10s: Number of loci = %i\n", names(loc)[i],
nrow(loc[[i]])))
}
}
)


#' Method "GetNumberOfLoci" for S4 object txLoc.
Expand Down
Loading

0 comments on commit 7e02f26

Please sign in to comment.