You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As much as i love the cut_read() and CutReads() functions, these needs some work for long-term maintainability.
docstrings have already been added in 602caa8 but it would be good to have extra splitting of these functions in smaller chunks, as well as better function naming.
f"Thread {_threadnumber} @ processID {os.getpid()}\t::\tReads processing {completion_percentage}% complete.\n\tMODULE {PositionInOrBeforePrimer.__module__}.{PositionInOrBeforePrimer.__qualname__} CACHE INFORMATION\n\t\tCache size usage = {cache_usage_before:.2f}%\n\t\tCache hit ratio = {cache_hit_ratio_before:.2f}%\n\tMODULE {PositionInOrAfterPrimer.__module__}.{PositionInOrAfterPrimer.__qualname__} CACHE INFORMATION\n\t\tCache size usage = {cache_usage_after:.2f}%\n\t\tCache hit ratio = {cache_hit_ratio_after:.2f}%"
)
removed_coords_fw= []
removed_coords_rv= []
previous_seq: str="impossible"
cutting_is_done=False
for_inrange(max_iter):
ifcutting_is_done:
break
forhitinAln.map(
seq
): # Yields only one (or no) hit, as the aligner object was initiated with best_n=1
iflen(seq) <5andlen(qual) <5:
cutting_is_done=True
break
ifseq==previous_seq:
processed_readnames.append(name)
processed_sequences.append(seq)
processed_qualities.append(qual)
removed_coords_per_read.append(
removed_coords_fw+removed_coords_rv
)
cutting_is_done=True
break
previous_seq=seq
# Fetch the primer coordinates that correspond to the reference that the read maps to
# we're using tuples here because they are hashable
FWTuple: Tuple[int, ...] =tuple(FWDict[hit.ctg])
RVTuple: Tuple[int, ...] =tuple(RVDict[hit.ctg])
ifnotFWTupleornotRVTuple:
log.debug(
f"Thread {_threadnumber} @ processID {os.getpid()}\t::\tRead with name '{name}' aligns to '{hit.ctg}', but there are no primers affiliated with '{hit.ctg}'."
As much as i love the
cut_read()
andCutReads()
functions, these needs some work for long-term maintainability.docstrings have already been added in 602caa8 but it would be good to have extra splitting of these functions in smaller chunks, as well as better function naming.
AmpliGone/AmpliGone/cut_reads.py
Lines 13 to 294 in 910f75a
The text was updated successfully, but these errors were encountered: