Book contents
- Frontmatter
- Contents
- Preface
- Acknowledgements
- 1 Prologue
- 2 A beginners’ guide
- 3 Python basics
- 4 Program control and logic
- 5 Functions
- 6 Files
- 7 Object orientation
- 8 Object data modelling
- 9 Mathematics
- 10 Coding tips
- 11 Biological sequences
- 12 Pairwise sequence alignments
- 13 Multiple-sequence alignments
- 14 Sequence variation and evolution
- 15 Macromolecular structures
- 16 Array data
- 17 High-throughput sequence analyses
- 18 Images
- 19 Signal processing
- 20 Databases
- 21 Probability
- 22 Statistics
- 23 Clustering and discrimination
- 24 Machine learning
- 25 Hard problems
- 26 Graphical interfaces
- 27 Improving speed
- Appendices
- Glossary
- Index
- Plate section
8 - Object data modelling
Published online by Cambridge University Press: 05 February 2015
- Frontmatter
- Contents
- Preface
- Acknowledgements
- 1 Prologue
- 2 A beginners’ guide
- 3 Python basics
- 4 Program control and logic
- 5 Functions
- 6 Files
- 7 Object orientation
- 8 Object data modelling
- 9 Mathematics
- 10 Coding tips
- 11 Biological sequences
- 12 Pairwise sequence alignments
- 13 Multiple-sequence alignments
- 14 Sequence variation and evolution
- 15 Macromolecular structures
- 16 Array data
- 17 High-throughput sequence analyses
- 18 Images
- 19 Signal processing
- 20 Databases
- 21 Probability
- 22 Statistics
- 23 Clustering and discrimination
- 24 Machine learning
- 25 Hard problems
- 26 Graphical interfaces
- 27 Improving speed
- Appendices
- Glossary
- Index
- Plate section
Summary
Data models
This chapter delves more deeply into the topic of creating custom Python objects using class definitions. Given that we have discussed the basics of object-oriented programming in Chapter 7, we now move on to illustrate how such mechanisms can be used in a practical, scientific sense. If you are interested in only a light introduction to Python, you might consider skipping this chapter on a first reading. However, the objects we discuss here will underpin many of the examples given later on in this book, in Chapters 15 and 20, so you may like to look back to see how such things are constructed.
In the previous chapter we saw how to introduce our own types of data object into Python, using classes. Here we move on to look at how to use a number of different, but connected, classes to construct what is often known as a data model. A data model is an abstract description of concepts that can be used to build a computational version of some topic or real-world situation that you are interested in. Essentially, you examine the kind of information you wish to describe and divide it up into conceptual parcels. Each of these will become one kind of computer object (a class with attributes, functions and links to other classes), which then allows you to create a synthetic analogue of the thing you are interested in. Virtually all programs, irrespective of size, rely on some kind of underlying model to organise data, although this may not use object-oriented programming and is often not formalised in any way. No data model can be expected to be a perfect computer representation of what it describes, but the idea is to make it good enough to serve a useful purpose, by having some of the properties of the things being modelled.
- Type
- Chapter
- Information
- Python Programming for BiologyBioinformatics and Beyond, pp. 117 - 136Publisher: Cambridge University PressPrint publication year: 2015