Shell scripts on Pegasus 2

Slides:



Advertisements
Similar presentations
ARDUINO CLUB Session 1: C & An Introduction to Linux.
Advertisements

Logic & program control part 2: Simple selection structures.
Variables and I/O. Types Strings –Enclosed in quotation marks –“Hello, World!” Integers –4, 3, 5, 65 Floats –4.5, 0.7 What about “56”?
Variables and I/O. Types Strings –Enclosed in quotation marks –“Hello, World!” Integers –4, 3, 5, 65 Floats –4.5, 0.7 What about “56”?
Introduction to Python
QUOTATION This chapter teaches you about a unique feature of the shell programming language: the way it interprets quote characters. Basically, the shell.
Introduction to Python (for C++ programmers). Background Information History – created in December 1989 by Guido van Rossum Interpreted Dynamically-typed.
A First Book of ANSI C Fourth Edition
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
WEEK EXCEPTION HANDLING. Syntax Errors Syntax errors, also known as parsing errors, are perhaps the most common kind of complaint you get while.
Introduction to Programming Workshop 1 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Operators in Python. Arithmetic operators Some operators in Python will look familiar (+, -, *, /) Others are new to you (%, //, **) All of these do work.
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
Python Functions.
Variables, Expressions and Statements
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Operators and Expressions. 2 String Concatenation  The plus operator (+) is also used for arithmetic addition  The function that the + operator performs.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
1 Homework Done the reading? –K&R –Glass Chapters 1 and 2 Applied for cs240? (If not, keep at it!) Gotten a UNIX account? (If not, keep at it!)
More Python Proglan Python Session 2. Lists  Lists are like flexible arrays. They can contain as many variables as you wish, and all variable types are.
C++ Namespaces, Exceptions CSci 588: Data Structures, Algorithms and Software Design All material not from online sources copyright © Travis Desell, 2011.
Chapter 2: Data and Expressions. Variable Declaration In Java when you declare a variable, you must also declare the type of information it will hold.
 Prepared by: Eng. Maryam Adel Abdel-Hady
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Python. Quick Points About Python Python is an interpreted language –Like Perl you don’t have to compile it –It has a command line interpreter if you.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
Lecture 3: Getting Started & Input / Output (I/O)
Computer Programming Your First Java Program: HelloWorld.java.
Information and Computer Sciences University of Hawaii, Manoa
C++ First Steps.
NGS File formats Raw data from various vendors => various formats
Exceptions in Python Error Handling.
CMPT 120 Topic: Python’s building blocks -> More Statements
Python Variable Types.
EECS 183 Discussion #9: It’s time to “Git” Python! November 22nd, 2016
Expressions.
Multiple variables can be created in one declaration
Assignment and Arithmetic expressions
Variables, Expressions, and IO
Statement atoms The 'atomic' components of a statement are: delimiters (indents, semicolons, etc.); keywords (built into the language); identifiers (names.
Introduction to C++ October 2, 2017.
Fundamental of Java Programming Basics of Java Programming
Engineering Innovation Center
Math in C The math blocks you've used in Scratch can all be recreated in C!
Ruth Anderson UW CSE 160 Winter 2017
Arithmetic operations, decisions and looping
PYTHON Varun Jain & Senior Software Engineer
Python Primer 2: Functions and Control Flow
Introduction to C++ Programming
Introduction to Python
Coding Concepts (Sub- Programs)
Topics Designing a Program Input, Processing, and Output
Variables, Data Types & Math
Python Primer 1: Types and Operators
Core Objects, Variables, Input, and Output
Data Types and Expressions
Python Syntax Errors and Exceptions
CISC101 Reminders Assignment 3 due next Friday. Winter 2019
Beginning Python Programming
COMPUTER PROGRAMMING SKILLS
Python Review
Unit 3: Variables in Java
Comparing Python and Java
What is a Function? Takes one or more arguments, or perhaps none at all Performs an operation Returns one or more values, or perhaps none at all Similar.
Class code for pythonroom.com cchsp2cs
Data Types and Expressions
Data Types and Expressions
Presentation transcript:

Shell scripts on Pegasus 2 Log into pegasus2 using ssh <username>@pegasus2.ccs.miami.edu To start a job you need a shell script which shell? job name #!/bin/bash #BSUB -J HIV #BSUB -e %HIV.err #BSUB -o %HIV.out #BSUB -n 1 #BSUB -q general #BSUB -W 72:00 # cd ${HOME}/Viruses/HIV/ (../Python/distanceClustering2.py ../human_mint_biogrid_hprd_hint.ppi HIV_targets_HPIDB.txt ../human_essential_genes.txt > HIV_ess) >& HIV_ess.log file for stderr file for stdout number of cores queue time allocation your script

Shell scripts on Pegasus 2 submit a job with bsub < script.sh bjobs transfer data through scp <user>@pegasus2-gw.ccs.miami.edu:~/. into your home directory scp <user>@pegasus2-gw.ccs.miami.edu:/scratch/<user> into scratch directory returns the status of current jobs

Python Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. Python 2 is more widely used and supported. However, Python 3 is more semantically correct, and supports newer features. For example, one difference between Python 2 and 3 is the print statement. In Python 2, the "print" statement is not a function, and therefore it is invoked without parentheses. However, in Python 3, it is a function, and must be invoked with parentheses. Our first Python program: #!/usr/bin/python print “Hello world!”

Intendation Python uses indentation for blocks, instead of curly braces. Both tabs and spaces are supported, but the standard indentation requires standard Python code to use four spaces. For example: #!/usr/bin/python x = 1 if x == 1: # indented four spaces print "x is 1."

Variables & Types Numbers - Python supports two types of numbers - integers and floating point numbers. myint = 7 myfloat = 7.0 myfloat = float(7) Strings - Strings are defined either with a single quote or a double quotes. mystring = 'hello’ mystring = “hello” mystring = "Don't worry about apostrophes" coercing an int into a float

Variables & Types Simple operators can be executed on numbers and strings: #!/usr/bin/python one = 1 two = 2 three = one + two print three hello = "hello" world = "world" helloworld = hello + " " + world print helloworld sum = str(one) + " " + (two) print sum coercing an int into a string

Variables & Types Assignments can be done on more than one variable "simultaneously" on the same line like this: #!/usr/bin/python a,b = 1,2 print a, b one = 1 two = 2 hello = "hello" #would this work? print one + two + hello assigning 1 to a and 2 to b

Lists Lists are very similar to arrays. They can contain any type of variable, and they can contain as many variables as you wish. Lists can also be iterated over in a very simple manner. #!/usr/bin/python mylist = [] mylist.append(1) mylist.append(2) mylist.append(3) print(mylist[0]) # prints 1 print(mylist[1]) # prints 2 print(mylist[2]) # prints 3 # prints out 1,2,3 for x in mylist: print x

Lists What would happen here? catching errors #!/usr/bin/python mylist = [1,2,3] print(mylist[10]) #!/usr/bin/python mylist = [1,2,3] try: print(mylist[10]) except IndexError: pass expect an error to occur catch the error what to do if the error occurred

Basic operators Just as any other programming languages, the addition, subtraction, multiplication, and division operators can be used with numbers. #!/usr/bin/python number = 1 + 2 * 3 / 4.0 print number remainder = 11 % 3 print remainder squared = 7 ** 2 cubed = 2 ** 3 print squared, cubed does python follow order of operations? modulo operation equivalent to 7*7 equivalent to 2*2*2

Basic operators - numbers Just as any other programming languages, the addition, subtraction, multiplication, and division operators can be used with numbers. #!/usr/bin/python number = 1 + 2 * 3 / 4.0 print number remainder = 11 % 3 print remainder squared = 7 ** 2 cubed = 2 ** 3 print squared, cubed does python follow order of operations? modulo operation equivalent to 7*7 equivalent to 2*2*2