Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support strain level #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions combine_kreports.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def main():


#Initialize combined values
main_lvls = ['U','R','D','K','P','C','O','F','G','S']
map_lvls = {'kingdom':'K', 'superkingdom':'D','phylum':'P','class':'C','order':'O','family':'F','genus':'G','species':'S'}
main_lvls = ['U','R','D','K','P','C','O','F','G','S', 'S1', 'T']
map_lvls = {'kingdom':'K', 'superkingdom':'D','phylum':'P','class':'C','order':'O','family':'F','genus':'G','species':'S', 'strain': 'T'}
count_samples = 0
num_samples = len(args.r_files)
sample_names = args.s_names
Expand Down
6 changes: 4 additions & 2 deletions kreport2mpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def process_kraken_report(curr_str):
try:
taxid = int(split_str[-3])
level_type = split_str[-2]
map_kuniq = {'species':'S', 'genus':'G','family':'F',
map_kuniq = {'strain': 'T', 'species':'S', 'genus':'G','family':'F',
'order':'O','class':'C','phylum':'P','superkingdom':'D',
'kingdom':'K'}
if level_type not in map_kuniq:
Expand Down Expand Up @@ -138,7 +138,7 @@ def main():
o_file.write("#Classification\t" + os.path.basename(args.r_file) + "\n")

#Read through report file
main_lvls = ['R','K','D','P','C','O','F','G','S']
main_lvls = ['R','K','D','P','C','O','F','G','S','S1','T']
for line in r_file:
report_vals = process_kraken_report(line)
#If header line, skip
Expand All @@ -155,6 +155,8 @@ def main():
level_type = "k"
elif level_type == "D":
level_type = "k"
elif level_type == "S1":
level_type = "t"
level_str = level_type.lower() + "__" + name
#Determine full string to add
if prev_lvl_num == -1:
Expand Down