Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix newick output #73

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Fix newick output #73

merged 3 commits into from
Nov 7, 2024

Conversation

GavinHuttley
Copy link
Collaborator

@GavinHuttley GavinHuttley commented Nov 7, 2024

Summary by Sourcery

Fix the Newick output formatting by removing quotes from the string representation of the tree dictionary. Enhance the 'ctree' function to handle cases where the tree is not generated by printing an error message and exiting. Update the test for 'ctree' to include the '-hp' flag in the arguments.

Bug Fixes:

  • Fix the Newick tree output by ensuring the string representation of the tree dictionary is correctly formatted without quotes.

Enhancements:

  • Add a check in the 'ctree' function to print an error message and exit if the tree is not generated.

Tests:

  • Update the 'test_ctree' function to include the '-hp' flag in the arguments for testing.

Copy link

sourcery-ai bot commented Nov 7, 2024

Reviewer's Guide by Sourcery

This PR fixes issues with Newick tree output formatting by modifying the tree string representation and adding error handling. The changes also include some code cleanup by removing unnecessary blank lines.

Sequence diagram for ctree function error handling

sequenceDiagram
    participant User
    participant CLI as ctree CLI
    participant App as Application
    participant Util as dvs_util
    participant Sys as System

    User->>CLI: Run ctree command
    CLI->>App: Call app(seqs)
    alt Tree is None
        App-->>CLI: Return None
        CLI->>Util: Print error message
        CLI->>Sys: Exit with error
    else Tree is valid
        App-->>CLI: Return Tree
        CLI->>User: Write tree to outpath
    end
Loading

File-Level Changes

Change Details Files
Modified tree string generation to properly handle Newick format
  • Added quote removal from tree string representation
  • Added underscore_unmunge parameter to make_tree function call
src/diverse_seq/cluster.py
Added error handling for tree generation
  • Added check for invalid tree result
  • Added error message display in red color
  • Added system exit on tree generation failure
src/diverse_seq/cli.py
Updated CLI test configuration
  • Added -hp flag to hide progress in test command
tests/test_cli.py
Code cleanup
  • Removed unnecessary blank lines in multiple files
src/diverse_seq/cluster.py
src/diverse_seq/cli.py
src/diverse_seq/distance.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @GavinHuttley - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

tests/test_cli.py Show resolved Hide resolved
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11715161343

Details

  • 3 of 5 (60.0%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.1%) to 91.816%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/diverse_seq/cli.py 1 3 33.33%
Files with Coverage Reduction New Missed Lines %
src/diverse_seq/distance.py 1 91.27%
src/diverse_seq/cli.py 1 85.03%
Totals Coverage Status
Change from base Build 11623895953: -0.1%
Covered Lines: 1178
Relevant Lines: 1283

💛 - Coveralls

@GavinHuttley GavinHuttley merged commit 07e3f2d into HuttleyLab:main Nov 7, 2024
13 checks passed
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.

2 participants