def find_readsAlignScore(filterAlignFiles):
    h_readId = {}
    for filterAlignFile in filterAlignFiles:
        with open(filterAlignFile, 'r') as in1:
            for ln in in1:
                if (ln[0] == '@' or ln[0] == '#'):
                    continue
                l = ln.split('\t')
                readId = l[0]
                aScore = samUtils.findSamAlignHiScore(l)
                if aScore is not None:
                    score = h_readId.get(readId, None)
                    if (score == None) or (score < aScore):
                        h_readId[readId] = aScore
    return h_readId
示例#2
0
def find_readsAlignScore(filterAlignFiles):
	h_readId = {}
	for filterAlignFile in filterAlignFiles:
		with open(filterAlignFile,'r') as in1:
			for ln in in1:
				if (ln[0] == '@' or ln[0] == '#'):
					continue
				l = ln.split('\t')
				readId=l[0]
				aScore = samUtils.findSamAlignHiScore(l)
				if aScore is not None:
					score = h_readId.get(readId,None)
					if (score == None) or (score < aScore):
						h_readId[readId] = aScore
	return h_readId
示例#3
0
def filter_alignment(targetAlignFile, filterAlignFiles, outAlignFile):
	h_readId = find_readsAlignScore(filterAlignFiles)
	with open(targetAlignFile,'r') as in1:
		with open(outAlignFile,'w') as out1:
			for ln in in1:
				if (ln[0] == '@' or ln[0] == '#'):
					out1.write(ln)
					continue
				l = ln.split('\t')
				readId=l[0]
				aScore = samUtils.findSamAlignHiScore(l)
				if (aScore is not None):
					score = h_readId.get(readId, None)
					if (score == None) or (score < aScore):
						#This read is (not/having low scores) in the filterAlignFiles 
						out1.write(ln)
	return outAlignFile
def filter_alignment(targetAlignFile, filterAlignFiles, outAlignFile):
    h_readId = find_readsAlignScore(filterAlignFiles)
    with open(targetAlignFile, 'r') as in1:
        with open(outAlignFile, 'w') as out1:
            for ln in in1:
                if (ln[0] == '@' or ln[0] == '#'):
                    out1.write(ln)
                    continue
                l = ln.split('\t')
                readId = l[0]
                aScore = samUtils.findSamAlignHiScore(l)
                if (aScore is not None):
                    score = h_readId.get(readId, None)
                    if (score == None) or (score < aScore):
                        #This read is (not/having low scores) in the filterAlignFiles
                        out1.write(ln)
    return outAlignFile