8000 Adding logic to check if files exist before appending them after mult… by alphabdiallo · Pull Request #98 · formbio/laava · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adding logic to check if files exist before appending them after mult… #98

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

Merged
merged 3 commits into from
Apr 18, 2025

Conversation

alphabdiallo
Copy link
Contributor

Fixing multiprocessing output files issues

@alphabdiallo alphabdiallo marked this pull request as ready for review April 17, 2025 22:28
@dougnukem dougnukem requested a review from Copilot April 18, 2025 03:24
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issues related to multiprocessing output files by adding checks to ensure that each chunk file exists before attempting to read and append its contents.

  • Added file existence checks for text chunk files before copying their contents.
  • Added file existence checks for BAM chunk files before merging them.
Comments suppressed due to low confidence (1)

src/summarize_alignment.py:801

  • Consider logging a warning or error if the expected first text chunk does not exist, as this might indicate an underlying issue in file generation.
if os.path.exists(first_chunk):

Comment on lines 831 to +832
outpath_bam = output_prefix + ".tagged.bam"
bam_reader = pysam.AlignmentFile(first_bam_chunk, "rb", check_sq=False)
Copy link
Preview
Copilot AI Apr 18, 2025

Choose a reason for hiding this comment

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

Since a file existence check is performed later for 'first_bam_chunk', consider checking os.path.exists(first_bam_chunk) prior to initializing bam_reader to avoid potential file open errors.

Suggested change
outpath_bam = output_prefix + ".tagged.bam"
bam_reader = pysam.AlignmentFile(first_bam_chunk, "rb", check_sq=False)
outpath_bam = output_prefix + ".tagged.bam"
if not os.path.exists(first_bam_chunk):
logging.error("The file %s does not exist. Cannot proceed.", first_bam_chunk)
raise FileNotFoundError(f"The file {first_bam_chunk} does not exist.")

Copilot uses AI. Check for mistakes.

Copy link
Contributor
@dougnukem dougnukem left a comment

Choose a reason for hiding this comment

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

lgtm

@dougnukem dougnukem merged commit 17d9e8b into main Apr 18, 2025
7 checks passed
@dougnukem dougnukem deleted the alpha/parallel_cpu_fix branch April 18, 2025 03:26
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
0