首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

sam提取un地图ped seq

2012-12-21 
sam提取unmapped seq__author__ wanguan2000#codingutf-8import os.pathimport osimport sysimport r

sam提取unmapped seq

__author__ = 'wanguan2000'
#coding=utf-8
import os.path
import os
import sys
import re


filename = '/home/wanguan2000/pg/myNGS/result_NGS/cui3132/s31_1_s31_2.sam'
n = 0
m = 0
mn = 0
mydict ={}

with open(filename,'rU') as f:
??? for line in f:
??????? line = line.rstrip()
??????? if not line:
??????????? break
??????? if not line.startswith('@'):

?????????? spline = line.split('\t')
?????????? if 'chr21' == spline[2]:
?????????????? mn+=1
?????????????? print line

??????????????
'''
?????????? if not spline[2].startswith('chr'): # or spline[10] == '*':

????????????? # print line
?????????????? n +=1
?????????????? mydict[spline[2]] = mydict.get(spline[2],0)+1
?????????? elif '*' in spline[10]:
?????????????? m +=1
?????????? elif '0' == spline[4]:
'''
?????????????? #mydict[spline[2]] = mydict.get(spline[2],0)+1
??????? #else:
??????????? #print line

print n
print m
print mn
'''
for mykey in mydict:
??? print('%s\t%d' % (mykey,mydict[mykey]))
???

def readSam(filename,filehead='@HWI-ST499'):
??? n = 0
??? with open(filename,'rU') as f:
??????? while True:
??????????? line = f.readline
??????????? line = line.rstrip()
??????????? if not line:
??????????????? break
??????????? if line.startswith(filehead):
??????????????? print line

???????
'''

热点排行