-
Notifications
You must be signed in to change notification settings - Fork 105
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
genomeCov bed breaks during iteration. #145
Comments
Pretty sure this is caused by the #143 "fix" that is breaking more than it fixed . . . I'll take a closer look. |
Ah right, this is actually expected behavior and is related to #110.
Demo time. Turns out we need the import pybedtools
x = pybedtools.BedTool("""
chr1 1 100 feature1 0 +
chr1 1 100 feature1 0 +
""", from_string=True)
g = pybedtools.chromsizes_to_file({'chr1': (0, 200)})
y = x.genome_coverage(g=g, **{'5': True}) As you showed, the following raises for line in y:
print (line)
# MalformedBedLineError: Start is greater than stop The solution is to bypass the interpretation of BED format. For a file-based import pandas
t = pandas.read_table(y.fn, names=['chrom', 'depth', 'bases', 'size', 'frac'])
# chrom depth bases size frac
# 0 chr1 0 199 200 0.995
# 1 chr1 2 1 200 0.005
# 2 genome 0 199 200 0.995
# 3 genome 2 1 200 0.005 There you can see the problem on line 1. When it was trying to iterate over results, For streaming y = x.genome_coverage(g=g, stream=True, **{'5': True})
for line in y.fn:
print (line) Note that everything works fine if you use one of the for line in x.genome_coverage(g=g, bg=True, stream=True, **{'5': True}):
print (line) Of course, the question is should |
It looks like genome coverage bed breaks when we are just trying to generate the standard histogram. Here is the minimally reproducible code.
This is the stacktrace:
And the output from genomecov:
pybedtools is trying to create an interval out of something that shouldn't be an interval. Got any ideas for a fix?
The text was updated successfully, but these errors were encountered: