New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bar graphs: add sort_samples: false
config option, also do not sort OrderedDict
data
#2210
Conversation
42c7f6e
to
ea2791a
Compare
This reverts commit d234f97.
Happy only if:
It would be nice to see an example where this PR changes the output behaviour to think about this. May need a new config option to disable alphabetical sorting? I agree that the previous behaviour with OrderedDicts was a bit hacky. If basically nothing is changing, then happy to merge 👍🏻 |
🚀 Deployed on https://mqc-pr-2210--multiqc.netlify.app |
Fair points, decided to keep the order of The order should be stable between runs. |
sort_samples: false
config option, also do not sort OrderedDict
data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
Fix an artefact of removing
OrderedDict
s #2154The idea of the original code seems this: before Python 3.6, regular dict were randomly shuffled, so MultiQC needed to post-sort the sample list to get some reasonable order. But if the module wrapped data in an
OrderedDict
, it meant that the user explicitly provided the order, and it's not needed to be sorted further:After Python 3.6, regular dicts keep order, so the need for that sorting has disappeared. So instead, module devs started to assume that
OrderedDict
is a hacky way to tell MultiQC to disable auto-sorting. Instead, we should always keep the order of passed dictionaries, and treatOrderedDict
s anddict
s equally (we wouldn't useOrderedDict
anywhere internally anyway).Fixes #2204