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

Cannot add entries of value type int, but only float #126

Open
XikunZhang opened this issue May 11, 2022 · 2 comments
Open

Cannot add entries of value type int, but only float #126

XikunZhang opened this issue May 11, 2022 · 2 comments

Comments

@XikunZhang
Copy link

pybigwig version: 0.3.18

When I tried adding entries of int type like

import pyBigWig
import numpy as np
hg19_chr1_len = 249250621
with pyBigWig.open("/path/to/a/bigwig", "w") as bw:
    bw.addHeader([("chr1", hg19_chr1_len)])
    bw.addEntries("chr1", [0], values=[0], span=hg19_chr1_len)

, I encountered this error

RuntimeError: You must provide a valid set of entries. These can be comprised of any of the following:
1. A list of each of chromosomes, start positions, end positions and values.
2. A list of each of start positions and values. Also, a chromosome and span must be specified.
3. A list values, in which case a single chromosome, start position, span and step must be specified.

.
After I changed the value type from int to float, like

import pyBigWig
import numpy as np
hg19_chr1_len = 249250621
with pyBigWig.open("/path/to/a/bigwig", "w") as bw:
    bw.addHeader([("chr1", hg19_chr1_len)])
    bw.addEntries("chr1", [0], values=[0.], span=hg19_chr1_len)

, the code ran successfully. I think it can be good to allow adding entries of int type.

@dpryan79
Copy link
Collaborator

BigWig files themselves only support float values.

@XikunZhang
Copy link
Author

XikunZhang commented May 11, 2022 via email

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