Skip to Content
Bioinformatics Programming Using Python
book

Bioinformatics Programming Using Python

by Mitchell L Model
December 2009
Intermediate to advanced
521 pages
15h 26m
English
O'Reilly Media, Inc.
Content preview from Bioinformatics Programming Using Python

Chapter 5. Classes

Simple collections are appropriate for organizing relatively simple and transient information. Elaborately nested collections, though, are not. Consider the output parsed from the very small GenBank entry shown in Example 4-31. Even though it ignores much of the file’s information, the program produces an elaborate nested structure. Working with such a structure creates the following serious problems:

Complexity

Using the representation in a program requires understanding its intricacies.

Awkward navigation

Accessing specific parts of the representation requires tricky combinations of index expressions and function calls.

Exposure to change

Changes to the representation require widespread changes in every program that uses it.

The combination of these factors causes mental strain, slows programming, makes debugging more difficult, and increases mistakes. It is too easy to write [1] instead of [0], or [1] instead of [0][1]. Later, such index expressions have no apparent meaning, so they are difficult to understand and correct. If changes must be made it is difficult to make them consistently and find every place that must be edited. While collections are powerful tools, they are best reserved for actions that operate on the entire collection, rather than being used with access expressions or functions that pick out specific elements.

These problems arise because of the entanglement of code that does need to know about representation details and code that does not. For ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bioinformatics with Python Cookbook - Third Edition

Bioinformatics with Python Cookbook - Third Edition

Tiago Antao

Publisher Resources

ISBN: 9780596804725Supplemental ContentErrata Page