Skip to content

Commit

Permalink
fix man pages
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrue committed Jul 6, 2024
1 parent 20cabb3 commit c621dc9
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
config:
# - { os: windows-latest, bioc: 'devel'}
- { os: windows-latest, bioc: 'devel'}
- { os: macOS-latest, bioc: 'devel', curlConfigPath: '/usr/bin/'}
- { os: ubuntu-latest, bioc: 'devel'}
# - { os: ubuntu-latest, bioc: 'devel', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
Expand Down
12 changes: 6 additions & 6 deletions man/VcfBasicRules-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ In the following code snippets \code{x}, \code{values}, and \code{...}
are objects from any of the classes described in this help page, or
\code{VcfFilterRules}.

\describe{
\item{}{
\itemize{
\item{
\code{append(x, values, after = length(x))}:
Appends the values onto \code{x} at the index given by \code{after}.
}
\item{}{
\item{
\code{c(x, ...,)}:
Concatenates the filters objects in \code{...} onto the end of \code{x}.
}
Expand All @@ -175,8 +175,8 @@ produces a \code{VcfFilterRules} object.

\section{Evaluating}{
As described in the \code{S4Vectors} documentation:
\describe{
\item{}{
\itemize{
\item{
\code{eval(expr, envir, enclos)}:
Evaluates a rule instance (passed as the \code{expr} argument)
in their respective context of a \code{VCF} object
Expand All @@ -190,7 +190,7 @@ As described in the \code{S4Vectors} documentation:
\item{\strong{\code{FilterRules}}: \code{envir}}
}
}
\item{}{
\item{
\code{evalSeparately(expr, envir, enclos)}:

\code{subsetByFilter(x, filter)}
Expand Down
18 changes: 8 additions & 10 deletions man/VcfFilterRules-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -70,38 +70,36 @@ In the following code snippets \code{x} is a \code{VcfFilterRules} object.
}

\section{Constructors}{
\describe{}{
\code{VcfFilterRules(...)}
constructs an \code{VcfFilterRules} object from
\code{VcfFixedRules}, \code{VcfInfoRules}, \code{VcfVepRules},
and \code{VcfFilterRules} objects in \code{...}.
}
}

\section{Subsetting and Replacement}{
In the code snippets below, \code{x} is a \code{VcfFilterRules} object.

\describe{
\item{}{
\itemize{
\item{
\code{x[i, drop = TRUE]}: Subsets the filter rules using the
same interface as for \code{\linkS4class{Vector}}.
If all filter rules are of the same type and \code{drop=TRUE} (default),
the resulting object is re-typed to the most specialised class,
if possible. In other words, if all remaining filter rules are of
type \code{"vep"}, the object will be type as \code{VcfVepRules}.
}
\item{}{
\item{
\code{x[[i]]}: Extracts an expression or function via the same interface
as for \code{\linkS4class{List}}.
}
\item{}{
\item{
\code{x[i] <- value}: Replaces a filter rule by one of any valid class
(\code{VcfFixedRules}, \code{VcfInfoRules}, \code{VcfVepRules}, or
\code{VcfFilterRules}).
The active state(s), name(s), and type(s) (if applicable)
are transferred from \code{value}.
}
\item{}{
\item{
\code{x[[i]] <- value}: The same interface as for
\code{\linkS4class{List}}. The default active state for new
rules is \code{TRUE}.
Expand All @@ -116,12 +114,12 @@ while \code{values} and \code{...} are objects from any of the
classes \code{VcfFixedRules}, \code{VcfInfoRules}, \code{VcfVepRules},
or \code{VcfFilterRules}:

\describe{
\item{}{
\itemize{
\item{
\code{append(x, values, after = length(x))}:
Appends the values onto \code{x} at the index given by \code{after}.
}
\item{}{
\item{
\code{c(x, ...,)}:
Concatenates the filters objects in \code{...} onto the end of \code{x}.
}
Expand Down
95 changes: 95 additions & 0 deletions man/parseCSQToGRanges.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
\name{parseCSQToGRanges}

\alias{parseCSQToGRanges}
\alias{parseCSQToGRanges,VCF-method}

\title{
Parse the CSQ column of a VCF object into a GRanges object
}

\description{
Parse the CSQ column in a VCF object returned from the Ensembl
Variant Effect Predictor (VEP).

\strong{**This method was rescued following the deprecation of the package
\code{ensemblVEP} in the Bioconductor release \code{3.20}.**}
}

\usage{
\S4method{parseCSQToGRanges}{VCF}(x, VCFRowID=character(),
..., info.key = "CSQ")
}

\arguments{
\item{x}{
A \code{VCF} object.
}
\item{VCFRowID}{
A \code{character} vector of rownames from the original VCF.
When provided, the result includes a metadata column named
\sQuote{VCFRowID} which maps the result back to the row
(variant) in the original VCF.

When \code{VCFRowID} is not provided no \sQuote{VCFRowID}
column is included.
}
\item{info.key}{
The name of the INFO key that VEP writes the consequences to in the output
(default is \code{CSQ}). This should only be used if something other that
\code{CSQ} was passed in the --vcf_info_field flag in the output options.
}
\item{\dots}{
Arguments passed to other methods. Currently not used.
}
}

\details{
\describe{
\item{-}{
When \code{ensemblVEP} returns a \code{VCF} object, the consequence data
are returned unparsed in the 'CSQ' INFO column. \code{parseCSQToGRanges}
parses these data into a \code{GRanges} object that is expanded to match
the dimension of the 'CSQ' data. Because each variant can have multiple
matches, the ranges in the \code{GRanges} are repeated.

If rownames from the original VCF are provided as \code{VCFRowID} a
metadata column is included in the result that maps back to the row
(variant) in the original VCF. This option is only applicable when the
\code{info.key} field has data (is not empty).

If no \code{info.key} column is found the function returns the data in
\code{rowRanges()}.
}
}
}

\value{
Returns a \code{GRanges} object with consequence data as the
metadata columns. If no 'CSQ' column is found the \code{GRanges}
from \code{rowRanges()} is returned.
}

\author{
Valerie Obenchain, Kevin Rue-Albrecht
}

\references{
Ensembl VEP Home:
\url{http://uswest.ensembl.org/info/docs/tools/vep/index.html}
}

\examples{
library(VariantAnnotation)
file <- system.file("extdata", "moderate.vcf", package = "TVTB")
vep <- readVcf(file)

## The returned 'CSQ' data are unparsed.
info(vep)$CSQ

## Parse into a GRanges and include the 'VCFRowID' column.
vcf <- readVcf(file, "hg19")
csq <- parseCSQToGRanges(vep, VCFRowID=rownames(vcf))
csq[1:4]
}

\keyword{methods}
3 changes: 1 addition & 2 deletions man/vepInPhenoLevel-methods.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ considered.
}
\item{vepCol}{
VEP prediction fields; \code{character} vector of metadata columns in
\code{ensemblVEP::parseCSQToGRanges(vcf)}.
\code{parseCSQToGRanges(vcf)}.
}
\item{unique}{
If \code{TRUE}, consider only variants unique to the phenotype level
Expand Down Expand Up @@ -66,7 +66,6 @@ Kevin Rue-Albrecht

\seealso{
\code{\linkS4class{VCF}},
\code{\link{ensemblVEP}},
\code{\linkS4class{GRanges}},
and \code{\linkS4class{DataFrame}}.
}
Expand Down
2 changes: 1 addition & 1 deletion vignettes/VcfFilterRules.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ fixedVcf <- colnames(fixed(vcf))
fixedVcf
infoVcf <- colnames(info(vcf))
infoVcf
csq <- ensemblVEP::parseCSQToGRanges(x = evcf)
csq <- parseCSQToGRanges(x = evcf)
vepVcf <- colnames(mcols(csq))
vepVcf
```
Expand Down

0 comments on commit c621dc9

Please sign in to comment.