Skip to content

Conversation

@vbadelita
Copy link

The new argument takes a list of arguments to pass to the alignment tool. This gives more flexibility in configuring mafft.

Description of proposed changes

Added the new argument to align.py. If present, the arguments override the defaults (except threads which is passed separately).

Related issue(s)

#1789

Checklist

  • Automated checks pass
    • Ran ./run_tests.sh -k test_align.py
  • Check if you need to add a changelog message
    • Added changelog message
  • Check if you need to add tests
    • Added two unit tests
  • Check if you need to update docs
    • Docs should automatically get updated via argparse

The new argument takes a list of arguments to pass to the alignment tool. This gives more flexibility in configuring mafft.
- Found a bug, where I accidentally removed "threads" from the argument string
- tests just show the command line mafft call is what we expect
- Clarified the docs that --keeplength is automatically added when an existing alignment is passed
- I modified the mafft command string to use newer python format strings
- Made both paths (with and witout existing file) use the same command, with slightly different arguments
- Updated the tests slightly, as it was difficult to unify the commands without a bit of reordering
@codecov
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.37%. Comparing base (51ab5ba) to head (30044ea).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1790      +/-   ##
==========================================
+ Coverage   73.35%   73.37%   +0.01%     
==========================================
  Files          81       81              
  Lines        8535     8547      +12     
  Branches     1735     1738       +3     
==========================================
+ Hits         6261     6271      +10     
- Misses       1980     1981       +1     
- Partials      294      295       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Changed the behaviour to not override default arguments (and expand instead) unless the --override-defaults-args parameter is set to true.
- Updated tests to reflect this change.
@vbadelita vbadelita requested a review from victorlin April 22, 2025 11:38
Copy link
Member

@victorlin victorlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding --override-default-args! That part looks good.

Apologies for the delayed review and not catching this requested change earlier.

Comment on lines +274 to +277
files_to_align = f"--add {shquote(seqs_to_align_fname)} {shquote(existing_aln_fname)}"
alignment_args = " ".join(["--keeplength", alignment_args])

cmd = f"mafft {alignment_args} --thread {nthreads} {files_to_align} 1> {shquote(aln_fname)} 2> {shquote(log_fname)}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be checked that alignment_args does not conflict with the hardcoded options (--add, --keeplength, --thread). See usage of augur.tree.check_conflicting_args as an example of how this is done in augur tree.

Actually, I think augur.tree.check_conflicting_args can be repurposed and used here by moving into augur.utils and replacing the "tree builder" references with something like "external program", but that's extra work. It's fine to copy the function as augur.align.check_conflicting_args.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants