Skip to content

Commit

Permalink
[bugfix] correct bedfile's name into amplicon YAML
Browse files Browse the repository at this point in the history
- wrong comments were added when YAML file has label with "? "
  • Loading branch information
DrYak committed Oct 11, 2024
1 parent 6e8cf98 commit 26dc7a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cojac/cooc_mutbamscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,16 @@ def load_all_amplicons(inamp):

def add_name_comments(in_str, amp_bed):
out_str = ""
rxnum = re.compile(r"^\d+(?=_)")
rxnum = re.compile(r"^(?:\? +)?(?P<num>\d+)(?=_)")

n = None
for l in in_str.splitlines():
find_n = rxnum.match(l)
if find_n:
n = int(find_n.group(0))
if l[-1] == "]" and n is not None:
n = int(find_n.groupdict().get("num", 0))
if l[-1] == "]" and n:
l += f" #\t{amp_bed['amp_num'][n - 1]}"
n = None
out_str += f"{l}\n"

return out_str
Expand Down

0 comments on commit 26dc7a5

Please sign in to comment.