![Page 1: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/1.jpg)
BIOC0023 – A (shortened) introduction to computing
Andrew C.R. Martin
University College London
![Page 2: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/2.jpg)
Aims and Objectives
To introduce some fundamentals of:– Computing concepts– Operating systems– Databases– Algorithms– Programming– Using the command line
![Page 3: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/3.jpg)
Computing concepts
![Page 4: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/4.jpg)
Computing concepts
VisualOutput
Data
Program
Database
![Page 5: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/5.jpg)
Computing concepts
VisualOutput
Data
Program
Database
![Page 6: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/6.jpg)
Computing concepts
VisualOutput
Data
Program
Database
![Page 7: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/7.jpg)
Computing concepts
VisualOutput
Data
Program
Database
![Page 8: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/8.jpg)
Computing concepts
VisualOutputData Program
RASMOL
pdb2pir
![Page 9: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/9.jpg)
Operating systems
![Page 10: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/10.jpg)
The software interface between users’ software and the computer’s hardware
Provides low-level networking Provides a set of tools for:
file handling user handling and security (e.g. passwords)
May provide a graphical user interface (GUI) May include other non-essential bundled tools
Operating Systems
![Page 11: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/11.jpg)
VMS (Dec) VME (ICL) CP/M (PCs) PRIMOS (Prime) MS-DOS (PCs) OS/2 (PCs) AmigaDOS (CBM) Unix (Various) MacOS (Apple)
Windows (PCs) Unix/Linux (Various) MacOS (Apple)
Operating Systems
![Page 12: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/12.jpg)
LinuxMacOS Windows
ComputerScientists
ZoologyDNA
Phylogeny
Mac PC
CrystallographyProtein
sequence &structure
Mini/Mainframe Operating Systems
![Page 13: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/13.jpg)
Databases
![Page 14: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/14.jpg)
Databases and databanks
DatabankA collection of data (normally in simple text files)
without an associated query toolQuery tools may be written as separate
applications
DatabaseA structured collection of data with some tool
enabling it to be ‘queried’
![Page 15: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/15.jpg)
Relational databases
Microsoft AccessSQL ServerOracleSybaseMySQLPostgreSQL
![Page 16: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/16.jpg)
Data are separated into tables or relations
Good database design requirescareful thought and planningnormalization
Maintains data integrity
Relational databases
![Page 17: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/17.jpg)
SQL - Structured Query Language
‘Standard’ database query languageUnfortunately most databases extend or deviate
from the standard
Provides 4 types of command:Schema creationData insertionData extractionDatabase management
![Page 18: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/18.jpg)
Algorithms
![Page 19: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/19.jpg)
Algorithms
“A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.”
A complete and precise set of steps that will solve a problem and achieve an identical result whenever given the same set of data to a defined level of accuracy.
• Ordered steps• Repeatable• Known/defned accuracy
![Page 20: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/20.jpg)
AlgorithmsSuppose we wish to count the amino acids in a PDB file...
Count the C-alpha (CA) atoms
Image from:ww2.chemistry.gatech.edu/~lw26/structure/protein/peptide_bond/
![Page 21: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/21.jpg)
AlgorithmsCount the CA atoms
![Page 22: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/22.jpg)
PDB File
EOF?
Read Line
DisplayResult
Start
Set ResCount = 0
Atom =CA?
IncrementResCount
YesYes
No
No
![Page 23: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/23.jpg)
Programming
![Page 24: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/24.jpg)
Programming languages
Rarely write directly in instructions understood by a computer
Use a high-level languageMany such languages:
CPerlC++JavaSmalltalkPython
ForthBASICFORTRANModula-IISimulaProlog
BCPLJavaScriptPascalAWKLISPCobol
![Page 25: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/25.jpg)
Language Categories
SourceFile
SourceFile
Processor
Executable
Compiler Interpreter
Data
Data
![Page 26: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/26.jpg)
General Purpose Languages - Python
General Purpose / JIT/Part-Compiled / OO• Design emphasizes code readability; concise
syntax.• Comprehensive standard library, plus maths and
scientific and BioPython libraries.
![Page 27: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/27.jpg)
Variables
Scalar variables
a = 5a = a + 1print (a)b = 'Hello world'
![Page 28: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/28.jpg)
Variables
Lists / Arrays (vectors)
position = [5.4, 2.7, 9.5]print (position[1])position[2] = 3.6
![Page 29: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/29.jpg)
Variables
Dictionaries / Hashes
position = {}position['x'] = 5.4position['y'] = 2.7position['z'] = 9.5
![Page 30: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/30.jpg)
Control statements
if:x = -6
if x > 0: print “Positive” elif x == 0: print “zero” else: print “negative”
Comparisons: < <= == >= > !=
![Page 31: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/31.jpg)
Control statements
while:
x = 5 while x > 0: print x x = x - 1
![Page 32: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/32.jpg)
Control statements
for:x = [100, 200, 300]
for i in x: print i ----------------------- for i in range(0, 100): print i ----------------------- x = [100, 200, 300] for i in range(3): print x[i]
Up to but not including this
number
![Page 33: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/33.jpg)
Folders, trees and directories
![Page 34: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/34.jpg)
OS GUIs
![Page 35: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/35.jpg)
Trees and directories
amartin Reading TEACHING
bioc2001
bioc1007
bioc2004
bioc3010
bioc3101 LECTURES
genbank.png
sprot.png
pdb.png
word2.png
bioc3101.odp
Code.png
db.png
dbgui.png
exe.png
...
...
... ...
......
![Page 36: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/36.jpg)
Trees and directories
...
Windows
Linux/Mac
Each disk (or network share) is the root of the tree:
C:\system D:\data
Everything lives under the same root:
//home/home/amartin/data/data/pdb
![Page 37: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/37.jpg)
Using the BASH shell command line
Linux / Mac :- the standard command lineWindows :- git-bash
Linux / Mac :- the standard command lineWindows :- git-bash
![Page 38: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/38.jpg)
Navigating the tree
...
Where am I?
What's in here?
pwd /c/Documents and Settings/amartin
ls Application Data/ Cookies/Desktop/ Favorites/…
-l Long format-t Sort by time-r Reverse the sort-h Human format for file sizes
ls -ltrh
![Page 39: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/39.jpg)
Navigating the tree
...
Moving down the tree
Moving up the tree
Moving across the tree
Going home
cd Desktoppwd /c/Documents and Settings/amartin/Desktop
cd ..
cd ../Start\ Menupwd /c/Documents and Settings/amartin/Start Menu
cd --or-- cd ~ --or-- cd $HOMEpwd /c/Documents and Settings/amartin/
![Page 40: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/40.jpg)
Handling files
...
View a whole file
View a page at a time
Copying a file
cat /etc/bash.bashrc
less /etc/bash.bashrc Press spacebar for next page'b' for previous page'>' for last page'<' for first page'/string' to search for 'string''q' to quit
cp /etc/bash.bashrc ~/mybashrc.txt
![Page 41: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/41.jpg)
Default input and output
...
Default input (stdin) is the keyboard
Default output (stdout) is the screen
cat (no command prompt displayed)HelloWorldCTRL-d (i.e. press and hold CTRL while pressing d)
cat ~/mybashrc.txt
![Page 42: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/42.jpg)
Redirection and pipes
...
Send the output of a command to a file
Receive input from a file
Sending the output of one program to the input of another
cat > test.txt (no command prompt displayed)Hello WorldCTRL-d
cat test.txt Hello World
cat < test.txt Hello World
cat /etc/bash.bashrc | less
![Page 43: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/43.jpg)
Other
...
Searching: Find lines in a file that contain a string
Creating directories
Removing an empty directory
Removing a file
Removing a directory and all its content
grep return /etc/bash.bashrc (finds all lines containing 'return')
mkdir newdir
rmdir newdir
rm myfile
rm -rf newdir
![Page 44: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/44.jpg)
Other
...
Sorting
Making scripts executable
sort /etc/bash.bashrc (alphabetical sort of lines in the file)
chmod +x scriptfile
![Page 45: BIOC0023 – A (shortened) introduction to computing...BIOC0023 – A (shortened) introduction to computing Andrew C.R. Martin University College London Aims and Objectives To introduce](https://reader035.vdocuments.us/reader035/viewer/2022071111/5fe63e58a5219d6beb0876bd/html5/thumbnails/45.jpg)
Programming in BASH
...
Renaming a set of files with extension .text to .txtfor file in *.textdo mv $file `basename $file .text`.txtdone