Skip to content

Commit

Permalink
Make lenient mode more lenient and add more explaination for ambiguou…
Browse files Browse the repository at this point in the history
…s outcome
  • Loading branch information
remiolsen committed Mar 13, 2024
1 parent 9fe7cfc commit 40825d4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions anglerfish/anglerfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
logging.basicConfig(level=logging.INFO)
log = logging.getLogger("anglerfish")

MAX_PROCESSES = 256 # Ought to be enough for anybody


def run_demux(args):
multiprocessing.set_start_method("spawn")
Expand Down Expand Up @@ -54,6 +56,11 @@ def run_demux(args):
)
exit()
log.debug(f"Samplesheet bc_dist == {bc_dist}")
if args.threads > MAX_PROCESSES:
log.warning(
f" Setting threads to {MAX_PROCESSES} as the maximum number of processes is {MAX_PROCESSES}"
)
args.threads = MAX_PROCESSES

# Sort the adaptors by type and size
adaptors_t = [(entry.adaptor.name, entry.ont_barcode) for entry in ss]
Expand Down Expand Up @@ -151,9 +158,10 @@ def run_demux(args):
sorted([len(i[1]) for i in flipped.values()])[-1]
== sorted([len(i[1]) for i in flipped.values()])[-2]
):
log.info(
" Lenient mode: Could not find any barcode reverse complements with unambiguously more matches"
log.warning(
" Lenient mode: Could not find any barcode reverse complements with unambiguously more matches. Using original index orientation for all adaptors. Please study the results carefully!"
)
no_matches, matches = flipped["original"]
elif (
best_flip != "None"
and len(flipped[best_flip][1])
Expand All @@ -167,6 +175,7 @@ def run_demux(args):
log.info(
f" Lenient mode: using original index orientation for {adaptor_name}"
)
no_matches, matches = flipped["original"]
else:
no_matches, matches = cluster_matches(
adaptors_sorted[key], fragments, args.max_distance
Expand Down

0 comments on commit 40825d4

Please sign in to comment.