Skip to content

Latest commit

 

History

History
178 lines (126 loc) · 4.01 KB

File metadata and controls

178 lines (126 loc) · 4.01 KB

Basic programming skills (Python)

This is a beginner course suitable for anyone wanting to process scientific data with minimal or no prior knowledge.

Course objectives:

  • To be able to write programs in Python.
  • To master the rich set of Python libraries and modules.
  • Understand procedural control flow in Python

Course format:

  • The course includes presentations, assignments, and a final project.

Prerequisites:

  • Experience with a text editor similar to notepad.
  • Understanding of files and directories.

Version control with git and using GitHub

  • Dealing with projects on GitHub. (eg. biopython)
  • Creating GitHub pages.
  • Writing nice documents using Markdown.

Introduction to Computers and Programming

  • What is programming?
  • The parts of a computer and a mobile phone
  • Different types of programming languages: Compiled vs. Interpreted
  • Programming paradigms: imperative, procedural, oop, declarative, functional, logic, mathematical.
  • Software licensing model (Closed Source, Share-ware, Open Source, Free Software)
  • Software distribution model (packaged, service, application).
  • Single core, multi core, cluster
  • Complexity - run time, memory usage

Development and runtime environment in Python and elsewhere

  • Various ways to write Python code

  • VS Code - application development.

  • PyCharm

  • Jupyter Notebook - Analyzing data in an interactive way

  • Notepad++ and the command line.

  • Spyder

  • Running from the IDE vs. the command line vs. on a server vs. in a cluster.

  • Compare the above with Matlab.

The Scientific libraries

Introduction to Python

  • Installing Python
  • Where and why to use Python
  • Using the Python interactive interpreter
  • Documentation and how to get help?
  • Indentation

Python Types and operators

  • Strings
  • Numbers
  • Lists (arrays)
  • Tuples
  • Dictionaries (hashes)
  • Sorting

Writing command line application in Python.

  • Why not GUI?
  • sys.argv
  • argparse

Functions subroutines

  • Function parameters
  • Positional parameters
  • Named parameters
  • Default values
  • Optional parameters
  • Return values
  • Function documentation
  • Lambda functions

Control flow

  • For loops
  • While loops
  • Loop controls
  • Conditionals
  • Chained comparison
  • Enumerate
  • Boolean and logical operators

IO

  • print
  • print formatting
  • read/write files

Regular expression (pattern matching)

  • Matching all
  • Searching for a single match
  • Meta characters
  • Character classes
  • Special character classes
  • Quantifiers
  • Alternatives
  • Modifier flags
  • Anchors
  • Back-references
  • Substitution

The Python standard library

  • Filesystem related functions
  • Running external processes

Creating modules

  • Loading a module
  • Finding a module in a private directory
  • Changing the search path to a relative directory
  • Importing selected functions
  • Namespaces
  • Creating executable module

Exception handling

  • Creating non-fatal warnings
  • Catching exceptions
  • Handling exceptions
  • Throwing a new exception
  • The final block
  • Creating your own exception

Excel and CSV

  • Reading and writing Excel files
  • csv
  • openpyxl
  • pandas

GUI using Tk

  • The concept of creating a Graphical User Interface (GUI).
  • Demo various widgets of Tk.
  • Simple example.

Additional uses

  • Installing and using 3rd party modules
  • Writing simple web scraping program
  • Writing a simple Web application
  • Accessing SQL databases

Learning Outcomes

Upon successful completion of this course students should be able to

  • Write simple data processing programs in Python
  • Convert files from one format to another format required in scientific environments.
  • Differentiate between major programming environments.