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
6 - Files
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
Computer files
A computer file is a means by which data is stored on a permanent basis, or at least until it is deleted. It is held in a place such as a hard disk drive or removable storage device that is separate from the active, temporary memory of a computer. While the active memory may hold the current program and an amount of data, files represent a larger archive of stored data and the general idea is that this should survive when the computer is switched off. Parts of this saved data may be copied into the active memory as required. Loading data from files (which may be stored locally or transmitted via a network) places data into the active memory so that it can be worked upon efficiently. This data might be the code for a computer program which can then be executed to do a job. Naturally we save program instruction code as a file so that it may be used as many times as desired, without having to rewrite anything.
This chapter will focus on data files that store information for programs to work with, rather than the program files themselves, given that we can trust the Python interpreter to handle the loading and running of Python code. We will show how data can be read into a program and written out from a program, e.g. to and from files stored on disk. Such data files come in a large variety of shapes, sizes and forms (unlike Python files, which conform to a single, precise standard). Information can be stored in an endless number of ways, sometimes at the whim of the programmer, but fortunately in the spirit of cooperation (including mutual financial interest) particular types of data are often stored in a standardised way, with a known specification.
- Type
- Chapter
- Information
- Python Programming for BiologyBioinformatics and Beyond, pp. 78 - 99Publisher: Cambridge University PressPrint publication year: 2015