在现实生活中,我们经常会遇到从0开始计数还是从1开始计数的问题。此处先从现实生活中的实例说起,过渡到电脑编程,然后再详细解释基因组的坐标问题,最后列出一些有用的网址,感兴趣的可以继续阅读、加深理解。
In British English the floor of a building at street level is the ground floor and the floor above that is the first floor. In US English the street-level floor is the first floor and the one above is the second floor.
在多数程序(此处以Perl为例)中,计数都是(此处以数组为例)从0开始的。比如,对于数组@array来说,它的第一个元素是$array[0],第二个元素是$array[1],…… 正因为这种程序与现实的差异,导致了程序员们养成了从0开始数数的习惯。(参看:9条编程带给程序员的坏习惯;)
在生物学的基因组坐标的表示中,有两种方法:一种是大家比较容易理解的全包含的1-based(one-based, fully-closed),如[start, end];另一种是容易引起迷惑但却常用而且易用的半包含的0-based(zero-based, half-open),如[start, end)。下面仅根据我的理解通过一个简单的例子来说明一下。至于这两种方法的详细区别以及各自的优缺点,请参考后面给出的链接。
其中TG的坐标位置如何表示呢?
还有一种不同的(真正的?)解释方法如下:
我们常用的数据格式及数据库中,那些使用的1-based,那些使用的0-based?
Coordinate Transforms 备注:如果你发现本文有错误,或者有需要修改、添加的内容,请通知我。先行谢过!补充(20110506)Explanation from “The SAM Format Specification“.
A coordinate system where the first base of a sequence is one. In this coordinate system, a region is specified by a closed interval. For example, the region between the 3rd and the 7th bases inclusive is [3, 7]. The SAM, GFF and Wiggle formats are using the 1-based coordinate system.
A coordinate system where the first base of a sequence is zero. In this coordinate system, a region is specified by a half-closed-half-open interval. For example, the region between the 3rd and the 7th bases inclusive is [2, 7). The BAM, BED, and PSL formats are using the 0-based coordinate system. 相关获取基因组的子序列2011年5月14日在“所有博文”中 [更新]基因组的坐标系统:0-based与1-based2011年5月6日在“所有博文”中 人类基因组中的基因密度、特征长度和SNP密度2012年10月13日在“所有博文”中 |
|