How to make your own singularity container zero fuss!

In this blog post, I’ll show you guys how to make your own shiny container for your tool! Zero fuss(*) and in FOUR simple steps.

As an example, I will show how to make a singularity container for one of our public tools, ANARCI, the antibody numbering tool everyone in OPIG and external users are familiar with – If not, check the web app and the GitHub repo here and here.

(*) Provided you have your own Linux machine with sudo permissions, otherwise, you can’t do it – sorry. Same if you have a Mac or Windows – sorry again.
BUT, there are workarounds for these cases such as using the remote singularity builder here, for which you only need to sign up and create an account, and the use of Virtual Machines (VMs), as described here.

Continue reading

Automatic argument parsers for python

One of the recurrent problems I used to have when writing argument parsers is that after refactoring code, I also had to change the argument parser options which generally led to inconsistency between the arguments of the function and some of the options of the argument parser. The following example can illustrate the problem:

def main(a,b):
  """
  This function adds together two numbers a and b
  param a: first number
  param b: second number
  """
  print(a+b)

if __name__ == "__main__":
  import argparse
  parser = argparse.ArgumentParser()
  parser.add_argument("--a", type=int, required=True, help="first number")
  parser.add_argument("--b", type=int, required=True, help="second number")
  args = parser.parse_args()
  main(**vars(args))

This code is nothing but a simple function that prints a+b and the argument parser asks for a and b. The perhaps not so obvious part is the invocation of the function in which we have ** and vars. vars converts the named tuple args to a dictionary of the form {“a":1, "b":2}, and ** expands the dictionary to be used as arguments for the function. So if you have main(**{"a":1, "b":2}) it is equivalent to main(a=1, b=2).

Let’s refactor the function so that we change the name of the argument a to num.

Continue reading

Do you have cis peptide bonds in your simulation inputs?

People who run molecular simulations quickly become familiar with all of the things about a PDB file – missing residues, missing heavy atoms in residues, missing hydrogens, non-standard amino acids, multiple conformations, crystallization ligands, etc. – that might need to be fixed before setting up a simulation. This blog post is a reminder to check, after you have “fixed” your PDB, if you have accidentally introduced aberrant cis peptide bonds into your structure during rebuilding.

Continue reading

Words of Wisdom from final year PhD students

NB: These are entirely subjective so please ignore them all if you want.

1.     Write everything down in a searchable place 

Maybe you are gifted with a brilliant memory but, for the rest of us, write everything down (either in a notebook, or better yet, some kind of searchable typed document). This includes notes from supervisor meetings, industry meetings, clever suggestions over coffee, group meetings, etc… 

In our experience, writing things on paper is risky unless you have a decent filing system (see our desks for examples of how not to file notes). It also requires writing legibly. Typed notes are also particularly useful for saving common error messages/bug fixes/useful installation instructions/functions etc in one place so that you can easily search for them again! This can be just a word document, o rGemma showed me “Notion” which has so far been really useful (and you get to put emojis next to your notes).

This also leads to the second tip…

2.     Type up notes on papers you’ve read or use a reference manager 

Continue reading

Tidbits from YouGov Polls

Some recent verdicts from the British public on YouGov polls

  • The Queen (97%) is less well known than her husband Prince Philip (98%)
  • Liz Truss’ UK popularity rating (21%) is lower than George W. Bush’s (22%)
  • The most popular British dish is ‘Chips’ (84%) followed by ‘Fish and Chips’ (83%)
  • Oxford (55%) is a less popular university than Cambridge (58%)

So much for Aristotle’s ‘wisdom of crowds’!

Retrieving AlphaFold models from AlphaFoldDB

There are now nearly a million AlphaFold [1] protein structure predictions openly available via AlphaFoldDB [2]. This represents a huge set of new data that can be used for the development of new methods. The options for downloading structures are either in bulk (sorted by genome), or individually from the webpage for a prediction.

If you want just a few hundred or a few thousand specific structures, across different genomes, neither of these options are particularly practical. For example, if you have several thousand experimental structures for which you have their PDB [3] code, and you want to obtain the equivalent AlphaFold predictions, there is another way!

If we take the example of the PDB’s current molecule of the month, pyruvate kinase (PDB code 4FXF), this is how you can go about downloading the equivalent AlphaFold prediction programmatically.

  1. Query UniProt [4] for the corresponding accession number – an example python script is shown below:
Continue reading

Ten quick tips for proofreading your work

For my blog post, I thought I’d revisit my dark past on the other side of academic publishing when I worked as a copy editor and proofreader for two years between my undergrad and Masters. During this time, I worked primarily on review papers and news content. While I don’t claim to be a great writer or editor, I thought I’d share some easy tips to help refine your writing and make it more consistent. This is by no means an exhaustive list and probably most of them will already be familiar to you!

1. Consistency is key

I think two of the most important aspects of proofreading are ensuring consistency and using your common sense. For example, instead of agonizing over how you style a word, choose what you think is most appropriate and check that you’ve applied it consistently throughout the text. Check that style matches between the main text, headings, figure legends and footnotes. Some specific things to look for include the following:

  • Capitalization
    • If you’ve capitalized headings, has this been done throughout?
  • Italicization
    • E.g., have you italicized all your mentions of ‘in silico’? 
  • Superscript and subscript
    • E.g., is ‘half-maximal inhibitory concentration (IC50)‘ the same throughout? 
  • Numbers
    • Have you mixed up numerical and spelled-out numbers?  
    • E.g., I drank five cups of coffee and 4 cups of tea. 
Continue reading

Filtering molecules with long linkers

Recently I was tasked with filtering out ‘stringy’ molecules that were being produced with the fragment merging method I’m working on (that is, molecules with lots of consecutive non-ring bonds that weren’t necessarily caught with my rotatable bond filter). While this is quite a niche/specific task, through this I discovered a couple of RDKit functions that I wasn’t previously aware of but might be helpful for other people regularly looking at small molecules. The demo adapts code from this helpful blogpost on cutting a molecule into rings and linkers from ‘Is life worth living?’ (which is a useful source of cheminformatics wisdom; https://iwatobipen.wordpress.com/2020/01/23/cut-molecule-to-ring-and-linker-with-rdkit-rdkit-chemoinformatics-memo/). Obviously in practice you may be applying lots of different filters to enumerated molecules, but this is just a small example of something I found useful. 

The Jupyter Notebook can be found at: 

https://github.com/stephwills/Demo-removing-stringy-molecules/blob/main/Molecule%20filter.ipynb

Happy coding, 

Steph