What this does
For anyone working on the Coursera Bioinformatic Algorithms Specialisation or solving Rosalind problems using Python. I've written this script to generate a standardised way to structure, write and test your code.
The sample and extra data provided from the Coursera course are converted into valid unit tests, the advantage being to test your code against the datasets involves simply running
The other advantage is it handles virtual environments/requirements, using PyPy and a PyPy compatible GTK library, to ensure the fastest possible development, runtime and testing.
Simply create a virtualenv and install whatever's in the requirements.txt using
pip install -r requirements.txt.
How to run
python biogen.py project_root_foldervia the command line. This root folder is the parent folder for all your bioinformatic algorithms coursework. For example
Answer the questions that pop-up on the screen(simply paste in from Rosalind/Coursera)
Within the project root, if you have not done so run
pip install -r requirements.txtto install the initial project if you have not done so. Any new requirements should be added in here.
You should now also have a
bio_**_test.py. If you run
python bio_**_test.pyit will throw up two errors, that your code neither passes the sample nor extra dataset unit tests.
Now just write the working code and re-run the unit tests using
python bio_**_test.pyuntil it finally passes. Now you're good to test with live data.
Because the live data tends to have a 5 minute time-limit, I've written a helper function to run when you are testing the code with live data. In the generated code folder, simply run
python bio_**.py livetestand a text input will pop-up asking for your input. If pyperclip is installed this will also automatically copy the result to clipboard, especially handy for huge result sets.
The generated code is meant to be a starting point. For example, if you end up writing more functions, you should be writing unit tests for those functions too.
- Better testing of inputs
- Create an activate and deactivate that automatically store the requirements a developer adds while working on code