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

BuildBamIndex creates index file in the current directory #1827

Open
ghost opened this issue Sep 9, 2022 · 9 comments · May be fixed by #1925
Open

BuildBamIndex creates index file in the current directory #1827

ghost opened this issue Sep 9, 2022 · 9 comments · May be fixed by #1925

Comments

@ghost
Copy link

ghost commented Sep 9, 2022

Dear colleagues,

I discovered a thing which seems invalid. BuildBamIndex creates index file in the current directory, not in the directory which contains bam file. I'm absolutely sure that it behaved as I expected in previous versions.

Example:

source ~/miniconda3/bin/activate gatk
cd /some/path
gatk BuildBamIndex -I /path/to/bam/my_file.bam

Expected output:

/path/to/bam/my_file.bai

Observed:

/some/path/my_file.bai

OS: Ubuntu 22.04
GATK version: 4.2.6.1
Environment: miniconda3

Could you check that, please?

@cmnbroad
Copy link
Contributor

Yes, this is probably a regression introduced in Picard #1787. Im transferring this to the Picard repo.

@cmnbroad cmnbroad transferred this issue from broadinstitute/gatk Sep 12, 2022
@cmnbroad cmnbroad changed the title GATK BuildBamIndex creates index file in the current directory BuildBamIndex creates index file in the current directory Sep 12, 2022
@cmnbroad
Copy link
Contributor

This was originally reported in GATK, but the issue is in BuildBamIndex.

@cmnbroad
Copy link
Contributor

@regnveig To work around this for now, I think it will work correctly if you specify the full path of the expected output using -O.

@ghost
Copy link
Author

ghost commented Sep 14, 2022

@cmnbroad thank you for your suggestion! Looking forward to the fixed version!

@kachulis
Copy link
Contributor

will be fixed by #1852

@rickymagner
Copy link
Contributor

Looks like this was fixed by #1852.

@cmnbroad
Copy link
Contributor

cmnbroad commented Aug 14, 2023

I think there was a lot of confusion around all the PRs related to cloud-enabling. This will be fixed by cloud-enabling BuildBamIndex, but I don't see any evidence that supports that having been done in #1852.

@cmnbroad cmnbroad reopened this Aug 14, 2023
@kockan
Copy link
Contributor

kockan commented Nov 29, 2023

@cmnbroad Is this intended to be part of #1804 ? If not, would it be a simple matter of updating the input/output paths from File to PicardHtsPath (and the corresponding path conversions in the BuildBamIndex source), mirroring how @takutosato seems to have been doing it? I could give it a try, or just wait until #1804 is merged if preferred.

@cmnbroad cmnbroad linked a pull request Dec 4, 2023 that will close this issue
@cmnbroad
Copy link
Contributor

cmnbroad commented Dec 4, 2023

@kockan Ah, this one has had a bit of a tortured lifecycle. BuildBamIndex already uses PicardHtsPath for inputs, but the outputs weren't done simultaneously, and they really should have been, because in some code paths the tool has to derive the output filename from the input filename.

I had a branch that fixes that, but it was abandoned because we didn't have the test infrastructure that we needed to add a test that uses an actual cloud path, so we decided instead to include a fix for this as part of #1804 (and also, IIRC, I did try to add a test that exercised the new code, but on a local file, but I started to notice that the existing test had some issues).

But in the meantime, #1804 has grown a bit and now has it's own tortured existence, and this fix isn't in there. So rather than add another tax on #1804 for that, I'll resurrect my branch with the fix, make a draft PR, and then when #1804 goes in we can add the new test.

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 a pull request may close this issue.

4 participants