Skip to content

More informative errors when providing wrong chromosome name or invalid coordinates #157

Description

@dgruano

In the following snippet

with pyBigWig.open(file) as bw:
  data = bw.values(chromosome, start, end, numpy=True)

If the chromosome value is not present in the bigWig chromosomes, the following error is raised:

RuntimeError: Invalid interval bounds!

However, this error suggests there is a problem with the coordinates, even if it is not the case.

It may be a useful change to separate the handling of both errors, by adding something like
RuntimeError: Invalid chromosome name!: {chromosome}.

Other improvement I can think of is printing the problematic coordinates, such as
RuntimeError: Invalid interval bounds! start: {start}, end: {end}, chromosome: {chromosome}, length: {length}

If useful, I could submit a PR.

This issue is related to #49 , #124 and #152

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