Advertisement
Guest User

node_red_flow

a guest
May 27th, 2017
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 28.70 KB | None | 0 0
  1. [
  2.     {
  3.         "id": "9af32fed.bc7fb",
  4.         "type": "http in",
  5.         "z": "8f712d25.103e6",
  6.         "name": "",
  7.         "url": "/biosuitcase",
  8.         "method": "get",
  9.         "swaggerDoc": "",
  10.         "x": 3124.0008697509766,
  11.         "y": 129.28579711914062,
  12.         "wires": [
  13.             [
  14.                 "fa7f6c66.48355"
  15.             ]
  16.         ]
  17.     },
  18.     {
  19.         "id": "9e1f4692.93f4f8",
  20.         "type": "template",
  21.         "z": "8f712d25.103e6",
  22.         "name": "HTML",
  23.         "field": "payload",
  24.         "fieldType": "msg",
  25.         "format": "handlebars",
  26.         "syntax": "mustache",
  27.         "template": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n\n    <title>BioSuitcase - A maleta do bioinformata</title>\n\n    <!-- Bootstrap Core CSS -->\n    <link href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\" crossorigin=\"anonymous\">\n\n    <!-- Custom CSS -->\n    <style>{{{payload.style}}}</style>\n    \n    <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>\n    \n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>\n\n    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->\n    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->\n    <!--[if lt IE 9]>\n        <script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>\n        <script src=\"https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js\"></script>\n    <![endif]-->\n\n</head>\n\n<body>\n\n    <!-- Navigation -->\n    <nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\n        <div class=\"container\">\n            <!-- Brand and toggle get grouped for better mobile display -->\n            <div class=\"navbar-header\">\n                <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\"#bs-example-navbar-collapse-1\">\n                    <span class=\"sr-only\">Toggle navigation</span>\n                    <span class=\"icon-bar\"></span>\n                    <span class=\"icon-bar\"></span>\n                    <span class=\"icon-bar\"></span>\n                </button>\n                <a class=\"navbar-brand\" href=\"#\">Start Bootstrap</a>\n            </div>\n            <!-- Collect the nav links, forms, and other content for toggling -->\n            <div class=\"collapse navbar-collapse\" id=\"bs-example-navbar-collapse-1\">\n                <ul class=\"nav navbar-nav\">\n                    <li>\n                        <a href=\"#\">About</a>\n                    </li>\n                    <li>\n                        <a href=\"#\">Services</a>\n                    </li>\n                    <li>\n                        <a href=\"#\">Contact</a>\n                    </li>\n                </ul>\n            </div>\n            <!-- /.navbar-collapse -->\n        </div>\n        <!-- /.container -->\n    </nav>\n\n    <!-- Page Content -->\n    <div class=\"container\">\n\n        <!-- Portfolio Item Heading -->\n        <div class=\"row\">\n            <div class=\"col-lg-12\">\n                <h1 class=\"page-header\">Busca</h1>\n            </div>\n        </div>\n        <!-- /.row -->\n\n        <!-- Portfolio Item Row -->\n        <div class=\"row\">\n\n            <div class=\"col-md-8\">\n                <form method=\"post\" action=\"/biosuitcase/ncbi_search\" ajax=\"true\" id=\"form_idade\">\n                    <div class=\"form-group\">\n                        <label for=\"fterm\">Termo:</label>\n                        <input type=\"text\" id=\"fterm\" name=\"term\" placeholder=\"{{{term}}}\" class=\"form-control\">    \n                    </div>\n                    <div class=\"form-group\">\n                        <label for=\"db\">Banco</label>\n                        <select class=\"form-control\" id=\"db\" name=\"db\">\n                            <option value=\"pubmed\">Pubmed</option>\n                            <option value=\"nucleotide\">Nucleotide</option>\n                            <option value=\"structure\">Structure</option>\n                        </select>\n                    </div> \n                    <button type=\"submit\" class=\"btn btn-default\">Submit</button>\n                </form>\n                \n                <h3>Resultados Encontrados</h3>\n                \n                <div id=\"results\">\n                    {{{payload.results}}}\n                </div>\n            </div>\n\n            <div class=\"col-md-4\">\n                {{{payload.result_details}}}\n            </div>\n\n        </div>\n        <!-- /.row -->\n\n        <hr>\n\n        <!-- Footer -->\n        <footer>\n            <div class=\"row\">\n                <div class=\"col-lg-12\">\n                    <p>BioSuitcase - A maleta do bioinformata</p>\n                    <p>By Inácio Medeiros</p>\n                </div>\n            </div>\n            <!-- /.row -->\n        </footer>\n\n    </div>\n    <!-- /.container -->\n</body>\n\n</html>\n",
  28.         "x": 3465.857940673828,
  29.         "y": 199.7143039703369,
  30.         "wires": [
  31.             [
  32.                 "b24f0da7.daf818"
  33.             ]
  34.         ]
  35.     },
  36.     {
  37.         "id": "b24f0da7.daf818",
  38.         "type": "http response",
  39.         "z": "8f712d25.103e6",
  40.         "name": "",
  41.         "x": 3607.6436767578125,
  42.         "y": 199.8571720123291,
  43.         "wires": []
  44.     },
  45.     {
  46.         "id": "fa7f6c66.48355",
  47.         "type": "template",
  48.         "z": "8f712d25.103e6",
  49.         "name": "CSS",
  50.         "field": "payload.style",
  51.         "fieldType": "msg",
  52.         "format": "css",
  53.         "syntax": "mustache",
  54.         "template": "/*!\n * Start Bootstrap - Portfolio Item (http://startbootstrap.com/)\n * Copyright 2013-2016 Start Bootstrap\n * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE)\n */\n\nbody {\n    padding-top: 70px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */\n}\n\n.portfolio-item {\n    margin-bottom: 25px;\n}\n\n.result_box {\n    border-radius: 25px;\n    border: 2px solid #73AD21;\n    padding: 2pt;\n}\n\n.result_text {\n    color: #0000FF;\n}\n\n.pub_title, .pub_authors {\n    font-weight: bold;\n    color: #00FF00;\n}\n\n.abstract {\n    color: #00AA00;\n}\n\nfooter {\n    margin: 50px 0;\n}",
  55.         "x": 3324.2865600585938,
  56.         "y": 199.57144355773926,
  57.         "wires": [
  58.             [
  59.                 "9e1f4692.93f4f8"
  60.             ]
  61.         ]
  62.     },
  63.     {
  64.         "id": "18055fe.9d593a",
  65.         "type": "http in",
  66.         "z": "8f712d25.103e6",
  67.         "name": "",
  68.         "url": "/biosuitcase/ncbi_search",
  69.         "method": "post",
  70.         "swaggerDoc": "",
  71.         "x": 145,
  72.         "y": 55.14282703399658,
  73.         "wires": [
  74.             [
  75.                 "dfa21026.fb93b"
  76.             ]
  77.         ]
  78.     },
  79.     {
  80.         "id": "3fb96b1c.5915cc",
  81.         "type": "xml",
  82.         "z": "8f712d25.103e6",
  83.         "name": "",
  84.         "attr": "",
  85.         "chr": "",
  86.         "x": 1386.4998893737793,
  87.         "y": 57.14270305633545,
  88.         "wires": [
  89.             [
  90.                 "a114c5e.bed78b8"
  91.             ]
  92.         ]
  93.     },
  94.     {
  95.         "id": "a114c5e.bed78b8",
  96.         "type": "function",
  97.         "z": "8f712d25.103e6",
  98.         "name": "Extract ID List",
  99.         "func": "msg.id_list = msg.payload.eSearchResult.IdList[0].Id;\nreturn msg;",
  100.         "outputs": 1,
  101.         "noerr": 0,
  102.         "x": 1575.500144958496,
  103.         "y": 145.14276444911957,
  104.         "wires": [
  105.             [
  106.                 "2ea17a0.1d53e86"
  107.             ]
  108.         ]
  109.     },
  110.     {
  111.         "id": "1c38721f.59e7b6",
  112.         "type": "function",
  113.         "z": "8f712d25.103e6",
  114.         "name": "Publications Search",
  115.         "func": "msg.payload = \"db=pubmed&\";\nreturn msg;",
  116.         "outputs": 1,
  117.         "noerr": 0,
  118.         "x": 768.0000114440918,
  119.         "y": 20,
  120.         "wires": [
  121.             [
  122.                 "d74b1aa8.83d71"
  123.             ]
  124.         ]
  125.     },
  126.     {
  127.         "id": "b769692a.62e0f",
  128.         "type": "function",
  129.         "z": "8f712d25.103e6",
  130.         "name": "DNA-Seq Search",
  131.         "func": "msg.payload = \"db=nucleotide&\";\nreturn msg;",
  132.         "outputs": 1,
  133.         "noerr": 0,
  134.         "x": 758.0000114440918,
  135.         "y": 56,
  136.         "wires": [
  137.             [
  138.                 "d74b1aa8.83d71"
  139.             ]
  140.         ]
  141.     },
  142.     {
  143.         "id": "a5788c3e.c40e68",
  144.         "type": "function",
  145.         "z": "8f712d25.103e6",
  146.         "name": "Structure Search",
  147.         "func": "msg.payload = \"db=structure&\";\nreturn msg;",
  148.         "outputs": 1,
  149.         "noerr": 0,
  150.         "x": 758.0000839233398,
  151.         "y": 96.00000762939453,
  152.         "wires": [
  153.             [
  154.                 "d74b1aa8.83d71"
  155.             ]
  156.         ]
  157.     },
  158.     {
  159.         "id": "dec1f4a5.614ec",
  160.         "type": "switch",
  161.         "z": "8f712d25.103e6",
  162.         "name": "",
  163.         "property": "db",
  164.         "propertyType": "msg",
  165.         "rules": [
  166.             {
  167.                 "t": "eq",
  168.                 "v": "pubmed",
  169.                 "vt": "str"
  170.             },
  171.             {
  172.                 "t": "eq",
  173.                 "v": "nucleotide",
  174.                 "vt": "str"
  175.             },
  176.             {
  177.                 "t": "eq",
  178.                 "v": "structure",
  179.                 "vt": "str"
  180.             }
  181.         ],
  182.         "checkall": "true",
  183.         "outputs": 3,
  184.         "x": 549.5000114440918,
  185.         "y": 56,
  186.         "wires": [
  187.             [
  188.                 "1c38721f.59e7b6"
  189.             ],
  190.             [
  191.                 "b769692a.62e0f"
  192.             ],
  193.             [
  194.                 "a5788c3e.c40e68"
  195.             ]
  196.         ]
  197.     },
  198.     {
  199.         "id": "dfa21026.fb93b",
  200.         "type": "function",
  201.         "z": "8f712d25.103e6",
  202.         "name": "param config",
  203.         "func": "msg.db = msg.payload.db;\nmsg.term = msg.payload.term;\nreturn msg;",
  204.         "outputs": 1,
  205.         "noerr": 0,
  206.         "x": 387.50003814697266,
  207.         "y": 56,
  208.         "wires": [
  209.             [
  210.                 "dec1f4a5.614ec"
  211.             ]
  212.         ]
  213.     },
  214.     {
  215.         "id": "ed3c60a2.7cd1",
  216.         "type": "http request",
  217.         "z": "8f712d25.103e6",
  218.         "name": "NCBI E-Search",
  219.         "method": "GET",
  220.         "ret": "txt",
  221.         "url": "",
  222.         "tls": "",
  223.         "x": 1223.2858695983887,
  224.         "y": 56.71429443359375,
  225.         "wires": [
  226.             [
  227.                 "3fb96b1c.5915cc"
  228.             ]
  229.         ]
  230.     },
  231.     {
  232.         "id": "96c8005.f62928",
  233.         "type": "http request",
  234.         "z": "8f712d25.103e6",
  235.         "name": "NCBI E-Summary",
  236.         "method": "GET",
  237.         "ret": "txt",
  238.         "url": "",
  239.         "tls": "",
  240.         "x": 2049.250534057617,
  241.         "y": 198.75011730194092,
  242.         "wires": [
  243.             [
  244.                 "70692f4.8670dd"
  245.             ]
  246.         ]
  247.     },
  248.     {
  249.         "id": "d44455da.1157b8",
  250.         "type": "switch",
  251.         "z": "8f712d25.103e6",
  252.         "name": "switch db",
  253.         "property": "db",
  254.         "propertyType": "msg",
  255.         "rules": [
  256.             {
  257.                 "t": "eq",
  258.                 "v": "pubmed",
  259.                 "vt": "str"
  260.             },
  261.             {
  262.                 "t": "eq",
  263.                 "v": "nucleotide",
  264.                 "vt": "str"
  265.             },
  266.             {
  267.                 "t": "eq",
  268.                 "v": "structure",
  269.                 "vt": "str"
  270.             }
  271.         ],
  272.         "checkall": "true",
  273.         "outputs": 3,
  274.         "x": 2373.0003662109375,
  275.         "y": 198.75012266635895,
  276.         "wires": [
  277.             [
  278.                 "f649dcef.7b4b68"
  279.             ],
  280.             [
  281.                 "dd2bc388.b125a8"
  282.             ],
  283.             [
  284.                 "e339317c.c971a8"
  285.             ]
  286.         ]
  287.     },
  288.     {
  289.         "id": "f649dcef.7b4b68",
  290.         "type": "function",
  291.         "z": "8f712d25.103e6",
  292.         "name": "Parse Pubmed Results",
  293.         "func": "var publications = [];\n\nvar publication = null;\nvar pub_it = null;\nvar author_list = null;\n\nvar e_summary_results = msg.payload.eSummaryResult.DocSum;\n\nconst TITLE_INDEX = 5;\nconst AUTHOR_LIST_INDEX = 3;\nconst PUB_DATE_INDEX = 1;\n\nfor(var pub = 0; pub < e_summary_results.length; pub++){\n    publication = {};\n    pub_it = e_summary_results[pub];\n    \n    publication.id       = pub_it.Id[0];\n    publication.title    = pub_it.Item[TITLE_INDEX]._;\n    publication.pub_date = pub_it.Item[PUB_DATE_INDEX]._;\n    \n    publication.authors = [];\n    \n    author_list = pub_it.Item[AUTHOR_LIST_INDEX].Item;\n    for(var i_author = 0; i_author < author_list.length; i_author++){\n        publication.authors.push(author_list[i_author]._);\n    }\n\n    publications.push(publication);\n}\n\nmsg.pub_ids = [];\nmsg.pub_titles = [];\nmsg.pub_authors = [];\nmsg.pub_dates = [];\n\nfor(var pub = 0; pub < publications.length; pub++){\n    msg.pub_ids.push(publications[pub].id);\n    msg.pub_titles.push(publications[pub].title.replace(/[^a-zA-Z ]/g, \"\"));\n    msg.pub_dates.push(publications[pub].pub_date);\n    msg.pub_authors.push(publications[pub].authors[0]);\n}\n\nreturn msg;",
  294.         "outputs": 1,
  295.         "noerr": 0,
  296.         "x": 2598.0004806518555,
  297.         "y": 155.5001484155655,
  298.         "wires": [
  299.             [
  300.                 "60c8a7de.fce128"
  301.             ]
  302.         ]
  303.     },
  304.     {
  305.         "id": "dd2bc388.b125a8",
  306.         "type": "function",
  307.         "z": "8f712d25.103e6",
  308.         "name": "Parse Nucleotide Results",
  309.         "func": "var gene = null;\nvar gene_it = null;\nvar author_list = null;\n\nmsg.gene_ids = [];\nmsg.gene_names = [];\nmsg.gene_bps = [];\n\nvar e_summary_results = msg.payload.eSummaryResult.DocSum;\n\nconst NAME_INDEX = 1;\nconst BP_INDEX = 8;\n\nfor(var gen = 0; gen < e_summary_results.length; gen++){\n    gene = {};\n    gene_it = e_summary_results[gen];\n    \n    msg.gene_ids.push(gene_it.Id[0]);\n    msg.gene_names.push(gene_it.Item[NAME_INDEX]._.replace(/[^a-zA-Z ]/g, \"\"));\n    msg.gene_bps.push(gene_it.Item[BP_INDEX]._);\n}\n\nreturn msg;",
  310.         "outputs": 1,
  311.         "noerr": 0,
  312.         "x": 2608.0005416870117,
  313.         "y": 198.50010359287262,
  314.         "wires": [
  315.             [
  316.                 "d83da379.80172"
  317.             ]
  318.         ]
  319.     },
  320.     {
  321.         "id": "e339317c.c971a8",
  322.         "type": "function",
  323.         "z": "8f712d25.103e6",
  324.         "name": "Parse Structure Results",
  325.         "func": "var structure = null;\nvar structure_it = null;\nvar author_list = null;\n\nvar e_summary_results = msg.payload.eSummaryResult.DocSum;\n\nconst PDB_INDEX = 0;\nconst DESCRIPTION_INDEX = 1;\nconst CLASS_INDEX = 5;\n\nmsg.struct_ids = [];\nmsg.struct_pdbs = [];\nmsg.struct_descrs = [];\nmsg.struct_classes = [];\n\nfor(var struct = 0; struct < e_summary_results.length; struct++){\n    structure = {};\n    structure_it = e_summary_results[struct];\n    \n    msg.struct_ids.push(structure_it.Id[0]);\n    msg.struct_pdbs.push(structure_it.Item[PDB_INDEX]._);\n    msg.struct_descrs.push(structure_it.Item[DESCRIPTION_INDEX]._.replace(/[^a-zA-Z ]/g, \"\"));\n    msg.struct_classes.push(structure_it.Item[CLASS_INDEX]._.replace(/[^a-zA-Z ]/g, \"\"));\n}\n\nreturn msg;",
  326.         "outputs": 1,
  327.         "noerr": 0,
  328.         "x": 2607.0005111694336,
  329.         "y": 241.50011885166168,
  330.         "wires": [
  331.             [
  332.                 "6800a188.5f209"
  333.             ]
  334.         ]
  335.     },
  336.     {
  337.         "id": "d74b1aa8.83d71",
  338.         "type": "function",
  339.         "z": "8f712d25.103e6",
  340.         "name": "NCBI E-Search URL",
  341.         "func": "var base_url = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?\";\n\nvar db = msg.payload;\nvar term = \"&term=\" + msg.term;\n\nmsg.payload = base_url + db + term;\n\nmsg.url = msg.payload;\n\nreturn msg;",
  342.         "outputs": 1,
  343.         "noerr": 0,
  344.         "x": 1008.5000114440918,
  345.         "y": 56,
  346.         "wires": [
  347.             [
  348.                 "ed3c60a2.7cd1"
  349.             ]
  350.         ]
  351.     },
  352.     {
  353.         "id": "2ea17a0.1d53e86",
  354.         "type": "function",
  355.         "z": "8f712d25.103e6",
  356.         "name": "NCBI E-Summary URL",
  357.         "func": "var esummary_url = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?\";\n\nvar ids = \"id=\";\n\nfor(var i = 0; i < msg.id_list.length-1; i++){\n    ids += msg.id_list[i] + \",\";\n}\n\nids += msg.id_list[msg.id_list.length-1];\n\nmsg.url = esummary_url + \"db=\" + msg.db + \"&\" + ids + \"&retmode=xml\";\n\nreturn msg;",
  358.         "outputs": 1,
  359.         "noerr": 0,
  360.         "x": 1804.7583465576172,
  361.         "y": 198.88680934906006,
  362.         "wires": [
  363.             [
  364.                 "96c8005.f62928"
  365.             ]
  366.         ]
  367.     },
  368.     {
  369.         "id": "70692f4.8670dd",
  370.         "type": "xml",
  371.         "z": "8f712d25.103e6",
  372.         "name": "",
  373.         "attr": "",
  374.         "chr": "",
  375.         "x": 2227.762233734131,
  376.         "y": 198.8828535079956,
  377.         "wires": [
  378.             [
  379.                 "d44455da.1157b8"
  380.             ]
  381.         ]
  382.     },
  383.     {
  384.         "id": "3999846f.57f98c",
  385.         "type": "change",
  386.         "z": "8f712d25.103e6",
  387.         "name": "HTML Content-Type",
  388.         "rules": [
  389.             {
  390.                 "t": "set",
  391.                 "p": "headers",
  392.                 "pt": "msg",
  393.                 "to": "{}",
  394.                 "tot": "str"
  395.             },
  396.             {
  397.                 "t": "set",
  398.                 "p": "headers.content-type",
  399.                 "pt": "msg",
  400.                 "to": "text/html; charset=utf-8",
  401.                 "tot": "str"
  402.             }
  403.         ],
  404.         "action": "",
  405.         "property": "",
  406.         "from": "",
  407.         "to": "",
  408.         "reg": false,
  409.         "x": 3109.7664947509766,
  410.         "y": 198.75004386901855,
  411.         "wires": [
  412.             [
  413.                 "fa7f6c66.48355"
  414.             ]
  415.         ]
  416.     },
  417.     {
  418.         "id": "60c8a7de.fce128",
  419.         "type": "template",
  420.         "z": "8f712d25.103e6",
  421.         "name": "Pubmed Template",
  422.         "field": "payload.results",
  423.         "fieldType": "msg",
  424.         "format": "handlebars",
  425.         "syntax": "mustache",
  426.         "template": "<script>\n    var results_html = \"\";\n    \n    var ids = \"{{{pub_ids}}}\".split(\",\");\n    var titles = \"{{{pub_titles}}}\".split(\",\");\n    var authors = \"{{{pub_authors}}}\".split(\",\");\n    var dates = \"{{{pub_dates}}}\".split(\",\");\n    \n    var number_of_publications = titles.length;\n\n    for (var i = 0; i < number_of_publications; i++) {\n        results_html += \"<div class=\\\"result_box\\\">\";\n        results_html += \"<h3 class=\\\"result_text\\\"><a href=/biosuitcase/ncbi_search/pubmed/\"+ids[i]+\">\"+titles[i]+\"</a></h3>\";\n        results_html += \"<p class=\\\"result_text\\\">First Author: \"+authors[i]+\"</p>\";\n        results_html += \"<p class=\\\"result_text\\\">Publication Date: \"+dates[i]+\"</p>\";\n        results_html += \"</div>\";\n    }\n    \n    $(\"#results\").html(results_html);\n</script>",
  427.         "x": 2852.0078125,
  428.         "y": 155.1328125,
  429.         "wires": [
  430.             [
  431.                 "3999846f.57f98c"
  432.             ]
  433.         ]
  434.     },
  435.     {
  436.         "id": "d83da379.80172",
  437.         "type": "template",
  438.         "z": "8f712d25.103e6",
  439.         "name": "Nucleotide Template",
  440.         "field": "payload.results",
  441.         "fieldType": "msg",
  442.         "format": "handlebars",
  443.         "syntax": "mustache",
  444.         "template": "<script>\n    var results_html = \"\";\n    \n    var ids = \"{{{gene_ids}}}\".split(\",\");\n    var names = \"{{{gene_names}}}\".split(\",\");\n    var bps = \"{{{gene_bps}}}\".split(\",\");\n    \n    var number_of_genes = ids.length;\n\n    for (var i = 0; i < number_of_genes; i++) {\n        results_html += \"<div class=\\\"result_box\\\">\";\n        results_html += \"<h3 class=\\\"result_text\\\"><a href=/biosuitcase/ncbi_search/nucleotide/\"+ids[i]+\">\"+names[i]+\"</a></h3>\";\n        results_html += \"<p class=\\\"result_text\\\">\"+bps[i]+\" base pairs</p>\";\n        results_html += \"</div>\";\n    }\n    \n    $(\"#results\").html(results_html);\n</script>",
  445.         "x": 2862.765884399414,
  446.         "y": 198.75000953674316,
  447.         "wires": [
  448.             [
  449.                 "3999846f.57f98c"
  450.             ]
  451.         ]
  452.     },
  453.     {
  454.         "id": "6800a188.5f209",
  455.         "type": "template",
  456.         "z": "8f712d25.103e6",
  457.         "name": "Structure Template",
  458.         "field": "payload.results",
  459.         "fieldType": "msg",
  460.         "format": "handlebars",
  461.         "syntax": "mustache",
  462.         "template": "<script>\n    var results_html = \"\";\n    \n    var ids     = \"{{{struct_ids}}}\".split(\",\");\n    var pdbs    = \"{{{struct_pdbs}}}\".split(\",\");\n    var descrs  = \"{{{struct_descrs}}}\".split(\",\");\n    var classes = \"{{{struct_classes}}}\".split(\",\");\n    \n    var number_of_structs = ids.length;\n\n    for (var i = 0; i < number_of_structs; i++) {\n        results_html += \"<div class=\\\"result_box\\\">\";\n        results_html += \"<h3 class=\\\"result_text\\\"><a href=/biosuitcase/ncbi_search/structure/\"+ids[i]+\">\"+pdbs[i]+\"</a></h3>\";\n        results_html += \"<p class=\\\"result_text\\\">\"+descrs[i]+\"</p>\";\n        results_html += \"<p class=\\\"result_text\\\"><strong>Class: </strong>\"+classes[i]+\"</p>\";\n        results_html += \"</div>\";\n    }\n    \n    $(\"#results\").html(results_html);\n</script>\n\n<!-- \n\nmsg.struct_ids = [];\nmsg.struct_pdbs = [];\nmsg.struct_descrs = [];\nmsg.struct_classes = [];\n\n-->",
  463.         "x": 2852.7657012939453,
  464.         "y": 241.75001430511475,
  465.         "wires": [
  466.             [
  467.                 "3999846f.57f98c"
  468.             ]
  469.         ]
  470.     },
  471.     {
  472.         "id": "cae1f491.7260e8",
  473.         "type": "http request",
  474.         "z": "8f712d25.103e6",
  475.         "name": "NCBI E-Fetch",
  476.         "method": "GET",
  477.         "ret": "txt",
  478.         "url": "",
  479.         "tls": "",
  480.         "x": 2953.451858520508,
  481.         "y": 425.88893270492554,
  482.         "wires": [
  483.             [
  484.                 "e5083011.ebdd"
  485.             ]
  486.         ]
  487.     },
  488.     {
  489.         "id": "242bbad.4cd3446",
  490.         "type": "switch",
  491.         "z": "8f712d25.103e6",
  492.         "name": "switch db",
  493.         "property": "db",
  494.         "propertyType": "msg",
  495.         "rules": [
  496.             {
  497.                 "t": "eq",
  498.                 "v": "pubmed",
  499.                 "vt": "str"
  500.             },
  501.             {
  502.                 "t": "eq",
  503.                 "v": "nucleotide",
  504.                 "vt": "str"
  505.             },
  506.             {
  507.                 "t": "eq",
  508.                 "v": "structure",
  509.                 "vt": "str"
  510.             }
  511.         ],
  512.         "checkall": "true",
  513.         "outputs": 3,
  514.         "x": 3258.201690673828,
  515.         "y": 425.88893806934357,
  516.         "wires": [
  517.             [
  518.                 "d0f1c4c8.5c7788"
  519.             ],
  520.             [
  521.                 "7a2d035f.025d1c"
  522.             ],
  523.             [
  524.                 "73a99e62.b01e3"
  525.             ]
  526.         ]
  527.     },
  528.     {
  529.         "id": "d0f1c4c8.5c7788",
  530.         "type": "function",
  531.         "z": "8f712d25.103e6",
  532.         "name": "Parse Pubmed Results",
  533.         "func": "var publication = msg.payload.PubmedArticleSet.PubmedArticle[0].MedlineCitation[0];\nvar pub_details = publication.Article[0];\n\nmsg.pmid = publication.PMID[0]._;\nmsg.pub_journal = pub_details.Journal[0].Title[0];\nmsg.pub_title = pub_details.ArticleTitle[0];\nmsg.abstract = pub_details.Abstract[0].AbstractText;\nmsg.authors = [];\n\nvar authors_list = pub_details.AuthorList[0].Author;\nvar author_name = \"\";\nfor(var i = 0; i < authors_list.length; i++){\n    author_name = authors_list[i].ForeName + \" \" + authors_list[i].LastName;\n    msg.authors.push(author_name);\n}\n\nreturn msg;",
  534.         "outputs": 1,
  535.         "noerr": 0,
  536.         "x": 3483.201805114746,
  537.         "y": 382.6389638185501,
  538.         "wires": [
  539.             [
  540.                 "92190818.6a2ba8"
  541.             ]
  542.         ]
  543.     },
  544.     {
  545.         "id": "7a2d035f.025d1c",
  546.         "type": "function",
  547.         "z": "8f712d25.103e6",
  548.         "name": "Parse Nucleotide Results",
  549.         "func": "return msg;",
  550.         "outputs": 1,
  551.         "noerr": 0,
  552.         "x": 3493.2018661499023,
  553.         "y": 425.63891899585724,
  554.         "wires": [
  555.             [
  556.                 "2632512b.7a19de"
  557.             ]
  558.         ]
  559.     },
  560.     {
  561.         "id": "73a99e62.b01e3",
  562.         "type": "function",
  563.         "z": "8f712d25.103e6",
  564.         "name": "Parse Structure Results",
  565.         "func": "return msg;",
  566.         "outputs": 1,
  567.         "noerr": 0,
  568.         "x": 3492.201835632324,
  569.         "y": 468.6389342546463,
  570.         "wires": [
  571.             [
  572.                 "47f8d556.fdecec"
  573.             ]
  574.         ]
  575.     },
  576.     {
  577.         "id": "5f534156.1daee",
  578.         "type": "function",
  579.         "z": "8f712d25.103e6",
  580.         "name": "NCBI E-Fetch URL",
  581.         "func": "var efetch_url = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?\";\n\nmsg.url = efetch_url + \"db=\" + msg.req.params.db + \"&\" + \"id=\" + msg.req.params.id + \"&retmode=xml\";\n\nreturn msg;",
  582.         "outputs": 1,
  583.         "noerr": 0,
  584.         "x": 2749.959671020508,
  585.         "y": 426.0256247520447,
  586.         "wires": [
  587.             [
  588.                 "cae1f491.7260e8"
  589.             ]
  590.         ]
  591.     },
  592.     {
  593.         "id": "e5083011.ebdd",
  594.         "type": "xml",
  595.         "z": "8f712d25.103e6",
  596.         "name": "",
  597.         "attr": "",
  598.         "chr": "",
  599.         "x": 3112.9635581970215,
  600.         "y": 426.0216689109802,
  601.         "wires": [
  602.             [
  603.                 "242bbad.4cd3446"
  604.             ]
  605.         ]
  606.     },
  607.     {
  608.         "id": "92190818.6a2ba8",
  609.         "type": "template",
  610.         "z": "8f712d25.103e6",
  611.         "name": "Pubmed Template",
  612.         "field": "payload.result_details",
  613.         "fieldType": "msg",
  614.         "format": "handlebars",
  615.         "syntax": "mustache",
  616.         "template": "<h1 class=\"pub_title\">{{{pub_title}}}</h1>\n<h2 class=\"pub_authors\">{{{authors}}}</h2>\n<p>Published on: {{{pub_journal}}}. PMID: {{{pmid}}}</p>\n<p class=\"abstract\">{{{abstract}}}</p>",
  617.         "x": 3739.0006256103516,
  618.         "y": 382.0000567436218,
  619.         "wires": [
  620.             [
  621.                 "d2670d1f.9e9a3"
  622.             ]
  623.         ]
  624.     },
  625.     {
  626.         "id": "2632512b.7a19de",
  627.         "type": "template",
  628.         "z": "8f712d25.103e6",
  629.         "name": "Nucleotide Template",
  630.         "field": "payload.result_details",
  631.         "fieldType": "msg",
  632.         "format": "handlebars",
  633.         "syntax": "mustache",
  634.         "template": "{{{payload}}}   ",
  635.         "x": 3749.7586975097656,
  636.         "y": 425.617253780365,
  637.         "wires": [
  638.             [
  639.                 "d2670d1f.9e9a3"
  640.             ]
  641.         ]
  642.     },
  643.     {
  644.         "id": "47f8d556.fdecec",
  645.         "type": "template",
  646.         "z": "8f712d25.103e6",
  647.         "name": "Structure Template",
  648.         "field": "payload.result_details",
  649.         "fieldType": "msg",
  650.         "format": "handlebars",
  651.         "syntax": "mustache",
  652.         "template": "{{{payload}}}   ",
  653.         "x": 3739.758514404297,
  654.         "y": 468.6172585487366,
  655.         "wires": [
  656.             [
  657.                 "d2670d1f.9e9a3"
  658.             ]
  659.         ]
  660.     },
  661.     {
  662.         "id": "d2670d1f.9e9a3",
  663.         "type": "change",
  664.         "z": "8f712d25.103e6",
  665.         "name": "HTML Content-Type",
  666.         "rules": [
  667.             {
  668.                 "t": "set",
  669.                 "p": "headers",
  670.                 "pt": "msg",
  671.                 "to": "{}",
  672.                 "tot": "str"
  673.             },
  674.             {
  675.                 "t": "set",
  676.                 "p": "headers.content-type",
  677.                 "pt": "msg",
  678.                 "to": "text/html; charset=utf-8",
  679.                 "tot": "str"
  680.             }
  681.         ],
  682.         "action": "",
  683.         "property": "",
  684.         "from": "",
  685.         "to": "",
  686.         "reg": false,
  687.         "x": 4063.0079956054688,
  688.         "y": 426.52345085144043,
  689.         "wires": [
  690.             [
  691.                 "fa7f6c66.48355"
  692.             ]
  693.         ]
  694.     },
  695.     {
  696.         "id": "4ccfdb83.1fc9a4",
  697.         "type": "http in",
  698.         "z": "8f712d25.103e6",
  699.         "name": "",
  700.         "url": "/biosuitcase/ncbi_search/:db/:id",
  701.         "method": "get",
  702.         "swaggerDoc": "",
  703.         "x": 3077.500442504883,
  704.         "y": 653.0000133514404,
  705.         "wires": [
  706.             [
  707.                 "5f534156.1daee"
  708.             ]
  709.         ]
  710.     }
  711. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement