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

       
'''

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值