前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >读书笔记05-可重复工作执行简明指南(下)

读书笔记05-可重复工作执行简明指南(下)

作者头像
北野茶缸子
发布2022-02-08 15:26:19
2650
发布2022-02-08 15:26:19
举报
  • Date : [[2021-12-03_Fri]]
  • Tags : #读书笔记/可重复工作执行简明指南 #读书笔记/index/01 #time/2022
  • 参考:
    • Package functions for reuse (kbroman.org)[1]
    • Use version control (kbroman.org)[2]
    • License your software (kbroman.org)[3]

0-前言

最近读了 Karl Broman[4]initial steps toward reproducible research (kbroman.org)[5],颇有感悟,结合自己阅读时候的体验,分享给你们。

书接上回:

读书笔记04-可重复工作执行简明指南(中) (qq.com)

读书笔记02-可重复工作执行简明指南(上) (qq.com)

7-将你好用的函数写成R包

之前我们提到过: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]

8-版本控制

其实这一部分,也一直是我欠缺考虑的。因为缺乏团队合作,我的版本控制仅仅限制于将每次自己的写的R 包的打包文件进行保存。并在readme 文件以日期为颗粒进行更新记录:

以及借助github 进行版本控制:

从我个人角度来看,对于成规模的团队来说,无论大小,版本的控制都是非常重要的。

比如这里作者就比较了我之前的这种打包方法和使用git 版本控制方法的差异,git 版本控制的优势在于:

  • 可以回溯每次修改的内容,缩小到代码的尺度查看修改情况;
  • 方便你随时回到不同的版本,以便修复某些新版本中代码的bug;
  • 可以让你放开双手,不必担心你的天马行空会破坏现有的建设;
  • 非常关键的一点,便于团队合作,即使你们的代码功能接近,也可以通过不同的分支以进行处理。

下面是两个教程: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]

9-你的代码的证书(License your software)

通常来说,这也是被大多数人忽视的点(比如我)。

如果你的代码/软件想要开源或者分享到网络的话,需要选择一个合适的证书。

通常有两个作用:

  • 版权保护,你的知识版权;
  • 保护作者,如果有其他人利用这个代码做了违法用途。

下面有几个可以了解不同证书的文章与资源: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.

除非是你的文章或影音资料。

10-拓展阅读

总的来说,真是一个宝藏作者,我自己学了太多的知识。

除了这个合集文章外,作者还有很多资源也值得学习: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

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-01-07,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 北野茶缸子 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 0-前言
  • 7-将你好用的函数写成R包
  • 8-版本控制
  • 9-你的代码的证书(License your software)
  • 10-拓展阅读
    • 参考资料
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档