Time to crack coding?
Posted by Alex Eve, on 24 March 2020
As labs shut down in response to the coronavirus pandemic, some might be unsure of what to do next. Even if your project doesn’t have a computational (i.e. bioinformatic) aspect, knowing some code can still be useful to present your research. Importantly, learning to code is particularly well-suited for the current situation, because there are a lot of free resources online that make it possible to learn by yourself with just a computer.
Before I go any further, I must acknowledge that during this time, many researchers will find themselves in a strange and stressful situation to which everyone will react differently. Although some will see this as an opportunity, others might feel they should be productive and find that they are unable, because they don’t have the resources, emotional energy or time, especially if they’re now taking on additional responsibilities such caring for children full time etc. The suggestions in this post are just that – suggestions – something to do if you are bored. They are not requirements or necessities. Should you feel that you’re under too much of a burden then try something else instead or – and this is important too – just try to rest. Please do not feel that you need to be productive. We should support everyone’s unique situation, rather than compare it our own response and responsibilities.
An additional disclaimer: I am, by no means, a coding expert. The coding languages I suggest are based on the fact that they can be used for universal tasks in academia (and beyond), and that they are simple enough to pick up and produce something useful without knowing the whole language. However, it’s unlikely I’ll be able to help with any specific problems! It’s also important to recognise that coding can be frustrating and time-consuming. Sometimes, it can be a case of a learning through a lot of trial and error, or you might find you copy code without ever understanding how it works. Both are fine and, if want to persevere, remember to be patient with yourself.
Below I’ve introduced three coding languages. To start, I recommend picking just one and setting yourself a small goal of what you would like to do with it. I find that it can sometimes be difficult to know where to start if you’re not really sure what you want to end up with!
Pronounced “Lay-tek”, LaTeX is a coding language that is used for preparing, formatting and producing written documents. It can be useful for putting together a formatted version of your preprint or writing your thesis. The bonus here is that, since it is written in code, the file size is quite small, which makes it less likely to crash when producing large documents. It is also great at integrating mathematical equations and figures, and integrates with reference management software to produce bibliographies. Perhaps most importantly, it uses a nice font(!)
The hardest thing about using LaTeX is knowing which software to use. There are several different apps (usually with ‘tex’ somewhere in the name) that allow you to write in LaTeX and compile a document. To be honest, I have no idea which one is best or indeed the difference between them (I use TeXShop). To start off with, I recommend using Overleaf, which is free for personal and uses a web-browser, so no need to download anything. They also provide a number of useful tutorials and walkthroughs to get started. There are also plenty of other research sites that you can find with a quick Google search. To begin with, you could try:
- Producing a thesis cover page.
- Producing a cover letter for a job application.
- Writing your C.V.
- Formatting a figure and figure legend.
R is a very powerful language that can be used for all types of statistical data analysis and presentation. All I know how to do with it, however, is how to turn an excel file into a graph. As R is so powerful, even the introductory resources can be quite complex and quickly dive-in to specialist terminology. I recommend this introductory workshop (still in early phases of being put together) by DataCarpentry. As a side-note they run some great workshops on a number of different coding languages and I would recommend attending if you get the chance. In addition, sometimes it’s best just to Google what you want to do, copy that code and learn yourself through tweaking it here and there. This approach isn’t so different from wet-lab research: imagine, for example, that R is your model organism and your knocking-in and knocking-out genes – with instant results! To start off with you could try:
- Producing a bar graph and formatting the font, colours and axes.
- Presenting some data as a box and whiskers plot.
- Conducting some simple statistical analysis.
Whilst thinking about data presentation, please also take some time to read the excellent posts on data visualisation and statistics by Joachim Goedhart here on the Node.
UPDATE 01/04/2020: HarvardX Biomedical Data Science Open Online Training also has some great guides, including step-by-step Youtube walk-throughs.
HTML provides a basic language for producing websites and CSS is used to make them look better. Some fundamental knowledge of these can help when trying to customise your lab website or formatting a blog post. You don’t need any specialist software, you can just use Notepad or TextEdit to create the file (save the files with .html or .css and they’re converted automatically and will open in your browser), although some programmes do make it easier when starting out by colour-coding parts of code. Again, tons of material is provided online. A good start for learning HTML is provided in this tutorial from w3schools.com and the CSS intro is very good too. As always, Google is your friend. Why not experiment by:
- Producing a simple homepage for a website?
- Writing a blog post (for the Node, maybe?) introducing some HTML elements?
- Presenting your data in a HTML table?
- Customising an existing HTML file with your own CSS code?
If a group would like to start learning together, it might be a good idea to start a Slack group to support each other! If you have any other suggestions on languages to add to this post, please comment or add to the Twitter thread. For other suggestions for what to do outside of the lab, check out this great infographic from Dr Zoë Ayres. Why not write use your new skills to a post for the Node on one of these ideas?