Changing CladeGrabbing.py to use less than or equal to for number of contaminants

This commit is contained in:
Auden Cote-L'Heureux 2024-11-01 10:34:57 -04:00 committed by GitHub
parent d249add545
commit fb6e7aa6e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,7 +158,7 @@ def get_subtrees(args, file):
#Grab a clade as a subtree if 1) it has enough target taxa; 2) it has enough "at least" taxa; 3) it does not have too many contaminants
if len(target_leaves) >= args.min_presence and len(required_taxa_leaves) >= args.required_taxa_num and ((args.contaminants < 1 and len(leaves) < args.contaminants * len(target_leaves)) or len(leaves) < args.contaminants):
if len(target_leaves) >= args.min_presence and len(required_taxa_leaves) >= args.required_taxa_num and ((args.contaminants < 1 and len(leaves) <= args.contaminants * len(target_leaves)) or len(leaves) <= args.contaminants):
selected_nodes.append(node)
seen_leaves.extend([leaf.name for leaf in node])
#Write the subtrees to output .tre files