Supplementary Material

Similar documents
CMSC 330: Organization of Programming Languages. Pushdown Automata Parsing

Comparing whole genomes

ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University

CA Compiler Construction

Tasks of lexer. CISC 5920: Compiler Construction Chapter 2 Lexical Analysis. Tokens and lexemes. Buffering

Administering your Enterprise Geodatabase using Python. Jill Penney

Reaxys Pipeline Pilot Components Installation and User Guide

ChemmineR: A Compound Mining Toolkit for Chemical Genomics in R

ST-Links. SpatialKit. Version 3.0.x. For ArcMap. ArcMap Extension for Directly Connecting to Spatial Databases. ST-Links Corporation.

ICM-Chemist How-To Guide. Version 3.6-1g Last Updated 12/01/2009

Algebraic Dynamic Programming

Compiling Techniques

Lineage implementation in PostgreSQL

Geodatabase Programming with Python John Yaist

Geodatabase Programming with Python

Databases 2011 The Relational Algebra

MiniMat: Matrix Language in OCaml LLVM

Notater: INF3331. Veronika Heimsbakk December 4, Introduction 3

THEORY OF COMPILATION

Sequence comparison by compression

Synteny Portal Documentation

On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work

CFLs and Regular Languages. CFLs and Regular Languages. CFLs and Regular Languages. Will show that all Regular Languages are CFLs. Union.

Lexical Analysis. Reinhard Wilhelm, Sebastian Hack, Mooly Sagiv Saarland University, Tel Aviv University.

Abstract parsing: static analysis of dynamically generated string output using LR-parsing technology

SUPPLEMENTARY INFORMATION

Lecture 11 Context-Free Languages

Relational Algebra and Calculus

Lexical Analysis Part II: Constructing a Scanner from Regular Expressions

Introduction to ANTLR (ANother Tool for Language Recognition)

Presenting Tree Inventory. Tomislav Sapic GIS Technologist Faculty of Natural Resources Management Lakehead University

INTRODUCTION. This is not a full c-programming course. It is not even a full 'Java to c' programming course.

Exam 1. March 12th, CS525 - Midterm Exam Solutions

LAST TIME..THE COMMAND LINE

Import Digital Spatial Data into OneStop

Bottom-Up Syntax Analysis

Mass Asset Additions. Overview. Effective mm/dd/yy Page 1 of 47 Rev 1. Copyright Oracle, All rights reserved.

CONTEXT FREE GRAMMAR AND

Accountability. User Guide

Analyst Software. Peptide and Protein Quantitation Tutorial

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007

MERGING (MERGE / MOSAIC) GEOSPATIAL DATA

A Browser for Pig Genome Data

Scripting Languages Fast development, extensible programs

Computer Science 160 Translation of Programming Languages

Ligand Scout Tutorials

Assignment 4: Object creation

Compiling Techniques

Geodatabase Best Practices. Dave Crawford Erik Hoel

COMP 120. For any doubts in the following, contact Agam, Room. 023

Practical Data Processing With Haskell

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

Lexical Analysis: DFA Minimization & Wrap Up

ncounter PlexSet Data Analysis Guidelines

APPEND AND MERGE. Colorado average snowfall amounts - Aggregated by County and Month

The File Geodatabase API. Dave Sousa, Lance Shipman

DARN: A Matrix Manipulation Language

High Density Area Boundary Delineation

Advanced Implementations of Tables: Balanced Search Trees and Hashing

SuperCELL Data Programmer and ACTiSys IR Programmer User s Guide

Introduction to Theoretical Computer Science. Motivation. Automata = abstract computing devices

Crossover Techniques in GAs

Bottom-Up Parsing. Ÿ rm E + F *idÿ rm E +id*idÿ rm T +id*id. Ÿ rm F +id*id Ÿ rm id + id * id

CityGML XFM Application Template Documentation. Bentley Map V8i (SELECTseries 2)

CS415 Compilers Syntax Analysis Top-down Parsing

Package clonotyper. October 11, 2018

EEOS 381 -Spatial Databases and GIS Applications

BCMB/CHEM 8190 Lab Exercise Using Maple for NMR Data Processing and Pulse Sequence Design March 2012

Lecture 5: Web Searching using the SVD

Moving into the information age: From records to Google Earth

Compiler Design Spring 2017

Syntax Directed Transla1on

Designing 1-tape Deterministic Turing Machines

An Introduction to MAGMA

The Pip Project. PLT (W4115) Fall Frank Wallingford

Inferring Phylogenetic Trees. Distance Approaches. Representing distances. in rooted and unrooted trees. The distance approach to phylogenies

Grammar formalisms Tree Adjoining Grammar: Formal Properties, Parsing. Part I. Formal Properties of TAG. Outline: Formal Properties of TAG

13 Searching the Web with the SVD

9 Searching the Internet with the SVD

Computer Architecture

Auto-Tuning Complex Array Layouts for GPUs - Supplemental Material

Dictionary Matching in Elastic-Degenerate Texts with Applications in Searching VCF Files On-line

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

Introduction to Kleene Algebras

Transformation of round-trip web application to use AJAX

Enumeration and generation of all constitutional alkane isomers of methane to icosane using recursive generation and a modified Morgan s algorithm

Parsing Algorithms. CS 4447/CS Stephen Watt University of Western Ontario

Hidden Markov Methods. Algorithms and Implementation

DOCUMENT HISTORY. Initials Section/s Modified Brief Description of Modifications

Quiz 2. Due November 26th, CS525 - Advanced Database Organization Solutions

GIS CONCEPTS ARCGIS METHODS AND. 2 nd Edition, July David M. Theobald, Ph.D. Natural Resource Ecology Laboratory Colorado State University

Deterministic Finite Automaton (DFA)

E X P L O R E R. R e l e a s e A Program for Common Factor Analysis and Related Models for Data Analysis

Tryton Technical Training

Reporting from DIMA Preparing for Data Analysis

(NB. Pages are intended for those who need repeated study in formal languages) Length of a string. Formal languages. Substrings: Prefix, suffix.

Plan for Today and Beginning Next week (Lexical Analysis)

Sapienza universita di Roma Dipartimento di Informatica e Sistemistica. User guide WSCE-Lite Web Service Composition Engine v 0.1.

Module 1: Analyzing the Efficiency of Algorithms

Package intansv. October 14, 2018

Transcription:

Supplementary Material Contents 1 Keywords of GQL 2 2 The GQL grammar 3 3 THE GQL user guide 4 3.1 The environment........................................... 4 3.2 GQL projects............................................. 5 3.3 Text tables.............................................. 5 3.4 Reads Table.............................................. 5 3.5 program structure........................................... 6 4 GQL source codes from the experiments of the Results Section 9 5 Supplemental Figures 16 1

1 Keywords of GQL Here is the list of keywords of GQL. Note that the keywords are also recognized when a user enters them with upper case characters. both mates include print genome select from mapjoin where table and or not integer float char string using interval creation create intervals merge intervals intervals 2

2 The GQL grammar program table prototypes genome names assigned selects print statements table prototypes table prototype table prototypes ɛ table prototype table keyword ( table args ) ; table keyword table names names ID numbers digit numbers digit digit 0 1 2 3 4 5 6 7 8 9 table args table args, table arg table arg table arg integer names float names char names string names genome names genome names genome names genome names ; genome names * ; genome * where where args ; assigned selects assigned select assigned selects ɛ assigned select lvalue = select statement lvalue names select statement select select args from compound from arg where where args select select intrvl args from compound from arg select select args from mapjoin from args select intrvl args create intervals ( ) merge intervals ( names > numbers ) merge intervals ( names < numbers ) select args * select arg series select arg series names, select arg series names obj names 3

from args compound from arg, from args compound from arg compound from arg from arg from arg using intervals ( arith expr, arith expr ) from arg using intervals ( arith expr, arith expr, both mates ) from arg names where args where args, where args where args and where args where args or where args not where args ( where args ) lowest expr lowest expr arith expr comparison op arith expr arith expr arith expr arith op arith expr arith op arith expr names ( arith expr ) names obj names numbers const string const char obj names names. names comparison op == >= <= < arith op + - * / % print statements print statement print statements ɛ print statement print names print names both mates 3 THE GQL user guide 3.1 The environment The installation of GQL requires that the following variables are set. 4

1. SAMLOC should point to the installation directory of samtools 2. DONOR DIR should point to the parent directory of donor genomes. 3. BIOSQL HOME should point to the installation directory of GQL 4. PATH should contain SAMLOC. 3.2 GQL projects GQL organizes experiments into projects. All donors that participate in a project are assumed to have been aligned against the same reference and their chromosome naming follows the same conventions. When a user creates a project with name P, src tables dir S and destination directory d, they need to move all donors of the project under under $DONOR DIR/P, all text tables under S/P and all products of the queries that use this project will be found under d/p. 3.3 Text tables Text tables are tab delimited text files that should be placed under S/P for project P with src tables S. A table with name T should have a file name T.txt. The first line of a Text table file should always contain the following content: #table T (type var1, type var2...); where T is the table name, type should be any of {integer, string, char, float} and var should be any string of characters. Note that at least a field is expected to contain chromosome information. ATTENTION for proper functionality, the table name of the first line should match the file name without the.txt suffix. The rest lines of a text table file can be either comment lines that begin with # or data. 3.4 Reads Table The Reads table is embedded for every genome and in the current prototype a user can access the following fields. integer location the mapping coordinate of the read integer length the read length char strand the mapping strand integer mate loc the mapping location of the other end 5

mate strand the mapping strand of the other end. Note that the user does not have access to the chromosome field because a query runs over all chromosomes iteratively. 3.5 program structure. Each GQL program consists of 4 distinct parts: 1. The include line 2. The donor selection lines 3. A set of select statement assignments 4. A set of print statements. The include line. Currently the first line of each program should be include <tables.txt> which loads the table definitions. Donor selection. The user selects on which genomes the query should run on. The choice can either be explicit, e.g genome NA18507, NA18506; or it can be an expression that contains a wild-card, such as: genome NA185*; or an SQL like statement such as genome * where sex== male and population== YRI. Note that for the latter to be functional a user needs to upload a text table with name genome info that should contain an entry for each donor genome with fields that depend on the information that is available for each donor. The only restriction is that the field that corresponds to a donor name should be labeled as name. Select statement assignments. Each statement should be of the form variable = select statement. After the execution of a select statement that left variable is a table of the same type as the return of the select statement and it can be used as input in subsequent statements. There are four types of possible select statements. A selection statement of the form: select * from Input-table where where expr where Input-table can be any table within the scope of the query and where expr can be any boolean function of the attributes of Input-table. The statement returns a table of the same type and the same arguments as the Input-table. 6

An interval creation of the form: select create intervals() from Input-table using intervals (expr1, expr2,[both mates]). This returns a table of Intervals with attributes begin, end, chromosome that is created on Input-table. expr1 and expr2 can be integer expressions on any field of Input-table and they specify the begin and end fields respectively. If Input-table is of type Reads a user can add the both mates flag which specifies that both ends of a pair end participate in each interval. An interval merging of the form: select merge intervals(interval count constant) from Input-table. The input has to be of type Intervals and the output is also of type Intervals. A mapjoin operation of the form: select * from mapjoin Input-tableA using intervals(expr1, expr2, [both mates]), Input-tableB using intervals(expr3, expr4, [both mates]). Both input tables can be of any type and the resulting table contains the attributes of Input-tableA followed by attributes of Input-tableB. In case there are naming conflicts we append suffix 1 to the resulting entry that originates from table A and suffix 2 to the resulting table from table B. Print Statement A print statement consists of the keyword print followed by a table name. If the table name is of type Reads it can be followed by the both mates keyword to let GQL know that reads need to be printed as pair ends. Below we summarize the output of GQL depending on the type of table. Reads. The output consists of a.bam file that contains all reads that a table contains, a.bam.short file that is a text file that contains only the starting, ending mapping coordinate and the orientation of each read, a.hist file which is used by our GUI to plot histogram related information and a.bam.links.txt which displays the correspondence of the current output with the initial bam file. The latter contains pairs of integers where the first integer corresponds to the location of a read in the output bam file and the other integer corresponds to the location of the same read in the original bam file. In case keyword both mates is present the output.bam.short file is organized such that a line contains the starting and ending mapping coordinates of both reads. Intervals. The output contains a.interval text file where each row represents an interval. It also contains a.interval.links.txt file with the same functionality as in Reads. 7

Text table. The output contains a.txt file which is a subset of the initial input and a.links.txt which connects the output entries with the original ones of the source. Joined table, which is any table that has been the result of one or more mapjoin operations. The output products consist of individual entrees of tables of the above basic types and also a.links.txt file which shows what entries of the leftmost entry of the mapjoin pairs with the rightmost ones. 8

4 GQL source codes from the experiments of the Results Section Algorithm 1 The deletion query. include <t a b l e s. txt> genome NA18506 ; Discordant=select from READS where l o c a t i o n >=0 and mate loc >=0 and ( ( mate loc+length l o c a t i o n >350 and mate loc+length l o c a t i o n <100000) or ( l o c a t i o n+length mate loc >350 and l o c a t i o n+length mate loc <100000) ) D i s c 2 I n t r v l=select c r e a t e i n t e r v a l s ( ) from Discordant using i n t e r v a l s ( l o c a t i o n, mate loc, both mates ) P r e d i c t e d d e l e t i o n s=select D i s c 2 I n t r v l m e r g e i n t e r v a l s ( i n t e r v a l c o u n t > 4) from out=select from MAPJOIN P r e d i c t e d d e l e t i o n s, Discordant using i n t e r v a l s ( l o c a t i o n, mate loc, both mates ) p r i n t out 9

Algorithm 2 Comparison with Conrad s findings. We manually uploaded file conrad only.txt which contains Conrad s deletions that are not reproduced in our queries. The query outputs the concordant and discordant reads of NA18506 that overlap with those regions. include <t a b l e s. txt> genome NA18506 ; genome NA18507 ; genome NA18508 ; Discordant=select from READS where l o c a t i o n >=0 and mate loc >=0 and ( ( mate loc+length l o c a t i o n >350 and mate loc+length l o c a t i o n <100000) or ( l o c a t i o n+length mate loc >350 and l o c a t i o n+length mate loc <100000) ) Concordant=s e l e c t from READS where l o c a t i o n >=0 and mate loc >=0 and ( ( mate loc+length l o c a t i o n >270 and mate loc+length l o c a t i o n <350) or ( l o c a t i o n+length mate loc >270 and l o c a t i o n+length mate loc <350) ) c o n r o n l y i n t r v l s=select c r e a t e i n t e r v a l s ( ) from conrad only using i n t e r v a l s ( begin, end ) o u t d i s c=select from mapjoin c o n r o n l y i n t r v l s, Discordant using i n t e r v a l s ( l o c a t i o n, mate loc, both mates ) out conc=select from mapjoin c o n r o n l y i n t r v l s, Concordant using i n t e r v a l s ( l o c a t i o n, mate loc, both mates ) p r i n t p r i n t o u t d i s c out conc 10

Algorithm 3 CNV detection. The query looks for regions of the genome that are covered by at least 200 reads. It also returns the reads that overlap with those regions. include <t a b l e s. txt> genome NA18506 ; Mapped reads=select from READS where l o c a t i o n >=0 Mapped2Intrvl=select c r e a t e i n t e r v a l s ( ) from Mapped reads using i n t e r v a l s ( l o c a t i o n, l o c a t i o n+l e n g t h ) highcnv regions=select Mapped2Intrvl m e r g e i n t e r v a l s ( i n t e r v a l c o u n t > 200) from out=select from MAPJOIN highcnv regions, Mapped reads using i n t e r v a l s ( l o c a t i o n, l o c a t i o n+l e n g t h ) p r i n t out 11

Algorithm 4 Inversion detection. The query looks for regions of the genome that are covered by at least 5 pairs of reads of the same orientation. include <t a b l e s. txt> genome NA18506 ; Discordant=select from READS where l o c a t i o n >0 and mate loc >=0 and strand==mate strand and ( ( l o c a t i o n > mate loc and ( l o c a t i o n mate loc > 300 and l o c a t i o n mate loc < 100000) ) or ( l o c a t i o n < mate loc and ( mate loc l o c a t i o n > 300 and mate loc l o c a t i o n < 100000) ) ) D i s c 2 I n t r v l=select c r e a t e i n t e r v a l s ( ) from Discordant using i n t e r v a l s ( l o c a t i o n, l o c a t i o n+l e n g t h ) P r e d i c t e d i n v e r s i o n s=select D i s c 2 I n t r v l m e r g e i n t e r v a l s ( i n t e r v a l c o u n t > 4) from out=select from MAPJOIN P r e d i c t e d i n v e r s i o n s, Discordant using i n t e r v a l s ( l o c a t i o n, l o c a t i o n+length, both mates ) p r i n t out 12

Algorithm 5 Gene overlapping. The query makes use of table genes.txt which contains all known genes. We apply the mapjoin operation on mapped reads and on the gene coordinates. include <t a b l e s. txt> genome NA18506 ; Mapped reads=select from READS where l o c a t i o n >=0 g e n e i n t r v l s=select c r e a t e i n t e r v a l s ( ) from genes using i n t e r v a l s ( begin, end ) out=select from mapjoin Mapped reads using i n t e r v a l s ( l o c a t i o n, l o c a t i o n+ length ), g e n e i n t r v l s using i n t e r v a l s ( begin, end ) p r i n t out 13

Algorithm 6 Common deletions in YRI population. The query makes use of text table kidd hg19 which contains all deleted regions of NA18507 that are reported in [1] after the coordinate adjustment to hg19 using the UCSC genome browser. For every genome we apply a mapjoin operation on its predicted deletions and the contents of kidd hg19. We also retrieve all discordant reads that cover any of Kidd s deletions by applying mapjoin between the Discordant table and the regions of kidd hg19. include <t a b l e s. txt> genome NA ; Discordant=select from READS where l o c a t i o n >=0 and mate loc >=0 and ( ( mate loc+length l o c a t i o n >250 and mate loc+length l o c a t i o n <100000) or ( l o c a t i o n+length mate loc >250 and l o c a t i o n+ length mate loc <100000) ) D i s c 2 I n t r v l=select c r e a t e i n t e r v a l s ( ) from Discordant using i n t e r v a l s ( l o c a t i o n, mate loc, both mates ) P r e d i c t e d d e l e t i o n s=select D i s c 2 I n t r v l m e r g e i n t e r v a l s ( i n t e r v a l c o u n t > 4) from r e f r e s u l t s=select c r e a t e i n t e r v a l s ( ) from kidd hg19 using i n t e r v a l s ( begin, end ) out=select from MAPJOIN r e f r e s u l t s, P r e d i c t e d d e l e t i o n s o u t d i s c o n r e f=select from MAPJOIN Discordant using i n t e r v a l s ( l o c a t i o n, mate loc, both mates ), r e f r e s u l t s p r i n t p r i n t out o u t d i s c o n r e f 14

Algorithm 7 Collecting the required evidence for Breakdancer. This query prints the discordant reads that are necessary for Breakdancer [2] to call deletions, inversions, insertions and intrachromosomal translocations. include <t a b l e s. txt> genome NA18506 ; out=select from READS where l o c a t i o n >=0 and mate loc >=0 and ( ( mate loc + l e n g t h l o c a t i o n >350) or ( mate loc l e n g t h l o c a t i o n < 350) or #i n s e r t i o n ( ( mate loc > l o c a t i o n ) and ( mate loc + length l o c a t i o n < 270) ) or ( ( mate loc < l o c a t i o n ) and ( mate loc length l o c a t i o n > 270) ) or ( strand == F and mate strand == F ) #i n v e r s i o n or #i n t r a chromosomal t r a n s l o c a t i o n ( l o c a t i o n < mate loc and strand == R and mate strand== F ) or ( mate loc < l o c a t i o n and mate strand == R and strand== F ) ) p r i n t out both mates 15

5 Supplemental Figures The schema of the different tables of GQL Table Reads consists of fields such as location, strand length, pair end location and pair end strand. Intervals is a triplet that consists of fields begin, end and chromosome. Text can be any tab delimited file that a user specifies. Figure 1 16

A centered interval tree.the intervals that are stored in the tree are (1 5), (7 15), (16 19), (20 25) and (22 28). The construction considers as the center of the root the value 13 because it is the midpoint of interval (1 28) that results from the concatenation of all intervals of the set. The array of the root contains interval (7 15) because its end points are between the center value. The rest nodes are created recursively to store the remaining intervals. Figure 2 17

(a) (b) A demo that shows how GQL evaluates an expression on a table that is a result of one or more mapjoin operations. (a) An example table from multiple mapjoin operations. Assume table A with attribute arga,table B with attribute argb and table C with attribute argc. Table D is the result of the mapjoin between tables A and B and thus it contains attributes arga, argb. Table E is the result of the mapjoin between tables D and C and thus it contains attributes arga, argb and argc. (b) Evaluation of the expression E[i] = arga + argb + argc. The first line shows the necessary fields of the internal structures of GQL. The second line shows that after reading the contents of table E GQL learns that in order to get the values of arga and argb it has to get the 19 th entry of table D, while argc is in the 40 th entry of table C. contents of table E. The third line shows the state of the procedure after reading the proper value of argc from table C. Similarly the process continues with tables D, A and B sequentially and the last line of the figure contains the final state of the evaluation where the values of all fields become known. Figure 3 18

The GQL pipeline. GQL parser, which has been written in Bison, performs syntax and semantic analysis to the user input. The output of the compiler is passed to the recognizer which matches user commands with GQL routines and it also translates custom algebraic expression into C++ code. The recognizer generates a set of execution and recompilation statements which are executed in batch mode in the final step. Figure 4 19

The query planner. The output of the GQL parser is passed to the query planner which assigns the proper routines of the back end and implements the cached parsing optimization by generating custom C++ files. Figure 5 References 1. Kidd JM, et al.: Mapping and sequencing of structural variation from eight human genomes. Nature 2008, 453(7191):56 64. 2. Chen K, et al.: BreakDancer: an algorithm for high-resolution mapping of genomic structural variation. Nat. Methods 2009, 6(9):677 681. 20