Skip to content

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

@XikunZhang

Description

@XikunZhang

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions