Command line parsing Morten Nielsen BioSys, DTU. Example. Blast command-line options blastpgp - blastpgp 2.2.18 arguments: -d Database [String] default.

Slides:



Advertisements
Similar presentations
Lecture 3 Some commonly used C programming tricks. The system command Project No. 1: A warm-up project.
Advertisements

CPSC 441 TUTORIAL – JANUARY 16, 2012 TA: MARYAM ELAHI INTRODUCTION TO C.
Blast outputoutput. How to measure the similarity between two sequences Q: which one is a better match to the query ? Query: M A T W L Seq_A: M A T P.
The fast way Morten Nielsen BioSys, DTU. The fast algorithm (O2) Database (m) Query (n) Open a gapExtending a gap P Q Affine gap penalties.
Perl I/O Learning Objectives: 1. To understand how to perform input from standard Input & how to process the input 2. To understand how to perform input.
CMPE13 Cyrus Bazeghi Hands on with Functions and IO.
Command-line arguments CS 201 Fundamental Structures of Computer Science.
PSI (position-specific iterated) BLAST The NCBI page described PSI blast as follows: “Position-Specific Iterated BLAST (PSI-BLAST) provides an automated,
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU C programming Morten Nielsen, CBS, BioCentrum, DTU.
Perl I/O Software Tools. Lecture 15 / Slide 2 Input from STDIN Reading from STDIN is easy, and we have done it many times. $a = ; In a scalar context,
C Language Summary HTML version. I/O Data Types Expressions Functions Loops and Decisions Preprocessor Statements.
Programming Review: Functions, pointers and strings.
Lab2 TA Notes. Set up for Visual C++ New Workspace Win32 Console Application – This runs from a command line Chose Blank Project Add your.C file Build.
Advanced Programming in the UNIX Environment Hop Lee.
Psi-Blast: Detecting structural homologs Psi-Blast was designed to detect homology for highly divergent amino acid sequences Psi = position-specific iterated.
Blast heuristics Morten Nielsen Department of Systems Biology, DTU.
CS1061 C Programming Lecture 15: More on Characters and Strings A. O’Riordan, 2004.
Command line arguments. – main can take two arguments conventionally called argc and argv. – Information regarding command line arguments are passed to.
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
A brief [f]lex tutorial Saumya Debray The University of Arizona Tucson, AZ
Some Example C Programs. These programs show how to use the exec function.
1 Electrical mesh circuits Systems of simultaneous equations Solving using Gauss Elimination Simple C program to count letters Using gnuplot to see results.
University of Calgary – CPSC 441. C PROGRAM  Collection of functions  One function “main()” is called by the operating system as the starting function.
Strlen() implementation /* strlen : return length of string s */ int strlen(char *s) { int n; for (n = 0 ; s[n] != ‘\0’ ; n++) ; return n; } /* strlen.
1 Using Yacc: Part II. 2 Main() ? How do I activate the parser generated by yacc in the main() –See mglyac.y.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
File Handling Spring 2013Programming and Data Structure1.
Shell (Part 2). Example r What if we want to support something like this: m ps –le | sort r One process should execute ps –le and another should execute.
#include int main(void) { printf("Hello, world!\n"); return 0; } entry point called on program start only one main( ) in any program # for preprocessor.
ITEC 320 C++ Examples.
22. FILE INPUT/OUTPUT. File Pointers and Streams Declarations of functions that perform file I/O appear in. Each function requires a file pointer as a.
Identifying the ortholog of TNF (Tumor necrosis factor) in mosquito genomes Pet Projects:
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Command Line Arguments.
File IO and command line input CSE 2451 Rong Shi.
Shell (Addendum). Example r What if we want to support something like this: m ps –le | sort r One process should execute ps –le and another should execute.
Lecture 3: Getting Started & Input / Output (I/O) “TRON” Copyright 1982 (Walt Disney Productions)
1 Command-Line Processing In many operating systems, command-line options are allowed to input parameters to the program SomeProgram Param1 Param2 Param3.
1 File Handling. 2 Storage seen so far All variables stored in memory Problem: the contents of memory are wiped out when the computer is powered off Example:
Biocomputation: Comparative Genomics Tanya Talkar Lolly Kruse Colleen O’Rourke.
Command line parsing Morten Nielsen Department of systems Biology, CBS, DTU.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Recursion.
Arrays, Strings, and Memory. Command Line Arguments #include int main(int argc, char *argv[]) { int i; printf("Arg# Contents\n"); for (i = 0; i < argc;
Arrays and Pointers (part 2) CSE 2031 Fall March 2016.
1 Homework Continue with K&R Chapter 5 –Skipping sections for now –Not covering section 5.12 Continue on HW5.
 Dynamic Memory Allocation  Linked Lists  void main() {{ ◦ FILE *file; ◦ char file_name[] = “file.txt”; ◦ if ((file = fopen(file_name, "w")) ==
Lecture 3: Getting Started & Input / Output (I/O)
IPC demo on AM57xx EVM.
A bit of C programming Lecture 3 Uli Raich.
Chapter 22 – part a Stream refer to any source of input or any destination for output. Many small programs, obtain all their input from one stream usually.
Basics of BLAST Basic BLAST Search - What is BLAST?
Command Line Arguments
Command line arguments
Command Line Arguments
Understand argc and argv
Structure of C Programs
CSE 303 Concepts and Tools for Software Development
CSE 351 Section 1: HW 0 + Intro to C
More Examples of argc and argv
Command-line Arguments
Command Line Arguments
C Stuff CS 2308.
CS 240 – Lecture 18 Command-line Arguments, Typedef, Union, Bit Fields, Pointers to Functions.
sscanf()- string scan function
Chien-Chung Shen CIS/UD
Command Line Parameters
File Handling.
Sequence Alignment Algorithms Morten Nielsen BioSys, DTU
Presentation transcript:

Command line parsing Morten Nielsen BioSys, DTU

Example. Blast command-line options blastpgp - blastpgp arguments: -d Database [String] default = nr -i Query File (not needed if restarting from scoremat) [File In] Optional default = stdin -A Multiple Hits window size [Integer] default = 40 -f Threshold for extending hits [Integer] default = 11 -e Expectation value (E) [Real] default = m alignment view options:....

How is command-line done in C? /* M.Nielsen July 2008, */ #include main( int argc, char *argv[] ) { printf( "Hello World\n" ); }

What are: int argc, char *argv[]? fasta_align_db -m BLOSUM50 -gf 5 -gn 1 1PLC._.fsa 1PLB._.fsa argv[0]argv[1] argv[3] argv[2] argv[4] argv[5] argv[7]argv[6]argv[8] fasta_align -m BLOSUM50 -gf 5 -gn 1 1PLC._.fsa 1PLB._.fsa Argc: Number of argument. Here 9 First argument is program name Argv:Parameter names argv[0] = fasta_align_db argv[1] = -m

Example (The parser! ) fasta_align -m BLOSUM62 1PLC._.fsa 1PLB._.fsa float p_gapf; float p_gapn; int p_minall; FILENAME p_blmat; int p_verbose; PARAM param[] = { "-gf", VFLOAT p_gapf, "penalty for first gap", "11", "-gn", VFLOAT p_gapn, "penalty for next gap", "1", "-mal", VINT p_minall, "Minimum alignment lenght", "3", "-m", VFNAME p_blmat, "Alignment matrix", "BLOSUM50", "-v", VSWITCH p_verbose, "Verbose mode", "0", 0 }; p_blmat = “BLOSUM50” p_gapf = 11 p_gapn = 1 p_minall = 3 p_verbose = 0

Example (The parser! ) fasta_align -m BLOSUM50 -gf 5 -gn 1 1PLC._.fsa 1PLB._.fsa float p_gapf; float p_gapn; int p_minall; FILENAME p_blmat; int p_verbose; PARAM param[] = { "-gf", VFLOAT p_gapf, "penalty for first gap", "11", "-gn", VFLOAT p_gapn, "penalty for next gap", "1", "-mal", VINT p_minall, "Minimum alignment lenght", "3", "-m", VFNAME p_blmat, "Alignment matrix", "BLOSUM50", "-v", VSWITCH p_verbose, "Verbose mode", "0", 0 }; p_blmat = “BLOSUM50” p_gapf = 5 p_gapn = 1 p_minall = 3 p_verbose = 0

Example (main(int argc, char *argv[]) ) fasta_align -m BLOSUM50 -gf 5 -gn 1 1PLC._.fsa 1PLB._.fsa argv[0]argv[1] argv[3] argv[2] argv[4] argv[5] argv[7]argv[6]argv[8] argc = 9 Before fasta_align 1PLC._.fsa 1PLB._.fsa argv[0]argv[1]argv[2] argc = 3 After - pparse(&argc, &argv, param, 2, "fsa1 fsa2");

Example (main(int argc, char *argv[]) ) q_fsa = fsalist_read( argv[1] ) ): db_fsa = fsalist_read( argv[2] ); fasta_align 1PLC._.fsa 1PLB._.fsa argv[0]argv[1]argv[2]