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

default to conda over container #182

Merged
merged 3 commits into from
Jan 21, 2025
Merged

default to conda over container #182

merged 3 commits into from
Jan 21, 2025

Conversation

pdimens
Copy link
Owner

@pdimens pdimens commented Jan 20, 2025

Summary by CodeRabbit

  • New Features

    • Replaced --conda option with --container across multiple Harpy modules.
    • Updated command-line interfaces to use container-based deployment method.
  • Improvements

    • Streamlined software deployment options.
    • Simplified command-line interface for various genomic analysis workflows.
  • Changes

    • Modified function signatures in multiple modules to support container deployment.
    • Updated documentation and help text for new container option.

Copy link

coderabbitai bot commented Jan 20, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a comprehensive update to the Harpy project's command-line interface, replacing the --conda flag with a new --container flag across multiple modules. The changes systematically modify function signatures, command-line options, and deployment method logic in various Python files, shifting from conda-based to container-based software deployment. The modifications affect multiple workflows including alignment, assembly, deconvolution, demultiplexing, imputation, metassembly, phasing, preflight checks, quality control, simulation, and structural variant analysis. Additionally, some steps in the GitHub Actions workflow for artifact handling have been commented out.

Changes

File Change Summary
.github/workflows/tests.yml Commented out artifact download steps for multiple jobs
harpy/align.py Replaced --conda with --container for bwa, ema, and strobe commands
harpy/assembly.py Updated command-line options and function signature to use --container
harpy/deconvolve.py Modified deployment method logic and command-line options
harpy/demultiplex.py Replaced --conda with --container for gen1 command
harpy/impute.py Updated command-line options and function signature
harpy/metassembly.py Modified function signature to use container parameter
harpy/phase.py Updated command-line options and deployment method logic
harpy/preflight.py Replaced --conda with --container for bam and fastq commands
harpy/qc.py Updated command-line options and function signature
harpy/simulate.py Modified command-line options for various simulation commands
harpy/snp.py Updated mpileup and freebayes commands with --container
harpy/sv.py Modified leviathan and naibr commands with --container
harpy/bin/concatenate_bam.py Updated RG ID and SM in BAM file headers to a static string "concat"

Possibly related PRs

  • add leviathan deconvolution #181: The changes in this PR involve modifications to the command-line interface for several functions, including the leviathan workflow, which aligns with the main PR's focus on updating command-line options and parameters related to containerization.

Suggested Labels

bug, enhancement

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 13

🔭 Outside diff range comments (1)
harpy/impute.py (1)

Line range hint 1-1: Systematic inconsistency with PR objective across all files.

The PR title suggests defaulting to conda over container, but the implementation across all files shows:

  1. Help texts suggesting container as an alternative to conda
  2. Logic defaulting to conda instead of container

This systematic inconsistency needs to be addressed by either:

  1. Updating the PR title to match the current implementation, or
  2. Reversing the logic in all files to match the PR title
🧹 Nitpick comments (3)
harpy/sv.py (1)

85-85: Consider refactoring duplicate SDM logic

The SDM logic is duplicated across functions:

sdm = "conda" if not container else "conda apptainer"

Consider extracting this into a helper function to improve maintainability.

Also applies to: 184-184

harpy/align.py (1)

97-97: Consider refactoring duplicate SDM logic

The SDM logic is duplicated across multiple functions:

sdm = "conda" if not container else "conda apptainer"

Consider extracting this into a helper function to improve maintainability.

Also applies to: 188-188, 298-298

harpy/simulate.py (1)

157-157: Consider refactoring duplicate SDM logic

The SDM logic is duplicated across multiple functions:

sdm = "conda" if not container else "conda apptainer"

Consider extracting this into a helper function to improve maintainability.

Example refactor:

# Add to _misc.py or create a new module
+def get_software_deployment_method(container: bool) -> str:
+    return "conda" if not container else "conda apptainer"

# In each function, replace the duplicate logic with:
-sdm = "conda" if not container else "conda apptainer"
+sdm = get_software_deployment_method(container)

Also applies to: 265-265, 381-381, 497-497, 603-603

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9eb6667 and 1109d8e.

📒 Files selected for processing (13)
  • .github/workflows/tests.yml (17 hunks)
  • harpy/align.py (9 hunks)
  • harpy/assembly.py (3 hunks)
  • harpy/deconvolve.py (3 hunks)
  • harpy/demultiplex.py (4 hunks)
  • harpy/impute.py (3 hunks)
  • harpy/metassembly.py (3 hunks)
  • harpy/phase.py (4 hunks)
  • harpy/preflight.py (5 hunks)
  • harpy/qc.py (3 hunks)
  • harpy/simulate.py (15 hunks)
  • harpy/snp.py (6 hunks)
  • harpy/sv.py (6 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/tests.yml
⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: align strobe
  • GitHub Check: simulate variants
  • GitHub Check: simulate linkedreads
  • GitHub Check: qc
  • GitHub Check: preflight
  • GitHub Check: phase
  • GitHub Check: sv naibr
  • GitHub Check: mpileup
  • GitHub Check: sv leviathan
  • GitHub Check: impute
  • GitHub Check: harpy extras
  • GitHub Check: freebayes
  • GitHub Check: align EMA
  • GitHub Check: demux gen1
  • GitHub Check: metassembly
  • GitHub Check: align BWA
  • GitHub Check: deconvolve
🔇 Additional comments (4)
harpy/snp.py (1)

36-36: LGTM: Command-line interface changes are consistent

The changes to replace --conda with --container in the docstring and function signatures are consistent throughout the file.

Also applies to: 46-46, 60-60, 66-66, 165-165, 172-172

harpy/sv.py (1)

40-40: LGTM: Command-line interface changes are consistent

The changes to replace --conda with --container in the docstring and function signatures are consistent throughout the file.

Also applies to: 50-50, 64-64, 72-72, 157-157, 165-165

harpy/align.py (1)

42-42: LGTM: Command-line interface changes are consistent

The changes to replace --conda with --container in the docstring and function signatures are consistent throughout the file.

Also applies to: 52-52, 62-62, 76-76, 84-84, 167-167, 173-173, 275-275, 282-282

harpy/simulate.py (1)

49-49: LGTM: Command-line interface changes are consistent

The changes to replace --conda with --container in the docstring and function signatures are consistent throughout the file.

Also applies to: 67-67, 85-85, 103-103, 121-121, 138-138, 144-144, 232-232, 239-239, 358-358, 365-365, 468-468, 475-475, 581-581, 588-588

harpy/deconvolve.py Show resolved Hide resolved
harpy/deconvolve.py Show resolved Hide resolved
harpy/demultiplex.py Show resolved Hide resolved
harpy/demultiplex.py Show resolved Hide resolved
harpy/metassembly.py Show resolved Hide resolved
harpy/phase.py Show resolved Hide resolved
harpy/qc.py Show resolved Hide resolved
harpy/assembly.py Show resolved Hide resolved
harpy/preflight.py Show resolved Hide resolved
harpy/preflight.py Show resolved Hide resolved
@pdimens pdimens self-assigned this Jan 21, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
harpy/bin/concatenate_bam.py (1)

Line range hint 1-156: Consider enhancing logging and validation.

While the core functionality is solid, consider these improvements:

  1. Add logging to track the concatenation process, number of records processed, and MI/BX tag statistics
  2. Include input filenames in error messages for easier debugging
  3. Validate that input BAM files have compatible RG headers before concatenation

Would you like me to provide example implementations for these improvements?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1109d8e and 7ffb513.

📒 Files selected for processing (1)
  • harpy/bin/concatenate_bam.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build/Cache Container

Comment on lines +82 to +83
header['RG'][0]['ID'] = "concat"
header['RG'][0]['SM'] = "concat"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Reconsider using static read group identifiers.

Using static "concat" values for RG ID and SM fields could cause issues:

  1. Loss of sample traceability and origin information
  2. Potential conflicts if multiple concatenated BAM files need to be merged later
  3. Impact on downstream tools that rely on unique RG headers for sample identification
  4. Reduced ability to perform sample-specific analysis and quality control

Consider maintaining unique identifiers or implementing a more descriptive naming scheme that preserves sample identity information.

Example approach:

-header['RG'][0]['ID'] = "concat"
-header['RG'][0]['SM'] = "concat"
+# Generate unique identifier combining sample names
+sample_names = [Path(bam).stem for bam in aln_list]
+merged_id = f"merged_{'-'.join(sample_names)}"
+header['RG'][0]['ID'] = merged_id
+header['RG'][0]['SM'] = merged_id

Committable suggestion skipped: line range outside the PR's diff.

@pdimens pdimens merged commit 81f254c into main Jan 21, 2025
20 checks passed
@pdimens pdimens deleted the conda_as_default branch January 21, 2025 15:17
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.

1 participant