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

Reader Object Error #3

Open
nickeener opened this issue Jul 11, 2019 · 7 comments
Open

Reader Object Error #3

nickeener opened this issue Jul 11, 2019 · 7 comments

Comments

@nickeener
Copy link

Hey not sure if this is still being maintained but it's worth a shot. I'm comparing a number of variant callers, one of which is nvc, but I'm having problems getting it to run. I installed it using conda in an environment with python 2 but the error looks like a problem with the code itself. Any help would be greatly appreciated. I'll copy the error message below:

Traceback (most recent call last):
File "/home/nickeener/anaconda3/envs/py2/bin/naive_variant_caller.py", line 94, in
if name == "main": main()
File "/home/nickeener/anaconda3/envs/py2/bin/naive_variant_caller.py", line 89, in main
allow_out_of_bounds_positions=options.allow_out_of_bounds_positions, safe=options.safe )
File "/home/nickeener/anaconda3/envs/py2/lib/python2.7/site-packages/pyBamTools/genotyping/naive.py", line 93, in init
self._dtypes = guess_numpy_dtypes_from_idxstats( bam_readers, dtype, force_dtype=force_dtype )
File "/home/nickeener/anaconda3/envs/py2/lib/python2.7/site-packages/pyBamTools/util/init.py", line 41, in guess_numpy_dtypes_from_idxstats
refs = bam_index._references
AttributeError: 'Reader' object has no attribute '_references'

@nekrut
Copy link

nekrut commented Aug 6, 2019

@blankenberg can you take a look at this? We unfortunately cannot use nvc for anything meaningful for that reason.

@blankenberg
Copy link
Owner

Sorry for the delay (I missed this issue being opened) and more sorry to hear that you are experiencing issues.

First guess is that your BAM file is not index, with e.g. samtools:
samtools index my_alignment.bam

I should definitely make this issue clearer though.

If you have a xyz.bam.bai next to your xyz.bam input and it is not working, let me know and I will dig deeper.

Please let me know how it goes. Of course, this error message is not super helpful and should be enhanced, regardless.

Thanks,

Dan

@nickeener
Copy link
Author

@blankenberg
You were right, I forgot to create the bam index file. However, I did so (using bamtools index) but now I'm getting a different error:

BAM Index appears to be malformed: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'.

I've run this dataset on other variant callers (freebayes, gatk Mutect2, and snippy) and haven't gotten any error messages regarding the bam index.

Here's the command I'm running:
naive_variant_caller.py -b FVM.bam -o nvc/FVM.vcf -r FVM.fasta -p 1

@blankenberg
Copy link
Owner

@nickeener would you be able to share a link to the input bam and bai files? Feel free to email me directly with them if you like.

@nickeener
Copy link
Author

@blankenberg See: https://github.com/nickeener/HIV
The FVM.bam and FVM.bam.bai are the relevant files.
Thanks!

@blankenberg
Copy link
Owner

The input BAM file (https://github.com/nickeener/HIV/blob/master/FVM.bam) is unsorted, and the index created by bamtools is more-or-less empty.

I would have thought that BAMtools would raise an error on indexing here, but I checked and it doesn't; samtools does raise an error, however.

$ bamtools index -in FVM.bam
$ samtools index FVM.bam
[E::hts_idx_push] Unsorted positions on sequence #5: 2257 followed by 1802
samtools index: failed to create index for "FVM.bam"

Can you sort your BAM file first, then index, then try NVC again?

@nickeener
Copy link
Author

@blankenberg That did it. Thanks for the help.

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

3 participants