1 Drawing phylogenies We've seen several tree data structures but we still can't draw a tree  In today's first exercise we write a drawtree module for.

Slides:



Advertisements
Similar presentations
Directory and File Paths Copyright © Software Carpentry and The University of Edinburgh This work is licensed under the Creative Commons Attribution.
Advertisements

File System Interface CSCI 444/544 Operating Systems Fall 2008.
1 A note on the import statement >>> import mymodule mymodule evaluated >>> from mymodule import three_columns mymodule evaluated >>> print three_columns(
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
1 A note on the import statement >>> import mymodule mymodule evaluated >>> from mymodule import three_columns mymodule evaluated >>> print three_columns(
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
April 20, 2004ECS 235Slide #1 DG/UX System Provides mandatory access controls –MAC label identifies security level –Default labels, but can define others.
1 Drawing phylogenies We've seen several tree data structures but we still can't draw a tree  In the tree drawing exercise we write a drawtree function.
1 Extensible Markup Language: XML HTML: widely supported protocol for formatting data XML: widely supported protocol for describing data XML is quickly.
Chapter 5 Accessing Files and Directories. How Directories Get Created OS installation: usr, dev, etc, export, kernel and others places to store installation.
File Management System The way a user or application may access files Programmer does not need to develop file management software You take files for granted.
Building Suffix Trees in O(m) time Weiner had first linear time algorithm in 1973 McCreight developed a more space efficient algorithm in 1976 Ukkonen.
UNIX Files and Security Software Tools. Slide 2 File Systems l What is a file system? A means of organizing information on the computer. A file system.
Computer Science 210 Computer Organization Modular Decomposition Making a Library Separate Compilation.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Zach Moshe Rotem Naar.  File upload vulnerabilities overview  FUV – detailed overview  Live demonstration  In the future…
Python Mini-Course University of Oklahoma Department of Psychology Lesson 17 Reading and Writing Files 5/10/09 Python Mini-Course: Lesson 17 1.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Syntax Directed Translation. Syntax directed translation Yacc can do a simple kind of syntax directed translation from an input sentence to C code We.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
Chapter 14 Files and Exceptions II. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. What we already.
Silberschatz, Galvin and Gagne  Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
Files. What are files? A series of data bits. a place for output a place to obtain input.
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
1 Using Modules. 2 Modules A Perl module is a collection of subroutines and variables that typically implements some common functionality – and "packaged"
The Command Line Mostly MS Dos with some UNIX/LINUX Copyright © Curt Hill.
CIS 451: XML DTDs Dr. Ralph D. Westfall February, 2009.
Tree (new ADT) Terminology:  A tree is a collection of elements (nodes)  Each node may have 0 or more successors (called children)  How many does a.
# 1 CMPS 450 Syntax-Directed Translations CMPS 450 J. Moloney.
Javadoc Dwight Deugo Nesa Matic
Storing and Retrieving Data
Linux File system Implementations
PC204 Lecture 5 Conrad Huang Genentech Hall, N453A
CS2021 Python Programming Week 3 Systems Programming PP-Part II.
Lecture Topics: 11/29 File System Interface –Files and Directories –Access Methods –Protection –Consistency.
File Paths *referenced from
Lesson 6-Using Utilities to Accomplish Complex Tasks.
Lecture 14 Page 1 CS 111 Online File Systems: Naming, Reliability, and Advanced Issues CS 111 On-Line MS Program Operating Systems Peter Reiher.
18-1 Chapter 18 Binary Trees Data Structures and Design in Java © Rick Mercer.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Today… Strings: –String Methods Demo. Raising Exceptions. os Module Winter 2016CISC101 - Prof. McLeod1.
Python: File Directories What is a directory? A hierarchical file system that contains folders and files. Directory (root folder) Sub-directory (folder.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 this week – last section on Friday. Assignment 4 is posted. Data mining: –Designing functions.
XML & JSON. Background XML and JSON are to standard, textual data formats for representing arbitrary data – XML stands for “eXtensible Markup Language”
Topic 2: binary Trees COMP2003J: Data Structures and Algorithms 2
Parsing 2 of 4: Scanner and Parsing
Intro to Python Programming – Part III
Data Structures and Design in Java © Rick Mercer
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Computer Science 210 Computer Organization
Intro to Python Programming – Part II
Module 10: File-System Interface
Fundamentals of Programming I Design with Functions
OS The os module allows interaction with the Operating System, either generically or specific to a particular OS.
Computer Science 210 Computer Organization
Creating and Modifying Text part 2
Find in a linked list? first last 7  4  3  8 NULL
Computer Science 210 Computer Organization
Winter 2018 CISC101 12/5/2018 CISC101 Reminders
Chapter 10: File-System Interface
DG/UX System Provides mandatory access controls Initially
CISC101 Reminders Assn 3 sample solution is posted.
Bryan Burlingame 17 April 2019
Module 10: File-System Interface
Browsing Directories Using walk
Tree (new ADT) Terminology: A tree is a collection of elements (nodes)
Presentation transcript:

1 Drawing phylogenies We've seen several tree data structures but we still can't draw a tree  In today's first exercise we write a drawtree module for the Phylogeny class:

2 Drawing other trees Can we reuse this phylogeny drawtree method with other trees? drawtree needs to know child nodes and name of node No problem: A node in any tree has some sons (or none) and a name. Phylogeny-specifics for drawtree : uses method get_sons (returns list of child nodes) used method get_name (returns string) Problem: Corresponding methods in other trees may have different names

3 Can't use drawtree directly We want: General tree drawing tool that can draw any tree if given a converter object: an "interpreter" which knows what methods to call for the given kind of node instead of get_sons get_name For each tree data structure we need to write a converter Need to modify drawtree slightly to use a converter

4 A converter class for tree data structure X Should have two methods, each taking an X node as argument: – one for returning a list of the node's sons – one for returning the name of the node

5 New version of drawtree module All functions that take a node some_node as argument should also take a converter object converter All occurrences of some_node.get_name() and some_node.get_sons() are replaced with converter.get_name( some_node ) and converter.get_sons( some_node )

6 Example: converter for XML DOM trees - pretty simple, huh? Recall: a DOM tree consists of nodes representing tags in the XML data

7 Drawing XML DOM trees Import modified drawtree module Parse the XML file, obtain DOM tree Please draw this tree, here is how (neat!)

8 Drawing article2.xml

9 And now for something completely different os module: Interface to operating system functionality os.linesep The string used to separate (or, rather, terminate) lines on the current platform. This may be a single character, such as '\n' for Unix or '\r' for Mac OS, or multiple characters, for example, '\r\n' for Windows. os.getcwd() Returns a string representing the current directory os.mkdir( path ) Creates a directory with the given name os.listdir( path ) Returns a list of all entries in the given directory path

10 os.path module: functions on pathnames os.path.split( path ) Split the pathname path into a pair, (head, tail) where tail is the part after the last / and head is everything leading up to that. os.path.basename( path ), os.path.dirname( path ) Returns the head and tail of path, respectively. os.path.splitext( path ) Split the path into a pair (root, ext) such that root + ext == path, and ext is the extension. os.path.exists( path ) Returns true if the given file or directory exists, false otherwise. os.path.join( path1[, path2[,...]] ) Joins the paths to form a new path in valid format. E.g. os.path.join( "/users/chili/PBI", "plan.html" )

11 os.walk( top ) walk() generates the file names in a directory tree, by walking the tree either top down or bottom up. For each directory in the tree rooted at directory top (including top itself), it yields a 3-tuple (dirpath, dirnames, filenames). dirpath is a string, the path to the directory. dirnames is a list of the names of the subdirectories in dirpath (excluding '.' and '..'). filenames is a list of the names of the non-directory files in dirpath. os.walk - recursively traverse directory Programs_from_ book symbolic link not included

12 Calculate size of all files in PBI directories dirwalk.py No path info in dirs and files lists; join with root Traversal is top-down by default: OK to remove a directory from the dirs list to avoid visiting it

13 /users/chili/PBI/ consumes bytes in 45 non-directory files /users/chili/PBI/Exercises consumes bytes in 148 non- directory files /users/chili/PBI/Exercises/Solutions consumes bytes in 109 non-directory files /users/chili/PBI/Slides consumes bytes in 22 non-directory files /users/chili/PBI/Slides/Images consumes bytes in 70 non- directory files /users/chili/PBI/Mail consumes 6625 bytes in 7 non-directory files /users/chili/PBI/NoAccess consumes 0 bytes in 0 non-directory files /users/chili/PBI/ExamplePrograms consumes bytes in 160 non- directory files Note: Project not visited

14 Now that we have a drawtree function.. dirdraw.py

15 Tadaa! +---Solutions Exercises+ | Project | Slides Images ---PBI Mail | NoAccess | +---ExamplePrograms