-
Notifications
You must be signed in to change notification settings - Fork 217
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
Prepend underscores for tab completion of IDs that start with a number #828
Comments
Yes, I've been considering that as well. I think the big pro is usability in terms of fast interactive access to objects. The downsides I see, and they do not necessarily outweigh the big pro, are inconsistency between Alternatively, we could prepend everything with |
What would you do if there is already another reaction with id |
In that case, the shortcut would point to the exact match: iJO1366.metabolites._10ft<tab>
# completes to:
iJO1366.metabolites._10fthf
# which is equivalent to:
iJO1366.metabolites.get_by_id('_10fthf') I image that's a rare case, and BiGG IDs cannot begin with underscore, but it would be a potential source of confusion. |
The preference seems to be to implement along the lines of SBML identifiers. |
Tab completion of reaction and metabolite IDs is convenient and widely used in IPython and Jupyter. Falling back on
get_by_id
for IDs that do not match the Python variable-naming rules is a common annoyance (for me at least, and I imagine many other users).IDs from existing databases (BiGG, KEGG, etc.) generally use a limited character set that is consistent with Python variable naming, so tab completion works. The main exception is identifiers that start with a number. These are common in BiGG – I'm not sure about other databases – and it would take quite a lot of work to move existing models to new BiGG IDs not starting with numbers. It would also be less intuitive because chemical names commonly begin with numbers ("10-Formyltetrahydrofolate", "1-propanol", etc.).
What if, as a compromise, COBRApy prepended IDs that start with numbers with an underscore, just for tab-completion (and just in the cases were IDs do not conflict with another ID in the model)?
So this would work:
The text was updated successfully, but these errors were encountered: