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

samtools merge S3 cram files requires -X flag #1132

Closed
GreenInnovator opened this issue Nov 8, 2019 · 5 comments · Fixed by samtools/htslib#967
Closed

samtools merge S3 cram files requires -X flag #1132

GreenInnovator opened this issue Nov 8, 2019 · 5 comments · Fixed by samtools/htslib#967
Assignees

Comments

@GreenInnovator
Copy link

GreenInnovator commented Nov 8, 2019

Is your feature request related to a problem? Please specify.

samtools merge -R $region - s3://bucket/sample1.bam s3://bucket/sample2.bam # ok

samtools merge -R $region - s3://bucket/sample1.cram s3://bucket/sample2.cram --reference ref.fa # Failed to load index.

#978 gives an option -X flag workaround:

samtools merge -R $region - -X s3://bucket/sample1.cram s3://bucket/sample2.cram sample1.cram.crai sample2.cram.crai --reference ref.fa # ok

Describe the solution you would like.

I would prefer a solution without this -X flag, similar to the syntax for BAM files.

@GreenInnovator
Copy link
Author

What syntax should I use for samtools merge -b cramfile.list -X to work?

@valeriuo
Copy link
Contributor

valeriuo commented Nov 8, 2019

What version of samtools/htslib are you using?
Does your htslib include samtools/htslib#870?
What are the error messages in your output?

Please fill in the issue template.

@valeriuo valeriuo self-assigned this Nov 8, 2019
@GreenInnovator
Copy link
Author

GreenInnovator commented Nov 8, 2019

samtools 1.9-180-gf9e1caf
Using htslib 1.9-401-gd59c364-dirty

[bam_merge_core2] failed to load index for s3://bucket/sample1.cram. Random alignment retrieval only works for indexed BAM or CRAM files.

@GreenInnovator
Copy link
Author

samtools/htslib#870 Does'nt check for .crai index?

@valeriuo
Copy link
Contributor

valeriuo commented Nov 8, 2019

You can try the fix, until it is merged, by running the following commands in your HTSlib folder:

git checkout -b valeriuo-crai_index develop
git pull https://github.com/valeriuo/htslib.git crai_index
make clean; make && make install

Then rebuild your samtools binary with this version of HTSlib.

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.

2 participants