Edinburgh-Genome-Foundry / DnaFeaturesViewer

:eye: Python library to plot DNA sequence features (e.g. from Genbank files)
https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/
MIT License
584 stars 90 forks source link

CroppingGraphicRecord.crop: ValueError at boundary condition #20

Closed MrTomRod closed 4 years ago

MrTomRod commented 4 years ago

Hi!

I really enjoy your DnaFeaturesViewer!

I discovered a bug when cropping at the end of a graphic_record:

The graphic_record.span is (0, 391390)

I want to crop it as follows: graphic_record.crop((388247, 391390))

But this gets me a ValueError:

  File "project/gene_loci_comparison/gene_loci_comparison.py", line 71, in create_graphic_record
    graphic_record = graphic_record.crop(crop)
  File "venv/gene_loci_comparison/lib64/python3.7/site-packages/dna_features_viewer/GraphicRecord/GraphicRecord.py", line 116, in crop
    raise ValueError("out-of-bound cropping")
ValueError: out-of-bound cropping

If I crop graphic_record.crop((388247, 391390 - 1)), it works, but I loose a base at the end.

Thanks for this beautiful piece of software! :)

Zulko commented 4 years ago

Thanks for reporting this, this is now fixed. Please upgrade and let me know how it works (the last versions introduce many changes but hopefully nothing that will break your code, so let me know how it goes and what you think).

MrTomRod commented 4 years ago

Fix confirmed! For the record, this is version 2.2.0.

Nothing broke!

MrTomRod commented 4 years ago

Oh, the plots look different! I like it. :)

Old: image

New: image