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

PeakShapeResult has no attribute hist #75

Open
IanSudbery opened this issue Oct 22, 2020 · 1 comment
Open

PeakShapeResult has no attribute hist #75

IanSudbery opened this issue Oct 22, 2020 · 1 comment

Comments

@IanSudbery
Copy link
Contributor

The PeakShapeResult class is defined in bamtools.peakshape thus:

PeakShapeResult = collections.namedtuple(
    "PeakShapeResult",
    "interval_width npeaks "
    "peak_center peak_width peak_height peak_relative_pos "
    "nreads "
    "median closest_half_height furthest_halfheight "
    "bins counts" )

however, in several places bam2peakshape.py refers to the .hist property of a PeakShapeResult or PeakShapeCounts object. Looking at the code, I'm getting the feeling that what is now counts was once called hist, but when it was renamed, not all instances of hist were caught.

This means that if bam2peakshape is called with the argument --use-strand the error:

AttributeError: 'PeakShapeResult' object has no attribute 'hist'

will be thrown. The correction should be simple, but this really should also be covered by a test. I would do it now, but I've got a butt load of lectures to write before next week. Maybe I'll get round it later.

@IanSudbery
Copy link
Contributor Author

Also main of bam2peakshape.buildDensityMatricies has a logging counter called c:

c = E.Counter()

But if you use a control file and use --use-strand then this happens:

if strand_specific and bed.strand == "-":
features._replace(hist=features.hist[::-1])
if control:
for c in control:
c._replace(hist=c.hist[::-1])
if shifted:
shifted._replace(hist=shifted.hist[::-1])

Meaning that c is overwritten with a PeakShapeResult object. This means an error is raised next time the counter is updated.

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

1 participant