biological modelling, powered by angularjs

40
Biological Modelling, Powered by AngularJS Gil Fink CEO and Senior Consultant, sparXys @gilfink

Upload: gil-fink

Post on 19-Feb-2017

384 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Biological Modelling, Powered by AngularJS

Biological Modelling, Powered by AngularJS Gil Fink CEO and Senior Consultant, sparXys @gilfink

Page 2: Biological Modelling, Powered by AngularJS

This session is about graphics (SVG)

Page 3: Biological Modelling, Powered by AngularJS

This is how I draw a man…

Page 4: Biological Modelling, Powered by AngularJS
Page 5: Biological Modelling, Powered by AngularJS

And this is how I draw a bus…

Page 6: Biological Modelling, Powered by AngularJS
Page 7: Biological Modelling, Powered by AngularJS

This is how I draw a toilet…

Page 8: Biological Modelling, Powered by AngularJS
Page 9: Biological Modelling, Powered by AngularJS

I wish…

Page 10: Biological Modelling, Powered by AngularJS
Page 11: Biological Modelling, Powered by AngularJS

And somebody let me speak about graphics…

Me

My AngularConnect Session

Page 12: Biological Modelling, Powered by AngularJS
Page 13: Biological Modelling, Powered by AngularJS

Ok, so let’s get serious!

Page 14: Biological Modelling, Powered by AngularJS

About Me • sparXys CEO and Senior consultant

• ASP.NET/IIS Microsoft MVP

• Co-author of Pro Single Page Application

Development (Apress)

• ng-conf Israel co-organizer and GDG Rashlatz

Meetup co-organizer

Page 15: Biological Modelling, Powered by AngularJS

Agenda • SVG in a Nutshell

• SVG + AngularJS = <3

• Use Case: Biological Modelling

Page 16: Biological Modelling, Powered by AngularJS

SVG in a Nutshell • Graphics model in the browser

• Create and draw 2D vector graphics using HTML

• Support for: o Full DOM access

o Document structure, scripting, styling, paths, shapes, colors, transforms,

gradients, patterns, masking, clipping, markers, linking and views

Page 17: Biological Modelling, Powered by AngularJS

2D Vector Graphics

<svg width="400" height="200" xmlns="http://www.w3.org/2000/svg"> <rect fill="red" x="20" y="20" width="100" height="75" /> <rect fill="blue" x="50" y="50" width="100" height="75" /> </svg>

Page 18: Biological Modelling, Powered by AngularJS

SVG Goodies Demo

Page 19: Biological Modelling, Powered by AngularJS

SVG + AngularJS = <3 Combining Angular and SVG is not hard

SVG elements are part of the DOM

Page 20: Biological Modelling, Powered by AngularJS

SVG + AngularJS Caveats • In directives that generate SVG, use

templateNamespace in the DDO:

• Set SVG attributes by using ng-attr- prefix:

<circle ng-attr-cx="{{radius}}" ng-attr-cy="{{radius}}" ng-attr-r="{{radius}}"/>

templateNamespace: 'svg'

Page 21: Biological Modelling, Powered by AngularJS

SVG & AngularJS Directive Demo

Page 22: Biological Modelling, Powered by AngularJS

Use Case SVG + AngularJS for Biological Modelling

Page 23: Biological Modelling, Powered by AngularJS

Biology Disclaimer

Page 24: Biological Modelling, Powered by AngularJS

Biology 101 • Plasmids - small DNA molecules represented as a

circle with annotations

Page 25: Biological Modelling, Powered by AngularJS

Biology 101 • Sequence – primary structure of a biological

molecule written in characters (A, T, G, C)

Page 26: Biological Modelling, Powered by AngularJS

Customer Needs • Synchronize plasmid and sequence views

• Fast scrolling

• Sequence and plasmid selection

• Annotation layers

Page 27: Biological Modelling, Powered by AngularJS

Lazy Developer

Page 28: Biological Modelling, Powered by AngularJS

Are there any JavaScript libraries for plasmids or sequences?

With AngularJS support?

Page 29: Biological Modelling, Powered by AngularJS

AngularPlasmid • DNA plasmid visualization component using

AngularJS and SVG

• http://angularplasmid.vixis.com/index.php

<plasmid sequencelength='1000'> <plasmidtrack radius='50'> <tracklabel text='Demo'></tracklabel> <trackscale interval='100' showlabels='1'></trackscale> <trackmarker start='212' end='345'></trackmarker> <trackmarker start='530' end='650'> <markerlabel text='Ecol'></markerlabel> </trackmarker> <trackmarker start='677' end='820'></trackmarker> </plasmidtrack> </plasmid>

Page 30: Biological Modelling, Powered by AngularJS

Problems We Faced • Generating the plasmid dynamically from specific

files o Solved by dynamically adding AngularPlasmid elements

o Then, we use the $compile service

• Adding selection to the plasmid o Solved by adding our own implementation

Page 31: Biological Modelling, Powered by AngularJS

No DNA sequence library

Page 32: Biological Modelling, Powered by AngularJS

Building the Sequence – The Naïve Way

• Let AngularJS generate the whole sequence o Use ng-repeat, SVG and browser scrolling

• Add annotation layers with SVG

• The problem is…

Page 33: Biological Modelling, Powered by AngularJS
Page 34: Biological Modelling, Powered by AngularJS

What’s the problem you ask?

Page 35: Biological Modelling, Powered by AngularJS
Page 36: Biological Modelling, Powered by AngularJS

Can we do better? Maybe infinite scrolling?

Not good enough!

Page 37: Biological Modelling, Powered by AngularJS

Virtual Scrolling • Generate only the current viewport

• Good reading reference: o http://blog.stackfull.com/2013/02/angularjs-virtual-scrolling-part-1/

o http://blog.stackfull.com/2013/03/angularjs-virtual-scrolling-part-2/

Page 38: Biological Modelling, Powered by AngularJS

Demo Genome Viewer (work in progress)

Page 39: Biological Modelling, Powered by AngularJS

Summary • SVG is one of the options to create graphics in

the browser

• SVG and AngularJS can work well together

• You can create sophisticated modelling using SVG and AngularJS

Page 40: Biological Modelling, Powered by AngularJS

Thank You!