我正在编写一个名为Expression
的S4类,并希望包含一个S4对象DESeq2 = "DESeqDataSet"
作为插槽:
setClass(
Class = "Expression",
representation = representation (
species = "character",
edgeR = "DGEList",
DESeq2 = "DESeqDataSet",
lengths = "matrix",
individuals = "vector",
treatments = "vector",
id = "vector",
samples = "vector",
sample_prep = "vector",
genome_type = "vector",
molecule_type = "vector",
blast_hit = "vector",
rRNA = "vector",
protein = "vector"
))
但是当我检查包裹时,我收到以下警告:
Found the following significant warnings:
Warning: undefined slot classes in definition of "Expression": DESeq2(class "DESeqDataSet")
该类工作正常(即,现在有错误),但我想在我们的代码中修复所有警告。
包DESeqDataSet
对象(DESeq2
,也是我们给插槽的名称)的包将导入包DESCRIPTION
文件中。我是否需要做其他事情才能使其内容可用于插槽?例如,我使用setOldClass()
使S3类可用于S4插槽。
以下是一个抛出警告的travis-ci构建示例 - https://travis-ci.org/caseywdunn/agalmar/builds/138564256
答案 0 :(得分:3)
Class definitions need to be imported, just like functions, generics, and methods. So in the NAMESPACE file say
importClassesFrom("DESeq2", "DESeqDataSet")
I believe the roxygen2 notation is @importClassesFrom DESeq2 DESeqDataSet
答案 1 :(得分:0)
您可以使用" contains"来解决您的问题。 setClass函数的参数。包含可以定义任何类型或对象。
setClass(
Class = "Expression",
representation = representation (
species = "character",
edgeR = "DGEList",
DESeq2 = "DESeqDataSet",
lengths = "matrix",
individuals = "vector",
treatments = "vector",
id = "vector",
samples = "vector",
sample_prep = "vector",
genome_type = "vector",
molecule_type = "vector",
blast_hit = "vector",
rRNA = "vector",
protein = "vector"
),
contains = c("DGEList", "DESeqDataSet")
)
希望这有帮助。