Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rcastelo committed Apr 22, 2024
1 parent b720afb commit a09ae7d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: atena
Type: Package
Title: Analysis of Transposable Elements
Version: 1.9.6
Version: 1.9.7
Authors@R: c(
person("Beatriz", "Calvo-Serra", email="[email protected]",
role=c("aut", "cre")),
Expand All @@ -24,6 +24,7 @@ Imports:
stats,
Matrix,
BiocGenerics,
MatrixGenerics,
BiocParallel,
S4Vectors,
IRanges,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ importFrom(Matrix,sparseMatrix)
importFrom(Matrix,summary)
importFrom(Matrix,t)
importFrom(Matrix,which)
importFrom(MatrixGenerics,rowRanges)
importFrom(Rsamtools,"asMates<-")
importFrom(Rsamtools,"yieldSize<-")
importFrom(Rsamtools,BamFileList)
Expand Down
36 changes: 32 additions & 4 deletions R/annotations.R
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,13 @@ OneCodeToFindThemAll <- function(gr, dictionary=NULL, fuzzy = FALSE,

#' Getter functions of TE classes from parsed RepeatMasker annotations.
#'
#' @param annot A \link[GenomicRanges:GRangesList-class]{GRangesList} object
#' obtained from parsing RepeatMasker annotations with
#' \code{OneCodeToFindThemAll()} or \code{rmskatenaparser()}
#' function.
#' @param annot A [`GRanges`] or [`GRangesList`] object obtained with the
#' function `annotaTES()`, using either [`OneCodeToFindThemAll`]
#' or [`rmskatenaparser`] as RepeatMasker parser functions.
#' Alternatively, if `annot` is a [`QuantifyParam`] or a
#' [`SummarizedExperiment`] object produced by the `qtex()`
#' function, this function will attempt to extract the
#' corresponding annotations from inside those objects.
#'
#' @param relLength (Default 0.9) Numeric value that can take values between 0
#' to 1. Sets the minimum relative length required for
Expand Down Expand Up @@ -365,6 +368,8 @@ OneCodeToFindThemAll <- function(gr, dictionary=NULL, fuzzy = FALSE,
getLTRs <- function(annot, relLength=0.9, fullLength=TRUE, partial=FALSE,
soloLTR=FALSE, otherLTR=FALSE, returnMask=FALSE) {

annot <- .fetchAnnotationsFromObject(annot)

cnames <- c("Status", "RelLength", "Class")
mask <- cnames %in% colnames(mcols(annot))
if (any(!mask))
Expand Down Expand Up @@ -409,6 +414,9 @@ getLTRs <- function(annot, relLength=0.9, fullLength=TRUE, partial=FALSE,
#' @importFrom GenomicRanges mcols
#' @export
getLINEs <- function(annot, relLength=0.9, returnMask=FALSE) {

annot <- .fetchAnnotationsFromObject(annot)

cnames <- c("RelLength", "Class")
mask <- cnames %in% colnames(mcols(annot))
if (any(!mask))
Expand Down Expand Up @@ -446,6 +454,9 @@ getLINEs <- function(annot, relLength=0.9, returnMask=FALSE) {
#' @importFrom GenomicRanges mcols
#' @export
getSINEs <- function(annot, relLength=0.9, returnMask=FALSE) {

annot <- .fetchAnnotationsFromObject(annot)

cnames <- c("RelLength", "Class")
mask <- cnames %in% colnames(mcols(annot))
if (any(!mask))
Expand Down Expand Up @@ -483,6 +494,9 @@ getSINEs <- function(annot, relLength=0.9, returnMask=FALSE) {
#' @importFrom GenomicRanges mcols
#' @export
getDNAtransposons <- function(annot, relLength=0.9, returnMask=FALSE) {

annot <- .fetchAnnotationsFromObject(annot)

cnames <- c("RelLength", "Class")
mask <- cnames %in% colnames(mcols(annot))
if (any(!mask))
Expand Down Expand Up @@ -511,6 +525,20 @@ getDNAtransposons <- function(annot, relLength=0.9, returnMask=FALSE) {
res
}

#' @importFrom MatrixGenerics rowRanges
.fetchAnnotationsFromObject <- function(object) {
annot <- object

if (is(object, "QuantifyParam"))
annot <- features(object)
else if (is(object, "SummarizedExperiment"))
annot <- rowRanges(object)
else if (!is(object, "GRangesList") && !is(object, "GRanges"))
stop(paste("input annotations should be either a 'GenomicRanges',",
"'QuantifyParam' or a 'SummarizedExperiment' object."))
annot
}

#' @importFrom stats setNames
.builDictionary <- function(gr, fuzzy=FALSE) {
annltr <- gr[gr$repClass=="LTR"]
Expand Down
11 changes: 7 additions & 4 deletions man/annotaTEsGetters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a09ae7d

Please sign in to comment.