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

Ensure index files are stored under the same dir/bucket as their respective file in EH WDL #282

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

VJalili
Copy link
Member

@VJalili VJalili commented Jan 12, 2022

If a BAM/CRAM file and its respective index are stored under a different bucket, they will be localized to different paths on the runner. However, EH requires a BAM/CRAM and its respective index stored under the same path. This PR ensures the files are stored under the same path. The same applied to reference files.

The implemented approach preserves .bam or .cram extension. One another alternative could be the following.

BAM_OR_CRAM=~{bam_or_cram}
EXT="${BAM_OR_CRAM##*.}"
if [ $EXT == "bam" ]; then
    BAM_OR_CRAM="~{sample_id}".bam
    BAM_OR_CRAM_INDEX="~{sample_id}".bam.bai
else
    BAM_OR_CRAM="~{sample_id}".cram
    BAM_OR_CRAM_INDEX="~{sample_id}".cram.crai
fi
mv ~{bam_or_cram} BAM_OR_CRAM
mv ~{bam_or_cram_index} BAM_OR_CRAM_INDEX

@VJalili VJalili requested a review from mwalker174 January 12, 2022 19:25
Copy link
Collaborator

@mwalker174 mwalker174 left a comment

Choose a reason for hiding this comment

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

LGTM, one minor question.

Comment on lines +92 to +94
if [ $DEST != ~{bam_or_cram_index} ]; then
mv ~{bam_or_cram_index} $DEST
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need the if?

Copy link
Member Author

Choose a reason for hiding this comment

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

in my tests, mv exits with fail code if the file is already there.

@VJalili
Copy link
Member Author

VJalili commented Jan 12, 2022

@mwalker174 Thanks for reviewing this!

@VJalili VJalili merged commit cb93e03 into broadinstitute:master Jan 12, 2022
@VJalili VJalili deleted the eh_mv_localized_files branch January 12, 2022 21:47
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