Skip to content

Use OrderedDict for SeqFeature qualifiers - #987

Closed
peterjc wants to merge 1 commit into
biopython:masterfrom
peterjc:qualifier_order
Closed

peterjc wants to merge 1 commit into
biopython:masterfrom
peterjc:qualifier_order

Conversation

@peterjc

@peterjc peterjc commented Nov 9, 2016 •

Copy link
Copy Markdown
Member

My goal is to help round-trip EMBL/GenBank files by preserving the feature qualifier ordering explicitly using an OrderedDict.

This means we can stop explicitly sorting the qualifiers on output (which produced stable but arbitrary ordering, rather than attempting to match the original order).

Some of this behaviour will happen by default as of Python 3.6 because the default dict will preserve order (see https://mail.python.org/pipermail/python-dev/2016-September/146327.html and https://stackoverflow.com/questions/39980323/dictionaries-are-ordered-in-python-3-6 etc).

Comments welcome, e.g. @kblin @chapmanb @idoerg @widdowquinn as I know you all use the GenBank parser

@codecov-io

codecov-io commented Nov 9, 2016 •

Copy link
Copy Markdown

Current coverage is 80.31% (diff: 100%)

Merging #987 into master will not change coverage

@@             master       #987   diff @@
==========================================
  Files           319        319          
  Lines         48754      48754          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          39157      39157          
  Misses         9597       9597          
  Partials          0          0          

Powered by Codecov. Last update 1fb9129...b66b546

@widdowquinn

Copy link
Copy Markdown
Contributor

Sounds like a reasonable thing to do. I've no complaints.

Part of this behaviour will happen by default as of Python 3.6 where the
Python dict preserves order, but goal here is to help round-trip EMBL/GenBank
files by preserving the feature qualifier ordering.

This means we can stop explicitly sorting the qualifiers on output (which
produced stable but arbitrary ordering, rather than attempting to match the
original order).
@kblin

kblin commented Nov 15, 2016

Copy link
Copy Markdown
Contributor

Awesome! 👍

@peterjc

peterjc commented Nov 15, 2016

Copy link
Copy Markdown
Member Author

Not sure why GitHub didn't pick this up, but I applied this last week as c1f93f3

Thanks for the positive feedback, closing this PR.

@peterjc peterjc closed this Nov 15, 2016
@peterjc
peterjc deleted the qualifier_order branch November 15, 2016 12:24
peterjc added a commit that referenced this pull request Apr 6, 2017
Works with 'pip install -r requirements.txt' under both CPython and
PyPy 5.7, using pip 9.0.1

Testing any (non-empty) requirements.txt file under Jython 2.7 fails
for me with a recursion error with current version of pip 9.0.1, see
http://bugs.jython.org/issue2576

Closes #987
MarkusPiotrowski pushed a commit to MarkusPiotrowski/biopython that referenced this pull request Oct 31, 2017
Works with 'pip install -r requirements.txt' under both CPython and
PyPy 5.7, using pip 9.0.1

Testing any (non-empty) requirements.txt file under Jython 2.7 fails
for me with a recursion error with current version of pip 9.0.1, see
http://bugs.jython.org/issue2576

Closes biopython#987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants