下载基因组外显子信心
网站 ftp://ftp.ncbi.nlm.nih.gov/pub/CCDS/current_human/
wget ftp://ftp.ncbi.nlm.nih.gov/pub/CCDS/current_human/CCDS.current.txt
运行下列代码 得到外显子大约36M
import reimport osfrom collections import OrderedDictfrom operator import itemgetteros.chdir(‘/Users/yangqin/Desktop/biotree/python/‘) exonLength = 0 # 外显子长度尚未计算overlapExons = OrderedDict() with open(‘CCDS.current.txt‘, ‘rt‘) as f: # 把CCCDS.current.txt打开定义为f    for line in f: # 逐行读取f        if line.startswith(‘#‘): # 如果该行以井号开头,该行为表头            continue # 跳过该行        line = line.rstrip()  # 把右边的空格去掉,_.rstrip()把右边的空格去掉        lst = line.split(‘\t‘) # 用split分开该行的各列数据,以\t分隔        if lst[-2] == ‘-‘: # 如果倒数第二列是‘-’,没有外显子            continue # 跳过该行        lst[-2] = re.sub(‘\[|\]‘, ‘ ‘, lst[-2]) # 正则表达式,去掉倒数第二列两端的[],换成空格        exons = lst[-2].split(‘, ‘) # 把该列(每个基因)多个外显子隔开        for exon in exons:  # 对于每一个外显子            start = int(exon.split(‘-‘)[0]) # 拿到该外显子的起始坐标            end = int(exon.split(‘-‘)[1]) # 拿到该外显子的终止坐标            coordinate = lst[0] + ‘:‘ + exon # 定义每一个外显子,以防重复计算            if coordinate not in overlapExons.keys(): # 如果该外显子尚未计算                overlapExons[coordinate] = 1 # 加入该外显子                exonLength += end - start # 计算长度             print(exonLength)原文:http://www.cnblogs.com/qiniqnyang/p/6267106.html