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

Fix the bug in issue#120 "NameError: name 'metadata' is not defined" #121

Merged
merged 4 commits into from
May 29, 2024
Merged
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
13 changes: 7 additions & 6 deletions parasorter/forest_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,6 @@ def format_nodes(node, node_style, sus_clades, t):
return supp, sus_clades


def parallel_susp_clades(trees):
"""Parallelizes the function suspicious_clades()"""
with Pool(processes=threads) as pool:
suspicious = list(pool.map(suspicious_clades, trees))
return suspicious


def nonredundant(result_clades):
Expand Down Expand Up @@ -675,13 +670,19 @@ def backpropagate_contamination(tree_file, cont_names):
os.mkdir(output_folder)

trees = glob.glob(f"{trees_folder}/*.raxml.support")
trees = [os.path.normpath(path).replace('\\', '/') for path in trees]

number_of_genes = len(trees)
metadata, tax_col = parse_metadata(args.metadata, args.input_metadata)
threads = args.threads
suspicious = []

if not args.backpropagate:
suspicious = parallel_susp_clades(trees)
# suspicious = parallel_susp_clades(trees)
for tree in trees:
suspicious.append(suspicious_clades(tree))
print(suspicious)

suspicious = sorted(suspicious)

make_txt = False
Expand Down
9 changes: 7 additions & 2 deletions phylofisher/matrix_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ def make_config():


def get_output_files():
# Accepted out formats with respective suffix
out_dict = {'fasta': 'fas',
'phylip': 'phy',
'phylip-relaxed': 'phy',
'nexus': 'nex'}

ret = [
f'{args.output}/matrix.fas',
f'{args.output}/matrix.{out_dict[args.out_format]}',
f'{args.output}/indices.tsv',
f'{args.output}/matrix_constructor_stats.tsv',
f'{args.output}/occupancy.tsv',
Expand Down Expand Up @@ -142,4 +147,4 @@ def run_snakemake(length_filter=False):
if args.clean_up:
clean_up()