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

contig name changed too lower case in bam.py --> contig name not found in header #25

Closed
envanloo opened this issue Nov 1, 2018 · 2 comments

Comments

@envanloo
Copy link

envanloo commented Nov 1, 2018

When using the Random access sample:

import bamnostic as bs
bam = bs.AlignmentFile("yourfile.bam", 'rb')
for i, read in enumerate(bam.fetch(contig="Scaffold_Name", start=1, stop=100)):
if i >= 3:
break
print(read)

bamnostic gives the error that 'scaffold_name" is not found in the header. Of course not, as the name has capitals.
To Reproduce

  1. Make your own bam file with contig names containing capitals
  2. Run the above python lines
  3. You will get a message that the contig with a name in only lower case is not found.

Expected behavior
Bamnostic should keep the literal name of the contig and not change to lower case.

Desktop (please complete the following information):

  • Win 6 64x
  • Python Version: 3.7 using Spyder 3.3.1
  • bamnostic Version: 1.0.0

Additional context
Problem seems to be the line in bam.py:
query = parse_region(**signature)

contig in bam.py is a str with the capital still in place
query.contig has the same value but now in lower case only
re-assigning contig to query.contig solved the problem:

query.contig=contig

in the line just after query = parse_region(**signature)

@betteridiot
Copy link
Owner

Thank you for bringing this to my attention. It seems pretty straightforward. I will try to take a look at this later today,

@betteridiot
Copy link
Owner

This should be fixed as of v1.0.1. The details of the fix can be found in the commit above.

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

2 participants