Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Optimizing The Design of New Microbes Using Elasticsearch

Elastic Co
February 19, 2016

Optimizing The Design of New Microbes Using Elasticsearch

Zymergen has developed a new, industrialized process to create microbes capable of fermenting chemicals, pharmaceuticals and more. Success depends on insights gleaned from large volumes of possible DNA modifications. This talk will cover how Elasticsearch powers this revolution in scientific data analysis.

Elastic Co

February 19, 2016
Tweet

More Decks by Elastic Co

Other Decks in Technology

Transcript

  1. Industrial  Fermenta/on “The  inten&onal  use  of  fermenta&on  by   microorganisms

     such  as  bacteria  and  fungi   to  make  products  useful  to  humans.”  
  2. Produc/vity  is  on  the  rise "Time  for  New  DNA  Synthesis

     and  Sequencing  Cost  Curves",  Rob  Carlson  
  3. Produc/vity  is  on  the  rise "Time  for  New  DNA  Synthesis

     and  Sequencing  Cost  Curves",  Rob  Carlson   Moore’s  Law  
  4. Produc/vity  is  on  the  rise "Time  for  New  DNA  Synthesis

     and  Sequencing  Cost  Curves",  Rob  Carlson   The  number  of  base  pairs  one  person   can  sequence  in  a  day  using  modern     equipment  and  techniques.  
  5. Produc/vity  is  on  the  rise "Time  for  New  DNA  Synthesis

     and  Sequencing  Cost  Curves",  Rob  Carlson   The  number  of  base  pairs  one  person   can  synthesize  in  a  day  using  modern     equipment  and  techniques.  
  6. Costs  are  falling "Time  for  New  DNA  Synthesis  and  Sequencing

     Cost  Curves",  Rob  Carlson   Cost  to  sequence  a  base  pair  
  7. Costs  are  falling "Time  for  New  DNA  Synthesis  and  Sequencing

     Cost  Curves",  Rob  Carlson   Cost  to  synthesize  a  base  pair  
  8. Zymergen’s  Op/miza/on  Workflow DESIGN New  DNA  constructs BUILD Microbes  with

     new  DNA TEST Evaluate  microbe  performance ANALYZE Incorporate  test  results   Into  next  design  phase
  9. SoTware:  Design  a  campaign  of  changes.   hostStrain = dnaForStrain(“e-coli-461”)

    promoters = load(“promoter-lib-02-13-2015.gb”) genes = locateGenes(hostStrain, “YFG*”) create replacePromoter[x](genes, promoters)
  10. DNA   Components   Genomes  and   modifica&ons  to  

    genomes   120K   5M   60M   Some  sta/s/cs  from  our  system. Wells     Used  to  build  and   test  genomes  and   strains   Measurements     Taken  while  building   and  tes&ng  new   strains.  
  11. Our  data  is  growing  quickly. 14Q4   15Q1   15Q2

      15Q3   15Q4   16Q1   Well  Counts  Over  Time  
  12. Our  data  is  growing  quickly. 14Q4   15Q1   15Q2

      15Q3   15Q4   16Q1   Measurement  Counts  Over  Time  
  13. Data  Model  Implica/ons  For  End  Users   Asking  ques&ons  requires

     in&mate  knowledge  of  the  data  model.  
  14. Data  Model  Implica/ons  For  End  Users   Asking  ques&ons  requires

     in&mate  knowledge  of  the  data  model.   Asking  ques&ons  requires  in&mate  knowledge  of  SQL.  
  15. The  SQL  Answer SELECT          p.id  AS

     plate_id   FROM          strains  st          LEFT  JOIN  samples  sa  ON  sa.content_id  =  st.id          LEFT  JOIN  aliquot_components  ac  ON  ac.item_id  =  sa.id  AND  ac.canceled  =  0          LEFT  JOIN  aliquots  a  ON  a.id  =  ac.aliquot_id          LEFT  JOIN  wells  w  ON  w.ac&ve_aliquot_id  =  a.id          LEFT  JOIN  plates  p  ON  p.id  =  w.plate_id   WHERE  st.id  =  7000000000    
  16. Elas/csearch  supports  our  use   cases. Denormaliza&on  at  index  &me,

     combined   with  the  Search  Lite  DSL,  makes  it  easy  for   our  users  to  ask  ques&ons.  
  17. Architecture Factory  Web   Applica&on   Zymergen  REST  API  

    Rela&onal   Database   Elas&csearch   Built  in  Java  
  18. Architecture Factory  Web   Applica&on   Zymergen  REST  API  

    Rela&onal   Database   Elas&csearch   Uses  Hibernate   for  DB  interac&on  
  19. Architecture Factory  Web   Applica&on   Zymergen  REST  API  

    Rela&onal   Database   Elas&csearch   Jackson  library  for  JSON   descriptors  
  20. Architecture Factory  Web   Applica&on   Zymergen  REST  API  

    Rela&onal   Database   Elas&csearch   Use  Java  annota&ons  on   descriptors  to  control  type   mapping  and  search  document   serializa&on.  
  21. Search  Annota/ons:  Marking  Descriptors  as   Search  Documents @SearchDocument  

    public  class  StrainDescriptor  {        //  Descriptor  implementation      //  …   }    
  22. Search  Annota/ons:  Marking  Descriptors  as   Search  Documents @SearchDocument  

    public  class  StrainDescriptor  {        //  Descriptor  implementation      //  …   }     Indicates  this  type  will  be  indexed  for  search.  
  23. Search  Annota/ons:  Indexing  Descriptor  Fields @IndexedField   public  long  getId()

     {      return  this.id;   }     @IndexedField(name  =  “desc”)   public  String  getDescription()  {      return  this.name;   }  
  24. Search  Annota/ons:  Indexing  Descriptor  Fields @IndexedField   public  long  getId()

     {      return  this.id;   }     @IndexedField(name  =  “desc”)   public  String  getDescription()  {      return  this.name;   }   Indicates  this  field  will  be  included  in  the  search  document.  
  25. Search  Annota/ons:  Indexing  Descriptor  Fields @IndexedField   public  long  getId()

     {      return  this.id;   }     @IndexedField(name  =  “desc”)   public  String  getDescription()  {      return  this.name;   }   Control  name  of  field  in  search  document.  
  26. Search  Annota/ons:  Document  References @SearchDocumentReference(type=UserDescriptor.class,   fields={      

       @IncludeField(src="username",  target="design_user")   })   public  Long  getDesignUserId()  {      return  this.designUserId;   }  
  27. Search  Annota/ons:  Document  References @SearchDocumentReference(type=UserDescriptor.class,   fields={      

       @IncludeField(src="username",  target="design_user")   })   public  Long  getDesignUserId()  {      return  this.designUserId;   }   Marks  method  getDesignUserId  as  returning  the  ID  of  a  related  type.  
  28. Search  Annota/ons:  Document  References @SearchDocumentReference(type=UserDescriptor.class,   fields={      

       @IncludeField(src="username",  target="design_user")   })   public  Long  getDesignUserId()  {      return  this.designUserId;   }   Iden&fies  the  related  type.  
  29. Search  Annota/ons:  Document  References @SearchDocumentReference(type=UserDescriptor.class,   fields={      

       @IncludeField(src="username",  target="design_user")   })   public  Long  getDesignUserId()  {      return  this.designUserId;   }   The  field  to  include  from  the  related  type  
  30. The  Denormalizer  Interface //  Add  arbitrary  fields  to  a  search

     document.   public  interface  Denormalizer<T>  {            //  Declares  arbitrary  fields  to  add  to  document.      Map<String,  Class<?>>  getFieldTypes();        //  Provides  values  for  those  fields.      Map<String,  Object>  getFieldValues(Dao<T>  dao,  T  dto);   }  
  31. The  Denormalizer  Interface //  Add  arbitrary  fields  to  a  search

     document.   public  interface  Denormalizer<T>  {            //  Declares  arbitrary  fields  to  add  to  document.      Map<String,  Class<?>>  getFieldTypes();        //  Provides  values  for  those  fields.      Map<String,  Object>  getFieldValues(Dao<T>  dao,  T  dto);   }  
  32. The  Denormalizer  Interface //  Add  arbitrary  fields  to  a  search

     document.   public  interface  Denormalizer<T>  {            //  Declares  arbitrary  fields  to  add  to  document.      Map<String,  Class<?>>  getFieldTypes();        //  Provides  values  for  those  fields.      Map<String,  Object>  getFieldValues(Dao<T>  dao,  T  dto);   }  
  33. The  Denormalizer  Interface //  Add  arbitrary  fields  to  a  search

     document.   public  interface  Denormalizer<T>  {            //  Declares  arbitrary  fields  to  add  to  document.      Map<String,  Class<?>>  getFieldTypes();        //  Provides  values  for  those  fields.      Map<String,  Object>  getFieldValues(Dao<T>  dao,  T  dto);   }   Descriptor  being  transformed   into  search  document.  
  34. The  Denormalizer  Interface //  Add  arbitrary  fields  to  a  search

     document.   public  interface  Denormalizer<T>  {            //  Declares  arbitrary  fields  to  add  to  document.      Map<String,  Class<?>>  getFieldTypes();        //  Provides  values  for  those  fields.      Map<String,  Object>  getFieldValues(Dao<T>  dao,  T  dto);   }   Database  can  be  used  to   generate  field  values.  
  35. Search  Annota/ons:  Denormalizers @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {  

             //  Descriptor  implementation      //  …   }   Afach  a  denormalizer   to  a  type.  
  36. Type  Mapping  Genera/on @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {  

       @IndexedField      public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }  
  37. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Type  Mapping  Genera/on
  38. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Type  Mapping  Genera/on Type  Mapping  Generator   (Java  Code)  
  39. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Type  Mapping  Genera/on Type  Mapping  Generator   (Uses  Annota&ons,  Method   Names,  and  Return  Types)  
  40. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Type  Mapping  Genera/on Type  Mapping  Generator   (Uses  Field  Mapping  From   Reference  Documents)  
  41. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Type  Mapping  Genera/on Type  Mapping  Generator   (Calls  getFieldTypes()  on   the  Denormalizer)   public  interface  Denormalizer<T>  {            Map<String,  Class<?>>  getFieldTypes();        Map<String,  Object>  getFieldValues(Dao<T>  dao,  T  dto);   }  
  42. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Type  Mapping  Genera/on Type  Mapping  Generator     "plate":  {      "properties":  {          “id":  {              "type":  “long“          }          “description":  {              "type":  "string“          }          “design_user”:  {              “type”:  “string”          }      }   }  
  43. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Document  Serializa/on
  44. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Document  Serializa/on Document  Serializer   (Custom  Jackson  Serializer)  
  45. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Document  Serializa/on Document  Serializer   (Calls  Methods  To  Get     Field  Values)  
  46. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Document  Serializa/on Document  Serializer   (Retrieve  Reference  Fields   From  Database)   Rela&onal   Database  
  47. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Document  Serializa/on Document  Serializer   (Call  getFieldValues()  on   Denormalizer)   Rela&onal   Database   public  interface  Denormalizer<T>  {            Map<String,  Class<?>>  getFieldTypes();        Map<String,  Object>  getFieldValues(Dao<T>  dao,  T  dto);   }  
  48. @SearchDocument(denormalizer=PlateDenormalizer.class)   public  class  PlateDescriptor  {      @IndexedField  

       public  Long  getId()  {}        @IndexedField      public  String  getDescription  {}        @SearchDocumentReference(type=UserDescriptor.class,  fields={              @IncludeField(src="username",  target="design_user")      })      public  Long  getDesignUserId()  {}   }   Document  Serializa/on Document  Serializer     {      “id”:  2000000000,      “description”:  “My  Plate”,      “design_user”:  “Kiyan”   }  
  49. Fulfilling  Search  Queries Factory  Web   Applica&on   Zymergen  REST

     API   Rela&onal   Database   Elas&csearch   Query  sent  to  REST  endpoint.  
  50. Fulfilling  Search  Queries Factory  Web   Applica&on   Zymergen  REST

     API   Rela&onal   Database   Elas&csearch   Elas&csearch  queried  for  IDs  of   matching  documents.  
  51. Fulfilling  Search  Queries Factory  Web   Applica&on   Zymergen  REST

     API   Rela&onal   Database   Elas&csearch   IDs  of  matching  documents  used   to  query  database.  
  52. Fulfilling  Search  Queries Factory  Web   Applica&on   Zymergen  REST

     API   Rela&onal   Database   Elas&csearch   Results  sent  to  frontend     interface.