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

Incorrect Index Handling for Multiple BAM Files #142

Open
nanipunepalle opened this issue Dec 21, 2024 · 1 comment
Open

Incorrect Index Handling for Multiple BAM Files #142

nanipunepalle opened this issue Dec 21, 2024 · 1 comment

Comments

@nanipunepalle
Copy link

Incorrect Index Handling for Multiple BAM Files

Issue

When processing a list of BAM files, if the first file in the sequence has an index, subsequent BAM files without indexes are incorrectly skipped. This behavior causes incomplete processing of the bam files which eventually files in generating sashimi plots.

Steps to Reproduce

  1. Prepare a set of BAM files where:
    • The first file has an associated index.
    • Some subsequent files are missing indexes.
  2. Process the BAM files with the current implementation.

Expected Behavior

  • BAM files with indexes should be processed.
  • BAM files without indexes should trigger a handling mechanism without skipping them.

Actual Behavior

  • If the first file is indexed, all subsequent BAM files without indexes are skipped, leading to incomplete processing.

Suggested Fix

Update the logic to independently verify the presence of an index for each BAM file, ensuring that missing indexes are handled appropriately rather than causing downstream files to be skipped. Possibly removing return statement should help.

def index_bams(bams):
split_bams = bams.split(",")
for bam in split_bams:
index_files = [bam + '.bai', bam + '.csi']
for index_file in index_files:
if os.path.isfile(index_file): # if the bam file has been indexed.
print("'{}' is indexed already: '{}'".format(bam, index_file))
return
print("Indexing '{}'.".format(bam))
os.system("samtools index " + bam)

@EricKutschera
Copy link
Contributor

Thanks for reporting this issue. I think this change should correctly determine which bam files should be indexed: #143

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

No branches or pull requests

2 participants