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

error reading bamfile #91

Closed
jotech opened this issue Sep 21, 2019 · 1 comment
Closed

error reading bamfile #91

jotech opened this issue Sep 21, 2019 · 1 comment
Assignees

Comments

@jotech
Copy link

jotech commented Sep 21, 2019

Using the latest release of blobtool (1.1.1.),

blobtools create -i contigs.fasta -b BIGb0170_sorted.bam -t BIGb0170.megablast.out -o blobtools/BIGb0170

I'm getting an error related to pysam and the input bam file:

[+] Parsing bam0 - ./BIGb0170_sorted.bam
Traceback (most recent call last):
  File "blobtools-blobtools_v1.1.1/blobtools", line 7, in <module>
    main()
  File "blobtools-blobtools_v1.1.1/lib/interface.py", line 60, in main
    create.main()
  File "blobtools-blobtools_v1.1.1/lib/create.py", line 119, in main
    blobDb.parseCoverage(covLibObjs=cov_libs, estimate_cov=estimate_cov_flag, prefix=prefix)
  File "blobtools-blobtools_v1.1.1/lib/BtCore.py", line 369, in parseCoverage
    base_cov_dict, covLib.reads_total, covLib.reads_mapped, read_cov_dict = BtIO.parseBam(covLib.f, set(self.dict_of_blobs), estimate_cov)
  File "blobtools-blobtools_v1.1.1/lib/BtIO.py", line 221, in parseBam
    with pysam.AlignmentFile(infile) as aln:
  File "pysam/libcalignmentfile.pyx", line 741, in pysam.libcalignmentfile.AlignmentFile.__cinit__
  File "pysam/libcalignmentfile.pyx", line 990, in pysam.libcalignmentfile.AlignmentFile._open
ValueError: file has no sequences defined (mode='r') - is it SAM/BAM format? Consider opening with check_sq=False

This seems to be related to an issue in pysam and indeed when I change line 221 in lib/BtIO.py to

with pysam.AlignmentFile(infile, check_sq=False) as aln: 

the error disappears.

@DRL DRL self-assigned this Oct 17, 2019
@DRL
Copy link
Owner

DRL commented Oct 17, 2019

Well, also seems like you BAM file does not have a proper header ...

Will incorporate this in the next release with a warning re BAM file

@DRL DRL closed this as completed Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants