最近读了 Karl Broman[4] 的initial steps toward reproducible research (kbroman.org)[5],颇有感悟,结合自己阅读时候的体验,分享给你们。
书接上回:
读书笔记04-可重复工作执行简明指南(中) (qq.com)
读书笔记02-可重复工作执行简明指南(上) (qq.com)
之前我们提到过:5-将你的重复代码打包成函数,并善用循环
,但其实很多时候,你的某些数据处理的步骤,除了在每个文件中专门放一个function 文件外,我们其实可以将这些好用的函数写成R包。
比如y叔叔的yyplot,或者是一些自动化操作比如:xiayh17/RNAseqStat: A Pipeline to Process RNAseq Data (github.com)[6]
生信技能树出品的让你变得越来越懒的R 包:
除了可以让他们结合你的项目工作流实现更方便的自动化,你还可以将他们分享到github, cran 等平台,方便其他人使用,甚至发表论文。
比如这篇文章:为新手准备的现代化 R 包开发流程 (qq.com)
如果你是py 用户,那么学习编写模块是你不可缺少的:6. Modules — Python 3.10.1 documentation[7]
其实这一部分,也一直是我欠缺考虑的。因为缺乏团队合作,我的版本控制仅仅限制于将每次自己的写的R 包的打包文件进行保存。并在readme 文件以日期为颗粒进行更新记录:
以及借助github 进行版本控制:
从我个人角度来看,对于成规模的团队来说,无论大小,版本的控制都是非常重要的。
比如这里作者就比较了我之前的这种打包方法和使用git 版本控制方法的差异,git 版本控制的优势在于:
下面是两个教程:Git - About Version Control (git-scm.com)[8]git/github guide (kbroman.org)[9]
不过这里我也比较推荐使用github desktop, github desktop项目版本控制 - iTlijun - 博客园 (cnblogs.com)[10]:
至少非常适合像我这样不懂git 的人。
不过上面教程中有一篇也很有意思,比如直接在R studio 中使用git:git/github with RStudio (kbroman.org)[11]
通常来说,这也是被大多数人忽视的点(比如我)。
如果你的代码/软件想要开源或者分享到网络的话,需要选择一个合适的证书。
通常有两个作用:
下面有几个可以了解不同证书的文章与资源:Pick a License, Any License (codinghorror.com)[12](11条消息) 软件授权License的区别_一切有为法,如梦幻泡影,如露亦如电,应作如是观-CSDN博客[13]TLDRLegal - Software Licenses Explained in Plain English[14]
从作者来说:I choose between the MIT license[15] and the GNU General Public License (GPL)[16].
如果使用的是MIT 或GNU 证书,记得以下声明:With the MIT license, I would include the full text[17], filling in your personal details. With the GPL, take a look at these instructions[18]: the process involves adding two elements to each source file of your program: a copyright notice (such as “Copyright 1999 Terry Jones”), and a statement of copying permission, saying that the program is distributed under the terms of the GNU General Public License.
详细内容可以参见上面的资料。
并且作者不建议使用 Creative Commons (CC) :An important thing to remember: don’t use a Creative Commons[19] (CC) license for software. Creative Commons licenses (like CC-BY[20]) are great, but they’re for things like articles, books, and videos, but not software. As they say in their FAQ[21]: We recommend against using Creative Commons licenses for software. Use CC licenses for your lecture notes, slides, and articles, but not for your software.
除非是你的文章或影音资料。
总的来说,真是一个宝藏作者,我自己学了太多的知识。
除了这个合集文章外,作者还有很多资源也值得学习:Resources (kbroman.org)[22]
[1]
Package functions for reuse (kbroman.org): https://kbroman.org/steps2rr/pages/packages.html
[2]
Use version control (kbroman.org): https://kbroman.org/steps2rr/pages/version_control.html
[3]
License your software (kbroman.org): https://kbroman.org/steps2rr/pages/licenses.html
[4]
Karl Broman: https://kbroman.org/
[5]
initial steps toward reproducible research (kbroman.org): https://kbroman.org/steps2rr/
[6]
xiayh17/RNAseqStat: A Pipeline to Process RNAseq Data (github.com): https://github.com/xiayh17/RNAseqStat
[7]
6. Modules — Python 3.10.1 documentation: https://docs.python.org/3/tutorial/modules.html
[8]
Git - About Version Control (git-scm.com): https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control
[9]
git/github guide (kbroman.org): https://kbroman.org/github_tutorial/
[10]
github desktop项目版本控制 - iTlijun - 博客园 (cnblogs.com): https://www.cnblogs.com/iTlijun/p/5129759.html
[11]
git/github with RStudio (kbroman.org): https://kbroman.org/github_tutorial/pages/rstudio.html
[12]
Pick a License, Any License (codinghorror.com): https://blog.codinghorror.com/pick-a-license-any-license/
[13]
(11条消息) 软件授权License的区别_一切有为法,如梦幻泡影,如露亦如电,应作如是观-CSDN博客: https://blog.csdn.net/iteye_3592/article/details/82408523
[14]
TLDRLegal - Software Licenses Explained in Plain English: https://tldrlegal.com/
[15]
MIT license: https://en.wikipedia.org/wiki/MIT_License
[16]
GNU General Public License (GPL): https://www.gnu.org/copyleft/gpl.html
[17]
full text: https://opensource.org/licenses/MIT
[18]
these instructions: https://www.gnu.org/licenses/gpl-howto.html
[19]
Creative Commons: https://creativecommons.org/
[20]
CC-BY: https://creativecommons.org/licenses/by/3.0/
[21]
they say in their FAQ: https://wiki.creativecommons.org/FAQ#Can_I_use_a_Creative_Commons_license_for_software.3F
[22]
Resources (kbroman.org): https://kbroman.org/steps2rr/pages/resources.html