Running predictCoding on an empty range object currently does not return columns for REFAA and VARAA:
library(VariantAnnotation)
library(BSgenome.Hsapiens.UCSC.hg19)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation")
vcf <- readVcf(fl, "hg19")[123] # non-coding variant
seqlevels(vcf) <- "chr22"
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
coding <- predictCoding(vcf, txdb, seqSource=Hsapiens)
coding$REFAA # NULL instead of AAStringSet()
coding$VARAA # NULL instead of AAStringSet()
Shouldn't this rather return empty AAStringSet objects? If so, the following changes would be required:
--- a/R/methods-predictCoding.R
+++ b/R/methods-predictCoding.R
@@ -104,8 +110,6 @@ setMethod("predictCoding", c("VRanges", "ANY", "ANY", "missing"),
## variant location in cds region
mcols(query) <- append(mcols(query), DataFrame(varAllele=varAllele))
txlocal <- .localCoordinates(query, cdsbytx, ignore.strand=FALSE, ...)
- if (length(txlocal) == 0)
- return(txlocal)
## reverse complement "-" strand
valid <- rep(TRUE, length(txlocal))
@@ -189,7 +193,7 @@ setMethod("predictCoding", c("VRanges", "ANY", "ANY", "missing"),
consequence <- factor(consequence)
mcols(txlocal) <- append(mcols(txlocal),
- DataFrame(GENEID=NA_character_,
+ DataFrame(GENEID=rep(NA_character_, length(txlocal)),
CONSEQUENCE=consequence,
REFCODON=refCodon,
VARCODON=varCodon,
The reason for this is that any downstream operation on those two fields (e.g. reverse or subseq) errors instead of returning an empty result. This patch fixes that behavior, without adding any significant computation time.
Running
predictCodingon an empty range object currently does not return columns forREFAAandVARAA:Shouldn't this rather return empty
AAStringSetobjects? If so, the following changes would be required:The reason for this is that any downstream operation on those two fields (e.g.
reverseorsubseq) errors instead of returning an empty result. This patch fixes that behavior, without adding any significant computation time.