Lezione 11. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Similar documents
Lezione 6. Installing NumPy. Contents

Lezione 13. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Lezione 7. BioPython. Contents. BioPython Installing and exploration Tutorial First Course Project First Start First Start with Biopython

Contents. Lezione 3. Reference sources. Contents

Lezione 7. BioPython. Contents. BioPython Installing and exploration Tutorial. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Surfing Ada for ESP Part 2

Lezione 7. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Geometric Programming for Computer-Aided Design

Automatic Creation of Define.xml for ADaM

2D Object Definition (1/3)

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Programmi di utilità

SISTEMA ANTE EVO 2 DOOR SYSTEM EVO 2

Fondamenti di Informatica

LESSON SUMMARY. Properties of Shapes

Chapter 9 Formattazione Input/Output

Definizione dei costru'ori

SAFE DESIGNED IN ITALY CASSEFORTI PER HOTEL HOTEL SAFES

Universita degli Studi di Roma Tre. approach to extrusion, sweeping, oset and Minkowski sum. Alberto Paoluzzi. Universita di Roma Tre,

ME 111: Engineering Drawing. Geometric Constructions

Strategy. Using Strategy 1

SAFE. DESIGNED in italy CASSEFORTI PER HOTEL HOTEL SAFES

The base of a solid is the region in the first quadrant bounded above by the line y = 2, below by

Esempio con Google Play tore Example with Google Play tore

Multidimensional Data and Modelling

Spring 2011 Workshop ESSENTIALS OF 3D MODELING IN RHINOCEROS February 10 th 2011 S.R. Crown Hall Lower Core Computer Lab

Calculators ARE NOT Permitted On This Portion Of The Exam 28 Questions - 55 Minutes

Laboratorio di Sistemi Software Design Patterns 2

B.Stat / B.Math. Entrance Examination 2017

Properties of a Circle Diagram Source:

Solving Tridiagonal Systems on the T3E: a Message Passing RD algorithm.

Linux e Bash. Matteo Duranti. (cfr.

Mrs. Daniel s Geometry Vocab List

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

Supporting planning for shape, space and measures in Key Stage 4: objectives and key indicators

Rational Numbers: Graphing: The Coordinate Plane

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

acute angle An angle with a measure less than that of a right angle. Houghton Mifflin Co. 2 Grade 5 Unit 6

MATH 31A HOMEWORK 9 (DUE 12/6) PARTS (A) AND (B) SECTION 5.4. f(x) = x + 1 x 2 + 9, F (7) = 0

Cambridge IGCSE mapping

P1 REVISION EXERCISE: 1

2D transformations: An introduction to the maths behind computer graphics

Serie Sistema scorrevoleve regolabile o fisso per armadi con ante interne. Adjustable or fixed sliding system for wardrobes with internal doors

3D Modeler Tutorial. Topics: Tutorial: The 3D Modeler. Using the Keyboard. Go Back. Contents. Index. Tutorial: The 3D Modeler. Using the Keyboard

If ( ) is approximated by a left sum using three inscribed rectangles of equal width on the x-axis, then the approximation is

pine cone Ratio = 13:8 or 8:5

GESTIONE DEL BACKGROUND. Programmazione Web 1

Unit 3 Higher topic list

Birkdale High School - Higher Scheme of Work

Perspective Mappings. Contents

Digital Image Processing Fundamentals

Geometry. Geometry is the study of shapes and sizes. The next few pages will review some basic geometry facts. Enjoy the short lesson on geometry.

Istruzioni passo passo per creare qualsiasi CUSTOM AWARD con BBLogger How to create step by step any CUSTOM AWARD by BBLogger

Compound Data Types 2

Collision detection: strategies

An Introduction to CP

Linear Algebraic Representation of Big Geometric Data

Circumference of a Circle

Each trainee receives the official 260 page courseware as part of attending this course.

Graphics Design: TR-Design

TABELLA GLOBALE CODICI MARCHE / TABLEAU GÉNÉRAL DES CODES MARQUES / GLOBAL BRAND CODES TABLE

COMPUTER AIDED ARCHITECTURAL GRAPHICS FFD 201/Fall 2013 HAND OUT 1 : INTRODUCTION TO 3D

CS337 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics. Bin Sheng Representing Shape 9/20/16 1/15

3D Modeling Parametric Curves & Surfaces

UNIT 2 2D TRANSFORMATIONS

Math 7 Glossary Terms

PROPOSTE DI PROGETTI E TESI DI LAUREA

Curve and Surface Basics

Fabrizio Villa INAF / IASF Bologna

Algoritmi di Ottimizzazione: Parte A Aspetti generali e algoritmi classici

Solid Bodies and Disjointed bodies

Lesson 2 Constructive Solid Geometry Concept. Parametric Modeling with I-DEAS 2-1

Moore Catholic High School Math Department

SEVENTH EDITION and EXPANDED SEVENTH EDITION

Lecture 1 Discrete Geometric Structures

Mathematics 308 Geometry. Chapter 9. Drawing three dimensional objects

AQA GCSE Further Maths Topic Areas

CATIA V5 Parametric Surface Modeling

L-Systems and Affine Transformations

MWS3-3 - MOC NETWORKING WITH WINDOWS SERVER 2016

YEAR 10- Mathematics Term 1 plan

Differential Geometry: Circle Patterns (Part 1) [Discrete Conformal Mappinngs via Circle Patterns. Kharevych, Springborn and Schröder]

CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH Warm-Up: See Solved Homework questions. 2.2 Cartesian coordinate system

Analog Clock. High School Math Alignment. Level 2 CSTA Alignment. Description

ACT Math and Science - Problem Drill 11: Plane Geometry

Indiana State Math Contest Geometry

CSG obj. oper3. obj1 obj2 obj3. obj5. obj4

Geometry - Chapter 1 - Corrective #1

AP * Calculus Review. Area and Volume

VIRTUAL RECOMPOSITION AND ANALYSIS OF A SURVEYED MODEL OF THE WOODEN CRUCIFIX OF ST. PETER S BASILICA

Geometry Mathematics Content Standards

4) Finish the spline here. To complete the spline, double click the last point or select the spline tool again.

Log1 Contest Round 2 Theta Circles, Parabolas and Polygons. 4 points each

TI- Nspire Testing Instructions

Understand the concept of volume M.TE Build solids with unit cubes and state their volumes.

4 Mathematics Curriculum. Module Overview... i Topic A: Lines and Angles... 4.A.1. Topic B: Angle Measurement... 4.B.1

Physically-Based Modeling and Animation. University of Missouri at Columbia

Generating Vectors Overview

TOURNAMENT OF THE TOWNS, Glossary

Transcription:

Lezione 11 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza Introduzione in questa lezione calcoleremo la trasformazione di coordinate che deve essere applicata ad un componente di una struttura biologica per posizionarlo correttamente in una struttura più complessa L argomento è di carattere generale, e si può adattare a molti contesti differenti. Lo introdurremo per posizionare una coppia di basi all interno della doppia elica del DNA Per essere certi della correttezza delle operazioni effettuate, posizioneremo sui diametri dell elica delle stringhe di testo vettoriale che rappresentano i codici (a,t,g,c) delle basi coinvolte. La trasformazione così calcolata potrà essere applicata anche al modello molecolare relativo Nella lezione si introduce anche il linguaggio di programmazione geometrica PLaSM, sviluppato alla Sapienza e a Roma Tre, che stiamo portando in Python, e che utilizzeremo per le operazioni geometrico-grafiche

The new Plasm version ported to Python a component of BioPlasm use from trsxge import every PyPlasm primitive is UPPER-case (to distinguish it) every PyPlasm primitive has a single-argument very often a list most PyPlasm primitives are higher-level functions. EXAMPLE: F(arg 1 )(arg 2 )(arg 3 ) is the value in Dom 4 produced by the map where F : Dom 1 Dom 2 Dom 3 Dom 4 F returns a function Dom 1 (Dom 2 Dom 3 Dom 4 ) F(arg 1 ) returns a function Dom 2 (Dom 3 Dom 4 ) F(arg 1 )(arg 2 ) returns a function Dom 3 Dom 4 f (x) is the application of function f to argument x STRUCT returns a single geometric value from its list of arguments 1 def drawgraph (f): 2 domain = INTERVALS(2*PI)(64) 3 return MAP([ S1, COMP([f,S1]) ])(domain) 4 5 VIEW(drawgraph(SIN)) 6 VIEW(STRUCT([ drawgraph(sin), drawgraph(cos) ])) F(arg 1 )(arg 2 )(arg 3 ) returns an object in Dom 4 domain is translated of PI on the first coordinate 1 def drawgraph (f): 2 domain = T(1)(-PI)(INTERVALS(2*PI)(64)) 3 return MAP([ S1, COMP([f,S1]) ])(domain) 4 5 VIEW(STRUCT([ drawgraph(sin), drawgraph(cos) ]))

PyPlasm: (some) geometric primitives Some closed polylines (where p1 == pm ), and the solid polygon they are boundary of CUBOID n-dim rectangle: VIEW(CUBOID([1,4,9])) SIMPLEX n-dim simplex: VIEW(SIMPLEX(3)) QUOTE linspace generator: D = QUOTE(10 [0.1, 0.1]) PROD Cartesian product: VIEW(PROD([ D,D,D ])) MAP coordinate transformation: MAP([ f1,..., fd ])(dom) POLYLINE polygonal lines: POLYLINE([ p1,..., pm ]) TEXT Testi vettoriali 3D: VIEW(TEXT( PLaSM )) STRUCT Strutture grafiche: STRUCT([ obj1,..., objm ]) T,R,S,MAT affine transformations: T([i1,.., in ])([ti1,..., tin ])(obj) SOLIDIFY Boundary solid transform Boolean Ops INTERSECTION, DIFFERENCE, XOR, UNION 1 BOX Containment box: BOX(STRUCT([... ])) JOIN Convex-comb of point-sets VIEW(JOIN([SIMPLEX(3),Q(10)])) out = STRUCT( AA(POLYLINE)([ [[0,0],[4,2],[2.5,3],[4,5],[2,5],[0,3],[-3,3],[0,0]], [[0,3],[0,1],[2,2],[2,4],[0,3]], [[2,2],[1,3],[1,2],[2,2]] ])) 2 Example: VIEW(XOR([CIRCLE(1)([4,1]), CIRCLE(1)([3,1])])) 3 4 VIEW(out) VIEW(SOLIDIFY(out)) The Cartesian product of a 2D shape for a 1D interval in this case Q(1) produces a 3D shape 1 VIEW(PROD([ SOLIDIFY(out), Q(1) ]))

The code is adapted to fit the high-level geometric and graphics primitives of PyPlasm Riprendiamo il modello della doppia elica parametrizzata rispetto a raggio, passo e numero di giri, e lo modifichiamo leggermente per adattarlo all uso delle primitive Plasm l attuale implementazione plasm tratta l insieme dei vertici di un oggetto geometrico come una lista di liste (di coordinate), e non come un array a due indici di coordinate, come fatto in precedenza eviteremo dunque di effettuare continue trasformazioni di tipo, riferendoci ovunque possibile alla lista di liste di numeri (le coordinate dei vertici) 1 from numpy import * 2 from trsxge import * 3 4 def helixpoints(radius,pitch,nturns): 5 c = linspace(0,2*pi*nturns,12*nturns) 6 return map(list, zip( cos(c),sin(c), c*(pitch/(2*pi) ) )) 7 8 9 def helix(radius,pitch,nturns): 10 return POLYLINE(helixPoints(radius,pitch,nturns)) 11 12 13 VIEW(helix(1,1.5,6)) Note: (a) helixpoints returns a list of list ; (b) POLYLINE is UPPER-case The code is adapted to fit the high-level geometric and graphics primitives of PyPlasm doublehelix returns a STRUCT of 2 p instances The code is adapted to fit the high-level geometric and graphics primitives of PyPlasm 1 def doublehelix(radius,pitch,nturns): 2 p = POLYLINE(helixPoints(radius,pitch,nturns)) 3 return STRUCT([p,R([1,2])(PI)(p)]) 4 5 6 VIEW(doubleHelix(1,2,4)) 1 def dnastructure(radius,pitch,nturns): 2 p = helixpoints(radius,pitch,nturns) 3 q = (matrix(p) * matrix([[-1,0,0], [0,-1,0], [0,0,1]])).tolist() 4 diameters = TRANS([p,q]) 5 return STRUCT( AA(POLYLINE)(diameters) + [POLYLINE(p ), POLYLINE(q)] ) 6 7 VIEW(dnaStructure(1,2,4)) The second p instance is rotated of π around the z-axis The rotation tensor R([1,2])(PI) is a higher-level function (is appled more than one time to different arguments; every application returns a function) AA (second-order function) stands for Apply to All: AA(f) ([ x 1, x 2,..., x m ]) [f(x 1 ), f(x 2 ),..., f (x m )] It has the same semantics of the Python s map( f, [x 1, x 2,..., x m ])

We know that two nucleotides on opposite complementary DNA or RNA strands that are connected via hydrogen bonds are called a base pair So, let define a set of allowed pairs basepairs =[[ a, t ],[ t, a ],[ g, c ],[ c, g ]] We write a simple filtre to produce the sequence of base pairs associated to a DNA strand 1 strand = atgaaaatgaataaaagtctcatcgtcc 2 3 def doublestrand (strand): 4 bases = [ t, a, g, c ] 5 basepairs =[[ a, t ],[ t, a ],[ g, c ],[ c, g ]] 6 return [[a,b] for a in strand for b in bases if [a,b ] in basepairs] 7 8 doublestrand(strand) 9 [[ a, t ],[ t, a ],[ g, c ],[ a, t ],[ a, t ],[ a, t ],[ a, t ],[ t, a ],[ g, c ],[ a, t ],[ a, t ],[ t, a ],[ a, t ],[ a, t ],[ a, t ],[ a, t ],[ g, c ],[ t, a ],[ c, g ],[ t, a ],[ c, g ],[ a, t ],[ t, a ],[ c, g ],[ g, c ],[ t, a ],[ c, g ],[ c, g ]] REMARK: We use a List Comprehension construct, with a doubly-nested cycle to select the only allowed base pairs

A vector text string is generated in the z = 0 plane A vector-text string is generated in the z = 0 plane. The native dimensions of caracters of the vector font are pretty big 1 def TEXT:... return hpc 2 VIEW(TEXT( AT )) 3 4 def TEXTWITHATTRIBUTES (TEXTALIGNMENT, TEXTANGLE, TEXTWIDTH, TEXTHEIGHT, TEXTSPACING): 5... return hpc 6 7 VIEW(TEXTWITHATTRIBUTES( centre,0,0.5,1.0,0.125)( AT )) 8 VIEW(R([2,3])(PI/2)(TEXTWITHATTRIBUTES( centre,0,0.5, 1.0,0.125)( AT ))) In (8) the resulting geometric object is rotated in the y = 0 plane via the rotation tensor R ([2,3]) (PI/2) VIEW(TEXT( AT )) A vector-text string is generated in the z = 0 plane and rotated in the y = 0 plane The function return the text string transformed and translated in its proper 3D space position In particular, we compute the affine transformation from the standard position seen above, to the proper space position of each base pair input data: p 1, q 1 strand 1, p 2 strand 2 Steps: linear transformation followed translation TRANSF to bring e 1 to r 1, e 2 to r 2, and e 3 to r 3, where e 1, e 2, e 3 are the standard basis of E 3, and r 1 = p 2 p 1, r 2 = q 1 p 1, r 3 = r 1 r 2 R ([2,3]) (PI/2) (TEXTWITHATTRIBUTES( centre,0.0,0.5,1.0,0.125)( AT )) TRANSL to bring the origin to point p m =(p 1 + p 2 )/2 of diameter

The function return the text string transformed and translated in its proper 3D space position The function return the text string scaled, rotated and translated in its proper 3D space position clearly we must have Q e 1 e 2 e 3 = r1 r 2 r 3 so that, in homogeneous coordinates, we have: 1 0 0 0 Q =. 0 r 1 r 2 r 3 If we include the translation, the desired transformation becomes: 1 0 0 0 Q =, p m r 1 r 2 r 3 where p m =(p 1 + p 2 )/2. 1 def basepair (args): 2 """ p1,p2,q1 are 3D points, pair a two-letter string 3 returns a geometric value """ 4 p1,p2,q1,pair = args 5 pm = SCALARVECTPROD([ SUM([p1,p2]), 0.5 ]) 6 t = T([1,2,3])(pm) 7 q2 = UNITVECT(DIFF([p1,pm])) 8 q3 = [q2[1], -q2[0], 0] 9 w = [0,0,1] 10 sizex, sizez = VECTNORM(q2)/4, VECTNORM(q3)/2, 11 obj = TEXTWITHATTRIBUTES( centre,0.0,sizex, 12 sizez,sizex/16)(.join([,pair[0],, pair[1], ])) 13 return (t(mat(inv(mathom([q2,w,q3])))(obj))) Here we give yet another version of the dnastruct function, where the number of turns of each helix is determined by the length of the DNA strand, and where each basepair symbol is properly located in 3D space In the following dnastruct(radius,pitch )(strand) implementation, we introduce some variations w.r.t. the previous version: n = len(strand) is the number of basepairs in the input strand basepairs is the list of pairs of strings to be transformed into vector text map(basepair, zip(p[: 1],q[: 1],p [1:], basepairs)) apply the proper string text transformation to each tuple of properly aligned points and symbols from the two helices p and q and from the basepairs list of symbols

We give here a function of second order, that must by first applied to the 2 intrinsic scaling factors of the structure (radius, pitch), and then to the DNA strand to be modeled, given as a string. From the programming viewpoint, notice how a higher-level function is structured: is returns either partial functions or the final value 1 def dnastruct(radius,pitch): 2 3 def dna (strand): 4 n = len(strand) 5 p = helixpoints(radius,pitch,n/12) 6 q = (matrix(p) * matrix([[-1,0,0], [0,-1,0], [0,0,1]])).tolist() 7 basepairs = doublestrand(strand) 8 basepairs3d = map(basepair, zip(p[:-1],q[:-1],p [1:],basepairs)) 9 return STRUCT(basepairs3D + [POLYLINE(p), POLYLINE(q)]) 10 11 return dna 12 13 VIEW(dnaStruct(1,4)(strand)) 1 strand = acagtaacacactctgttaacctt 2 3 doublestrand(strand) = 4 [[ a, t ], [ c, g ], [ a, t ], [ g, c ], [ t, a ], [ a, t ], [ a, t ], [ c, g ], [ a, t ], [ c, g ], [ a, t ], [ c, g ], [ t, a ], [ c, g ], [ t, a ], [ g, c ], [ t, a ], [ t, a ], [ a, t ], [ a, t ], [ c, g ], [ c, g ], [ t, a ], [ t, a ]] 5 6 VIEW(dnaStruct(1,4)(strand))