def read_tagger(alignment, method='median'):
""" tag a read alignment to a genomic locus
Args:
Returns:
"""
tagger_func = {
# center of the read; must dicard junction reads
'median': lambda x: -1 if 'N' in x.cigarstring else int(np.median(x.positions))+1,
# start site of the read; trunction in iCLIP/eCLIP
'start': lambda x: x.positions[-1] if x.is_reverse else x.positions[0]+1
}
try:
tag=tagger_func[method](alignment)
except:
tag=-1
return tag
评论列表
文章目录