Skip to content

Commit

Permalink
Added value ploid for --ambiguity-usage option
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy authored and Amy committed Feb 13, 2023
1 parent 98e0bec commit 635f507
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions quast_libs/ca_utils/analyze_contigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ def analyze_contigs(ca_output, contigs_fpath, unaligned_fpath, unaligned_info_fp
top_aligns = top_aligns[1:]
for align in top_aligns:
ca_output.stdout_f.write('\t\t\tSkipping alignment ' + str(align) + '\n')
# This is a template for future "ploid" ambiguity-usage flag, need to change it later:
elif qconfig.ambiguity_usage == "ploid":
ca_output.stdout_f.write('\t\tUsing only first of these alignment (option --ambiguity-usage is set to "one"):\n')
ca_output.stdout_f.write('\t\t\tAlignment: %s\n' % str(top_aligns[0]))
ca_output.icarus_out_f.write(top_aligns[0].icarus_report_str() + '\n')
ref_aligns.setdefault(top_aligns[0].ref, []).append(top_aligns[0])
aligned_lengths.append(top_aligns[0].len2)
contigs_aligned_lengths[-1] = top_aligns[0].len2
ca_output.coords_filtered_f.write(top_aligns[0].coords_str() + '\n')
top_aligns = top_aligns[1:]
for align in top_aligns:
ca_output.stdout_f.write('\t\t\tSkipping alignment ' + str(align) + '\n')
elif qconfig.ambiguity_usage == "all":
ca_output.stdout_f.write('\t\tUsing all these alignments (option --ambiguity-usage is set to "all"):\n')
# we count only extra bases, so we shouldn't include bases in the first alignment
Expand Down Expand Up @@ -250,6 +262,15 @@ def analyze_contigs(ca_output, contigs_fpath, unaligned_fpath, unaligned_info_fp
for idx in used_indexes:
if idx not in the_best_set.indexes:
ca_output.stdout_f.write('\t\t\tSkipping alignment ' + str(sorted_aligns[idx]) + '\n')
# This is a template for future "ploid" ambiguity-usage flag, need to change it later:
elif qconfig.ambiguity_usage == "ploid":
ambiguous_contigs_extra_bases += 0
ca_output.stdout_f.write('\t\tUsing only the very best set (option --ambiguity-usage is set to "one").\n')
if len(the_best_set.indexes) < len(used_indexes):
ca_output.stdout_f.write('\t\tSo, skipping alignments from other sets:\n')
for idx in used_indexes:
if idx not in the_best_set.indexes:
ca_output.stdout_f.write('\t\t\tSkipping alignment ' + str(sorted_aligns[idx]) + '\n')
elif qconfig.ambiguity_usage == "all":
ca_output.stdout_f.write('\t\tUsing all alignments in these sets (option --ambiguity-usage is set to "all"):\n')
ca_output.stdout_f.write('\t\t\tThe very best set is shown in details below, the rest are:\n')
Expand Down
2 changes: 1 addition & 1 deletion quast_libs/options_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def parse_options(logger, quast_args):
action='callback',
callback=check_str_arg_value,
callback_args=(logger,),
callback_kwargs={'available_values': ['none', 'one', 'all']})
callback_kwargs={'available_values': ['none', 'one', 'ploid', 'all']})

This comment has been minimized.

Copy link
@alexeigurevich

alexeigurevich Feb 13, 2023

Contributor

it would be good to specify the available values for the option in the help menu as well (in qconfig.py)

),
(['--ambiguity-score'], dict(
dest='ambiguity_score',
Expand Down

0 comments on commit 635f507

Please sign in to comment.