Presentation is loading. Please wait.

Presentation is loading. Please wait.

Trinity College Dublin, The University of Dublin A Brief Introduction to Scientific Programming with Python Karsten Hokamp, PhD TCD Bioinformatics Support.

Similar presentations


Presentation on theme: "Trinity College Dublin, The University of Dublin A Brief Introduction to Scientific Programming with Python Karsten Hokamp, PhD TCD Bioinformatics Support."— Presentation transcript:

1 Trinity College Dublin, The University of Dublin A Brief Introduction to Scientific Programming with Python Karsten Hokamp, PhD TCD Bioinformatics Support Team TCD, 26/08/2015

2 Trinity College Dublin, The University of Dublin Overview Programming First Python script/program Why Python? Bioinformatics examples Additional resources Outlook

3 Trinity College Dublin, The University of Dublin What is programming and why bother?  Data processing  Automation  Combination of programs for analysis pipelines  More control and flexibility  Better understanding of how programs work

4 Trinity College Dublin, The University of Dublin Programming Concepts  Turn into a very meticulous problem solver  Break problems into small details  Keep it variable  Give very precise instructions

5 Trinity College Dublin, The University of Dublin Programming Concepts "human" recipe

6 Trinity College Dublin, The University of Dublin Programming Concepts "computerised" recipe

7 Trinity College Dublin, The University of Dublin Mac for Windows users The main differences:  cmd instead of ctrl (e.g. cmd-C for copying)  right-click mouse: ctrl-click  # character: alt-3  switch between applications: cmd-tab  Spotlight (top right) for finding files/programs  Apple symbol (top left) for logging out

8 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment open through Spotlight

9 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment

10 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment Alternatively: open through Finder

11 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment interactive Python console

12 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment simple Python statement

13 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment user input output

14 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment try a few simple numeric operations try a few simple numeric operations user input output

15 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment repeat/combine previous commands by clicking into them and hitting return (use left/right arrows and delete to edit them) repeat/combine previous commands by clicking into them and hitting return (use left/right arrows and delete to edit them)

16 Trinity College Dublin, The University of Dublin IDLE: Integrated DeveLopment Environment Console vs Editor ConsoleEditor interactiverequires extra click for running great for trying out codeadditional IDLE functionality not suited for long scriptssuited for long scripts no saving of codeallows to save code

17 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts open a new file

18 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts write some code

19 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts run your code shortcut: F5

20 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts save file first

21 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts specify a file name

22 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts write more code IDLE provides help write more code IDLE provides help

23 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts save and run: cmd-S then F5 save and run: cmd-S then F5

24 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts make it personal

25 Trinity College Dublin, The University of Dublin IDLE: Writing Python Scripts keep going

26 Trinity College Dublin, The University of Dublin Python vs Perl the equivalent in Perl the equivalent in Perl

27 Trinity College Dublin, The University of Dublin Python vs Perl the equivalent in Perl the equivalent in Perl

28 Trinity College Dublin, The University of Dublin Python vs Perl fewer special characters indentation enforced more user-friendly functions Python Perl

29 Trinity College Dublin, The University of Dublin Why Python?  easy to learn  great for beginners  enforces clean coding  great for teachers  comes with IDE  avoids command-line usage  object-orientated  code reuse and recycling  very popular  many peers  BioPython  many bioinformatics modules

30 Trinity College Dublin, The University of Dublin Simple Bioinformatics Example built-in function 'len'

31 Trinity College Dublin, The University of Dublin Simple Bioinformatics Example built-in function 'set'

32 Trinity College Dublin, The University of Dublin Simple Bioinformatics Example built-in functions 'sorted' and 'set'

33 Trinity College Dublin, The University of Dublin Simple Bioinformatics Example string method 'count'

34 Trinity College Dublin, The University of Dublin Simple Bioinformatics Example string method 'upper'

35 Trinity College Dublin, The University of Dublin  Basic sequence manipulation  Fetch records from databases  Multiple sequence alignment (Clustal, Muscle)  Sequence similarity search (Blast)  Working with motifs: MEME, Jaspar, Transfac  Phylogenetics  Clustering  Visualisation

36 Trinity College Dublin, The University of Dublin  Parsing GenBank records: from Bio import SeqIO record = SeqIO.read("AE014613.1.gb", "genbank") record.description  'Salmonella enterica subsp. enterica serovar Typhi Ty2, complete genome.' len(record.features)  9086

37 Trinity College Dublin, The University of Dublin  Parsing sequence records: from Bio import SeqIO for entry in SeqIO.parse("tlr4_protein.fa", "fasta") : print(entry.description) print(len(entry), 'bp') gi|765368240|gb|AJR32867.1| TLR4 [Gallus gallus] 843 bp gi|111414439|gb|ABH09759.1| toll-like receptor 4 [Bos taurus] 841 bp gi|6175873|gb|AAF05316.1|AF177765_1 toll-like receptor 4 [Homo sapiens] 839 bp …

38 Trinity College Dublin, The University of Dublin  Graphics: Chromosomes colour-coded by GC content (Bioinformatics with Python Cookbook)

39 Trinity College Dublin, The University of Dublin  Graphics: Coloured phylogenetic tree from Ebola sequences (Bioinformatics with Python Cookbook)

40 Trinity College Dublin, The University of Dublin Additional Resources https://store.continuum.io/cshop/anaconda/

41 Trinity College Dublin, The University of Dublin Visualisations with Matplotlib http://matplotlib.org/gallery.html

42 Trinity College Dublin, The University of Dublin Examples http://scikit-learn.org

43 Trinity College Dublin, The University of Dublin Scikit-learn – Machine Learning in Python Machine Learning: PCA of Iris data set http://scikit-learn.org/stable/auto_examples/decomposition/plot_pca_iris.html

44 Trinity College Dublin, The University of Dublin Python Help

45 Trinity College Dublin, The University of Dublin Online courses  http://biopython.org/DIST/docs/tutorial/Tutorial.html http://biopython.org/DIST/docs/tutorial/Tutorial.html  http://dowell.colorado.edu/education-python.html  http://www.pasteur.fr/formation/infobio/python http://www.pasteur.fr/formation/infobio/python  https://www.codecademy.com/tracks/python  http://anh.cs.luc.edu/python/hands-on/ http://anh.cs.luc.edu/python/hands-on/  https://www.coursera.org

46 Trinity College Dublin, The University of Dublin Books

47 Trinity College Dublin, The University of Dublin Conclusions You have been briefly introduced to Python and IDLE. You have learnt about programming concepts. You have seen examples of what can be accomplished through Python. Topics of an extensive Python course: Coding in Python – variables, scope, functions… Bioinformatics with BioPython Automated biological data analysis – your interests!

48 Trinity College Dublin, The University of Dublin Thank You! http://bioinf.gen.tcd.ie/workshops/python

49 Trinity College Dublin, The University of Dublin Don't forget to log out!


Download ppt "Trinity College Dublin, The University of Dublin A Brief Introduction to Scientific Programming with Python Karsten Hokamp, PhD TCD Bioinformatics Support."

Similar presentations


Ads by Google