Advertisement

R语言:创建bioconductor的package

阅读量:

创建bioconductor的package

Bioconductor是生物信息领域广泛使用的R语言软件包之一。我的研究方向集中于计算生物学中的方法论开发工作。因此计划将自己研发的方法整理成一个可选软件包供同行参考使用。

R包的指南包含两个详细的指导文档:
基础版本:
Bioconductor官方简介
高级版本:
R官方简介

从核心内容来看,BioC作为一个软件包主要包含R语言的功能。 BioC的官方简述则是对R官方简述的一种简化版描述。

按照Bioconductor的介绍

  • 在R Studio中搭建一个包。将自己编写的代码块放置于"R"文件夹内。
  • 更新DESCRIPTION文件以添加说明,并使用快捷键Ctrl+Shift+B来构建。
  • 修正NAMESPACE文件以明确指定内容。

export(‘myFun’,’hello’,’pname’)
import(‘GenomeInfoDb’)

第一行是向用户展示的函数,在自己包中所需调用的其他包名称位于第二行

  • documenting manual pages using the Rd format
    When documenting functions, employ the Rd format for naming.
    Functions should be named within the MyPkg-package.Rd file.
    For each function documented, create a corresponding manual entry located in the man directory.

编写vignettes旨在用于展示这些函数如何work together。vignettes需要用'.Rmd'来编写。

A well-written vignette should begin by introducing what the package is designed for, followed by a standard workflow outlining how this package might be utilized to achieve that objective. By doing so, it situates all the functions and classes within a broader context, enabling users new to the package to navigate effectively.

注记: 在下在处理namespace时, 导入操作总是失败; 真正原因在于忘记将导入函数包含到export中。

错误的例子:

复制代码
    export('myFun','hello')
    importFrom('GenomeInfoDb', 'genomeStyles')

正确的例子:

复制代码
    export('myFun','hello', 'genomeStyles')
    importFrom('GenomeInfoDb', 'genomeStyles')

tips:
R studio中多行注释快捷键:cmd+shift+C

全部评论 (0)

还没有任何评论哟~