INNER CODE UNIT · Python
parse_kraken
nf-core/eager · bin/kraken_parse.py:50
def parse_kraken(infile, countlim):
'''
INPUT:
infile (str): path to kraken report file
countlim (int): lowest count threshold to report hit
OUTPUT:
resdict (dict): key=taxid, value=readCount
'''
with open(infile, 'r') as f:
read_dict = {}
kmer_dict = {}
csvreader = csv.reader(f, delimiter='\t')
for line in csvreader:
reads = int(line[1])
if reads >= countlim:
taxid = line[6]
kmer = line[3]