R CMD检查警告:检查S3通用/方法一致性

时间:2016-08-13 00:56:26

标签: r s4

所以我正在编写一个包并有一些泛型,但不知道如何解决有关S3一致性的警告。手册说方法参数必须具有 all 泛型的参数并且顺序相同。我写的泛型都是单个参数泛型和单参数方法。为简洁起见,我只展示了我从大班继承的写作。

A类的第一种方法

#' features generic where features is a constructor from SummarizedExperiment clas
#' @name features
#' @rdname features-methods
#' @exportMethod features
setGeneric("features", function(x) standardGeneric("features"))


 #' method for features<-
 #' @name features<-
#' @rdname features-methods
#' @exportMethod features<-
setGeneric("features<-", function(x, value) standardGeneric("features<-"))

#' @rdname features-methods
#' @aliases features
setMethod("features", "KallistoExperiment", function (x) rowRanges(x))

B类方法

setMethod(&#34; features&#34;,&#34; RangedSummarizedExperiment&#34;,           function(x)rowRanges(x))

setReplaceMethod("features", c("RangedSummarizedExperiment", "ANY"), 
             function(x, value) {
               rowRanges(x) <- value
               return(x)
             })

所以这就是我所困惑的: 1)我从SummarizedExperiment继承了A类方法。事实上,我的A类是setClass(....,contains =&#34; RangedSummarizedExperiment&#34;)这就是定义A类的方法。 (有关详细信息,请参阅arcolombo / arkas github存储库)

还有其他几种方法,但是这些其他方法都是我的自定义类A所独有的。所以我不确定为什么S3不一致是警告(我正在遵循通用参数完全

所以&#39;功能&#39; generic是rowRanges的访问器。   其中rowRanges泛型写为

## Accessors

 rowRanges(x, ...)
 rowRanges(x, ...) <- value

问题是来自A类的泛型函数调用rowRanges(x),但它应该调用rowRanges(x,...)?

这个警告让我陷入困境。

谢谢大家和你们所有人的好事。 和平。 善良。 重复。

以下是我正在处理的第一个警告:

 * checking S3 generic/method consistency ... WARNING
Loading required package: rtracklayer
Loading required package: knitr
Loading required package: stringdist
Loading required package: biomaRt
Warning: replacing previous import ‘Biostrings::tail’ by ‘utils::tail’   when loading ‘TxDbLite’
Warning: replacing previous import ‘Biostrings::head’ by ‘utils::head’ when loading ‘TxDbLite’
  Loading required package: SummarizedExperiment
  Loading required package: Rsamtools
Loading required package: XVector
Loading required package: Biostrings
Loading required package: tools
Loading required package: ComplexHeatmap
Loading required package: grid
Attaching package: ‘ComplexHeatmap’
The following object is masked from ‘package:biomaRt’:
     select
The following object is masked from ‘package:AnnotationDbi’:
    select
Attaching package: ‘arkas’
The following object is masked from ‘package:GenomicFeatures’:
features
See section ‘Generic functions and methods’ in the ‘Writing R
Extensions’ manual.

这是整个第二次警告

Here is the second warning:

* checking replacement functions ... WARNING
Loading required package: rtracklayer
Loading required package: knitr
Loading required package: stringdist
Loading required package: biomaRt
Warning: replacing previous import ‘Biostrings::tail’ by ‘utils::tail’ when loading ‘TxDbLite’
Warning: replacing previous import ‘Biostrings::head’ by ‘utils::head’ when loading ‘TxDbLite’
Loading required package: SummarizedExperiment
Loading required package: Rsamtools
Loading required package: XVector
Loading required package: Biostrings
Loading required package: tools
Loading required package: ComplexHeatmap
Loading required package: grid
Attaching package: ‘ComplexHeatmap’
The following object is masked from ‘package:biomaRt’:
select
The following object is masked from ‘package:AnnotationDbi’:
select

Attaching package: ‘arkas’
The following object is masked from ‘package:GenomicFeatures’:

features

The argument of a replacement function which corresponds to the right
 hand side must be named ‘value’.

状态:4个警告,7个注意事项 看到   “/home/arcolombo/Documents/github_repos/arkas.Rcheck/00check.log” 详情。

我有4个警告,其中一些是关于缺少文档和使用注释。这两个细节用替换方法和泛型本身添加了细节。

当我改变泛型时,我也得到同样的警告:

setGeneric("features", function(x,...) standardGeneric("features"))


#' method for features<- 
#' @name features<-
#' @rdname features-methods
#' @exportMethod features<-
setGeneric("features<-", function(x,...,value)    standardGeneric("features<-"))

#' @rdname features-methods
#' @param x object with features defined
#' @param ... additional args 
#' @aliases features
setMethod("features", "KallistoExperiment", function (x,...) rowRanges(x,...))

(这是添加rowRanges(x,...)和...)

也许关于头部/尾部的警告信息替换以前的导入警告是罪魁祸首?

更新

所以我试图减少一些已经出现的屏蔽消息。经过一些清洁之后,这里连续发出2次关于仿制药和方法的警告。

非常重要的注意事项

而不是将泛型重写为名为rowRanges的标题功能。我的班级是SummarizedExperiment的孩子,这意味着我的班级直接继承了rowRanges。所以我删除了围绕rowRanges构建的泛型,我只是在我的R函数中直接使用rowRanges。 但是下面是警告标志。   我仍然不确定这个错误的原因。

  • 检查S3通用/方法一致性......警告 加载所需的包:rtracklayer 装载所需包装:knitr 加载必需的包:stringdist 加载所需的包:SummarizedExperiment 加载所需的包:Rsamtools 加载所需包装:XVector 加载所需包装:Biostrings 加载所需的包:工具 加载所需的包:ComplexHeatmap 加载所需的包:grid

附加包:'ComplexHeatmap'

以下对象从'package:AnnotationDbi'屏蔽:

select

参见'写作R'中的'通用函数和方法'部分 扩展手册。 *检查更换功能......警告 加载所需的包:rtracklayer 装载所需包装:knitr 加载必需的包:stringdist 加载所需的包:SummarizedExperiment 加载所需的包:Rsamtools 加载所需包装:XVector 加载所需包装:Biostrings 加载所需的包:工具 加载所需的包:ComplexHeatmap 加载所需的包:grid

附加包:'ComplexHeatmap'

以下对象从'package:AnnotationDbi'屏蔽:

select

与右边对应的替换函数的参数 手边必须命名为'value'。 *检查外国函数调用...注意 加载所需的包:rtracklayer 装载所需包装:knitr 加载必需的包:stringdist 加载所需的包:SummarizedExperiment 加载所需的包:Rsamtools 加载所需包装:XVector 加载所需包装:Biostrings 加载所需的包:工具 加载所需的包:ComplexHeatmap 加载所需的包:grid

附加包:'ComplexHeatmap'

以下对象从'package:AnnotationDbi'屏蔽:

select

参见'写作R'中的“系统和外语接口”一章 扩展手册。

0 个答案:

没有答案