Python for kids?

Python is a very friendly programming language to start for adults as a very first programming experience. However, can it be used in education of younger? Of course. But I would recommend it as a second step after understanding basic algorithms (e.g. with Scratch or ScratchJr). Python is great to start their programming journey for teens, those who know what sentence structure is and who can do some mathematics.

Why Python is good to start?

  • Comparing to other widely used programming languages, it has quite easy syntax. You can experience it from your first line of clean and working code, so it will encourage you to write more.
  • It is a high level programming language, so you really don’t need too much code to see the effect – also encouraging.
  • There are a lot of information on the Web about Python, how to start with Python, what to do in case of failure – it is very important to have support, feeling that you have someone to turn to for help anytime.
  • If you want to sell something to kids, it must feel interesting to them. Well… you can make simple games with Python (and it’s not very hard), you can quite easily prepare a website and, last but not least, coding on Raspberry Pi may also be an argument.

There are also a couple of books concerning Python for kids. Just to name some:

  1. Python For Kids For Dummies: Brendan Scott
  2. Python for Kids. A Playful Introduction to Programming by Jason R. Briggs
  3. Python Projects for Kids. Jessica Ingrassellino

How Python connects you with biological databases? #1 – Uniprot

In bioinfomatics, the possibility to automatically use information gathered in numerous biological databases is crucial. Some databases are really easy to use, wrappers are great, some have very basic wrappers and some has none. There is a great movement to provide easy access to all biological databases and tools but we have still a lot to do.

One of the first databases I came across during Python programming was Uniprot. Uniprot ( is not so easy to use through their page if you don’t really know what are you looking for. It’s common thing for biological data – data is so diverse that it is impossible to avoid redundancy and complexity. However, after some time, it gets easier.

Let’s look on example page of human GAPDH protein ( You can see that data is categorized and it really makes your life easier. You can look at this page e.g., as xml (so you can extract the part you’re interested in) or text (each line starts with two letter information what is in this line, so it can also be extracted with the use of, e.g. regular expressions). There are multiple different approaches proposed to extract information you need (you have to be careful as some of the solutions may work for Python2 or Python3 only):

  1. requests (example shown here:
    import requests
    from StringIO import StringIO  # Python 2
    from io import StringIO  # Python 3
    params = {"query": "GO:0070337", "format": "fasta"}
    response = requests.get("", params)
    for record in SeqIO.parse(StringIO(r.text), "fasta"):
        # Do what you need here with your sequences.
  2. uniprot tools (I like this way, connecting it with regular expressions you can extract exact information you need;
    import uniprot as uni
    print'P31749', f='ACC', t='P_ENTREZGENEID') # map single id
    print['P31749','Q16204'], f='ACC', t='P_ENTREZGENEID') # map list of ids
    print uni.retrieve('P31749')
    print uni.retrieve(['P31749','Q16204'])
  3. swissprot (example shown
    #!/usr/bin/env python
    """Fetch uniprot entries for given go terms"""
    import sys
    from Bio import SwissProt
    #load go terms
    gos = set(sys.argv[1:])
    sys.stderr.write("Looking for %s GO term(s): %s\n" % (len(gos)," ".join(gos)))
    #parse swisprot dump
    k = 0
    for i,r in enumerate(SwissProt.parse(sys.stdin)):  
        sys.stderr.write(" %9i\r"%(i+1,))
        #parse cross_references
        for ex_db_data in r.cross_references:
            #print ex_db_data
            extdb,extid = ex_db_data[:2]
            if extdb=="GO" and extid in gos:
              k += 1
              sys.stdout.write( ">%s %s\n%s\n" % (r.accessions[0], extid, r.sequence) )
    sys.stderr.write("Reported %s entries\n" % k)  
  4. bioservices ( – this is interesting service to look at as they intend to include wrappers to all important biological databases
    from bioservices import UniProt
    u = UniProt(verbose=False)
    u.mapping("ACC", "KEGG_ID", query='P43403')
    defaultdict(<type 'list'>, {'P43403': ['hsa:7535']})
    res ="P43403")
    # Returns sequence on the ZAP70_HUMAN accession Id
    sequence ="ZAP70_HUMAN", columns="sequence")
  5. urllib

It is proposed on uniprot website, example:

import urllib,urllib2

url = ''

params = {
'query':'P13368 P20806 Q9UM73 P97793 Q17192'

data = urllib.urlencode(params)
request = urllib2.Request(url, data)
contact = "" # Please set your email address here to help us debug in case of problems.
request.add_header('User-Agent', 'Python %s' % contact)
response = urllib2.urlopen(request)
page =


You check out some general info about providing access to biological databases and tools here:

Programming for kids #2 – ScratchJr

ScratchJr is Scratch for younger kids. You don’t even need to write or read to use it but still it will show you basics of algorithms and enables to create simple scenes and games.

All you need is a tablet with Android or iPad and your free to go (app is free for both systems). It was, as Scratch, created in one of the best Universities in the World, MIT (Massachusetts Institute of Technology).

Similarily to Scratch, children can draw their ‘ghosts’ and background pictures and make them move (jumping dancing etc.). Simple loops and conditional actions are also possible. What children really like is the possibility to record own voices.

If you don’t have a tablet, you can also try some emulators for computers, e.g., .

More information you can find here:

There are also a lots of ideas on youtube:

Have fun!

Python possibilities for RNA structure folding

There are quite a lot of different software available for biologists for prediction of RNA secondary or tertiary structure. Here, I won’t discuss different algorithmic approaches and when to use them but I will check which approaches are available easily for Python users to include in their software (of course in specific needs only one software would be suitable and different – e.g. shell – approach would be required to use it automatically). I also won’t discuss software for protein structure folding because it is a whole new subject.

  1. Vienna Package ( – I guess that this is most popular package used in Python for RNA folding. Information from the site: “RNA secondary structure prediction through energy minimization is the most used function in the package. We provide three kinds of dynamic programming algorithms for structure prediction: the minimum free energy algorithm of (Zuker & Stiegler 1981) which yields a single optimal structure, the partition function algorithm of (McCaskill 1990) which calculates base pair probabilities in the thermodynamic ensemble, and the suboptimal folding algorithm of (Wuchty 1999) which generates all suboptimal structures within a given energy range of the optimal energy. For secondary structure comparison, the package contains several measures of distance (dissimilarities) using either string alignment or tree-editing (Shapiro & Zhang 1990). Finally, we provide an algorithm to design sequences with a predefined structure (inverse folding).”
  2. Multifold ( – According to the authors:”MultifFold is a Python based tool package for RNA footprinting data analysis.
    • It accepts RNA footprinting data generated from SHAPE-Seq, PARS and DMS-Seq technologies.
    • It can fold multiple secondary structures for each transcript based on user provideed constraints.
    • It could quantify the abundance of each structure centroid using the RNA footprinting data.
    • It provides a series of commands for users to customize every procedure.
    • It could handle RNA footprinting data generated from gene isoforms or overlapped transcripts.”
  3. Forgi ( – it is not for folding exactly but for manipulating folded structures and for this usage it is an excellent tool
  4. Barnacle ( – I think it’s not supported any more.
  5. Frnakenstein ( – actually uses Vienna Package

There are also other tools written in Python but not implemented with Python interface. Just to name one:

  1. modeRNA (

Also many short scripts are available at github and private websites but I would be careful with them:


If I left something out, please include it in the comment 🙂

Examples of Data Scientists’ Portfolios

While searching for employment as Data Scientist it is important to show your skills with well prepared portfolio, just as Developers show their github accounts to show their programming skills. Your portfolio should show how you use your skills stated in the Resume. I think that the most important thing is to tell a story about chosen data, show what you can do with openly available data, how insightful you are when it comes to asking questions based on the data and whether you can represent the results clearly (but also aesthetically and beautifully).

Let’s look at some examples of projects representation:

1.Projects – scientific way

I like this portfolio because I am scientist (but probably it’s not ideal for recruiters). Each project is described with abstract, methods and results with discussion (with accompanying figure). It’s quite simple with no graphical fireworks, but it’s clear.

2.Projects – more advertising way

Projects are represented by title, short comment and a image that redirects to the github project (code).

3.Analyses – tools used

As the author stated, not exactly projects but activities are shown. Each activity is represented by a graph and short description of statistical method/tool used. It for sure shows skills of the author.

4. Projects – very advertising

For sure the author knows how to make nice website ;). Again, projects are represented by title, short comment (however here in the caption also technologies are included) and a image that redirects to the extended project description or website presenting results.

5. Projects – story telling

I really like this portfolio as it is really ‘story telling’ portfolio. When you enter a project, story about data and various approaches to analyse it are presented.

As you can see, each Data Scientist has different way for showing their expertise. Which is best? Hard to say, depends what you want to do with data science and what kind of a company you want to work in.

Get noticed project – simple plots #2

Going back to simple plots module – I need to prepare guidelines for input files (csv and excel files) to use in the module.

Csv files are easier, they have one sheet while excel files may have many (and by default they have many). Additionally, in excel files, users often create multiple tables in single sheet and even embed plots.

Guidelines for .csv files:

  1. First row is column names
  2. At least two columns are provided

Guidelines for excel (.xls, .xlsx) files:

  1. Single sheet is provided (even if more sheets exist in the file, only first sheet will be taken to the analysis)
  2. Sheet contain single table where first row is column names
  3. At least two columns are provided

All columns including first row will be included in data as columns and can be chosen as x or y value (no matter if they are numerical or not).

Subjective guide to upcoming conferences/workshops in 2017

This is a very subjective guide to upcoming conferences in 2017 (in area of Data Science, Bioinformatics, Programming in general). Order is quite random.

  • BOSC 2017

Prague, Czech Republic

July 22 – 23, 2017


  • EMBL Summer School in Bioinformatics 2017

Heidelberg, Germany

June 26 – 30 June, 2017


  • EuroPython 2017

Rimini, Italy

July 9 – 16, 2017



Boston, US

August 20 – 23, 2017


  • RECOMB 2017

Hong Kong

May 3 – 7, 2017


Enjoy :)!