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

plot a region of genbank file #12

Closed webermarcolivier closed 6 years ago

webermarcolivier commented 6 years ago

Is there a way to plot a region start..end of a Genbank file?

Zulko commented 6 years ago

Yes, with:

cropped_record = record.crop((start, end))
cropped_record.plot()
peterjc commented 4 years ago

Beware that Biopython's SeqRecord cropping (which I assume is what the example shows) will only keep features fully within the crop region. Anything saddling the boundary is lost (trying to crop a feature and accurately describe it is filled with corner cases).

Zulko commented 4 years ago

Hello - this is taken into account, and the .crop() method implements its own cropping of the GraphicRecord (it doesn't crop the original SeqRecord). In the result, annotations saddling the boundaries are still there but marked as "open-ended" on the sides, as you would expect. See for instance example overview_and_detail.py

peterjc commented 4 years ago

Excellent, I'd have to remind myself of the details but GenomeDiagram also had its own cropping (you give it a full record and tell it a start/stop), although I don't think we drew open ended edges like your example - that's a very nice visual cue.