DnaFeaturesViewer icon indicating copy to clipboard operation
DnaFeaturesViewer copied to clipboard

BiopythonTranslator: SeqFeatures with location_operator='join' get wrong position

Open MrTomRod opened this issue 4 years ago • 0 comments

Hello

Thanks for your work, I implemented DnaFeaturesViewer in my software (click on compare gene loci)!

I found a small bug: sometimes, a gene spans the scaffold. Happens rarely with circular assemblies annotated with PGAP. In this case, BiopythonTranslator gives the gene a start position at the beginning of the scaffold, and an end position at the end of the scaffold, meaning the gene spans the entire scaffold.

Example: image

Use this genbank file to reproduce the issue.

I managed to fix it by changing the translate_feature function:

location = feature.location if feature.location_operator != 'join' else feature.location.parts[0]

return GraphicFeature(
    start=location.start,
    end=location.end,
    strand=location.strand,
    **properties
)

Then, I get the expected result: image

MrTomRod avatar Nov 12 '21 17:11 MrTomRod