Bio-NMR workshop "Automating NMR workflows: Introduction to python programming"

adventurescoldSoftware and s/w Development

Nov 7, 2013 (3 years and 10 months ago)


Bio-NMR workshop "Automating NMR workflows: Introduction to python
The workshop teaches the basics of python programming
using lectures, some demonstrations and a lot of
exercises to apply the knowledge in practice. All topics
are built around the goal to write your first script that
includes many of the tools that you need for starting to
automate your own workflows. The course includes
following topics:
‣ Getting started. Before writing any code, you need to set up a convenient
programming environment and make sure that all requirements are met. Here you will
‣ the requirements for programming in python
‣ how to set up a programming environment
‣ how to use your programming environment efficiently
‣ Variables. Variables are the fundamental elements needed for programming, and here
you will learn the basics of using variables:
‣ declarations
‣ values
‣ types
‣ operations
‣ Conditional statements. It is a common need to perform operations only under
certain conditions. Using conditional statements you will be able to define conditions
and actions that will lead to the desired result. Common statements that will be
covered are:
‣ if
‣ elif (else if)
‣ else
‣ Functions. Programming is a way to accomplish your tasks faster and easier.
Functions will help you to do that even better. With the help of a function you will avoid
writing a duplicated code. Besides knowing how to use functions will help you to keep
code clean and maintainable.
‣ Modules. A lot of functionally is already available in the basic python modules. Even
more modules can be obtained from the internet. Knowing how to use modules will
help you to avoid writing unnecessary code. This topic will cover how to:
‣ find and import useful modules
‣ use modules
‣ create your own modules
‣ Interactive input. In many cases your program should accept variable input and be
responsive - you do not want to change your program or script every time you want to
apply it on a different data file. An interactive data input will help you to solve this and
similar issues, and you will learn how to:
‣ provide variables when starting a program
‣ provide input while running a program
‣ Collections. Especially when dealing with a large amount of scientific data you have to
transform it into an easily manageable structure. By using collections you can easily
structure, access and manipulate your data. We will cover:
‣ Lists
‣ Dictionaries
‣ Files. Data on a computer is stored in files with various file types. Here we will teach
you how to access and manipulate text files:
‣ reading
‣ writing
‣ appending
‣ Text manipulation. While doing your research, often collected data is expressed in
text. An automation of extensive text processing tasks will generally save you a lot of
time. Here you will learn how to:
‣ search
‣ change
‣ format text
‣ Loops. Recurrent actions on all data elements are required commonly. By mastering
loops you will be able to apply needed action on all data elements. Several types of
loops will be explained:
‣ the “for” loop
‣ the “while” loop
‣ Error handling. Your code may run into unexpected situations, and errors will stop the
program from working. This section will show you how to deal with common errors. It
covers, among others:
‣ Exception handling
‣ Best practices. Throughout the course you will be taught best practices for
programming, which will make life easier while writing and maintaining programs. Here
we will summarize what you have learned in the course and place the knowledge in a
wider context that will help you build your own programs and scripts for your specific