mgymrek/pybamview — pull request #6 by ihaque (2014-02-04 23:30:21+00:00)
Title: Allow multiple same-named read groups across BAMs

One big fix and a number of small improvements.

Big: it's possible that more than one BAM will have the same read-group identifier, but a different sample in each BAM. This patch changes the read-group dictionary so that the mapping from read-group to sample is kept on a per-BAM basis. (It may be desirable for someone else to have unique SM records merged across BAMs, if for some reason multiple samples are split across BAMs, but this is not useful for the data I work with, so I didn't implement it.)

Small:
- use `os.path.join` instead of bare string operations on paths; this cleans up a couple of things with extra slashes
- add a `requirements.txt` to make it easier to set up in a virtualenv
- use `/usr/bin/env python` instead of `/usr/local/bin/python` to make it easier to execute in a virtualenv
- add a very simple test and small test data to validate the big change made above

# Testing

The test case I added passed. I also loaded the two test BAMs, and both of them display properly; before the patch, only one would show up.