{"id":789,"date":"2022-05-17T07:11:50","date_gmt":"2022-05-17T07:11:50","guid":{"rendered":"http:\/\/imdeafoodcompubio.com\/?page_id=789"},"modified":"2023-06-28T10:56:41","modified_gmt":"2023-06-28T10:56:41","slug":"enrichment_geneset","status":"publish","type":"page","link":"https:\/\/imdeafoodcompubio.com\/index.php\/enrichment_geneset\/","title":{"rendered":"Enrichment_GeneSet"},"content":{"rendered":"<!DOCTYPE html>\r\n<html lang=\"es\">\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n\r\n  <link rel=\"stylesheet\" href=\"\/\/code.jquery.com\/ui\/1.13.2\/themes\/base\/jquery-ui.css\">\r\n<script src=\"https:\/\/code.jquery.com\/jquery-3.6.0.min.js\"><\/script>\r\n<script src=\"https:\/\/code.jquery.com\/jquery-migrate-1.4.1.min.js\"><\/script>\r\n  <script src=\"https:\/\/code.jquery.com\/ui\/1.13.2\/jquery-ui.js\"><\/script>\r\n\r\n\r\n\r\n<link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@4.5.3\/dist\/css\/bootstrap.min.css\" integrity=\"sha384-TX8t27EcRE3e\/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2\" crossorigin=\"anonymous\">\r\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@4.5.3\/dist\/js\/bootstrap.bundle.min.js\" integrity=\"sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ\/JpcUGGOn+Y7RsweNrtN\/tE3MoK7ZeZDyx\" crossorigin=\"anonymous\"><\/script>\r\n\r\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"https:\/\/cdn.datatables.net\/v\/dt\/dt-1.13.1\/datatables.min.css\"\/>\r\n \r\n<script type=\"text\/javascript\" src=\"https:\/\/cdn.datatables.net\/v\/dt\/dt-1.13.1\/datatables.min.js\"><\/script>\r\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/cytoscape@3.24.0\/dist\/cytoscape.min.js\"><\/script>\r\n\r\n    <title>Gene Set Enrichment<\/title>\r\n<style>\r\n.site-content{\r\n    height: auto;\r\n}\r\n    \r\n    #divtable ,#divtable2 , #divtable3,#cydiv,#cydiv2{\r\n    background-color:white; \r\n                border-radius: 10px;\r\n                font-size:16px; \r\nwidth:auto;   \r\nmargin-top:2%;\r\n }\r\n \r\n\r\n #titletable{\r\n     margin-top:2%;\r\n  text-align:center;   \r\n }\r\n #selectdata h2{\r\n     display:inline; \r\n       text-align:center;   \r\n           font-size:2em;\r\n\r\n\r\n }\r\n #divtable h2 , #divtable2 h2 , #divtable3 h2 {\r\n    display:inline; \r\n }\r\n#divtable .dataTables_wrapper,\r\n#divtable2 .dataTables_wrapper ,\r\n#divtable3 .dataTables_wrapper{\r\n    width: 80%;\r\n    margin: 2%;\r\n    margin-left: 10%;\r\n        margin-right: 10%;\r\n    font-size:16px;\r\n}\r\n            .helpresult{\r\n        z-index: 999;\r\n        top: 100%;\r\n        left: 10%;\r\n        overflow: auto;\r\n        opacity: 1;\r\n    }\r\n           #divtable p , #divtable2 p {\r\n     color: black !important ;\r\n    }\r\n        .helpresult p , .helpresult h2{\r\n            font-size:0.9vw;\r\n        margin: 0;\r\n        margin-left:2%;\r\n        font-style:italic;\r\n        max-height: 100px;\r\n    }\r\n        .popover{\r\n                font-size: 2em;\r\n\r\n    }\r\n    #modaldesc , #modaldesc2 {\r\n\r\n\r\n  top: 10%;\r\n \r\n}\r\n.btn-secondary{\r\n            width:20%;\r\n        font-size:16px;\r\n        margin-left:10%;\r\n}\r\n\r\n.btn-primary {\r\n        width:10%;\r\n        font-size:16px;\r\n        margin-left:40%;\r\n        }\r\n\r\n\r\n    .btn-info{\r\n               width:auto;\r\n        font-size:16px;\r\n    float:right; \r\n    margin-right:20%;\r\n    }\r\n#cy {\r\n    height:600px;\r\n    width:90%;\r\n    clear:right;\r\n}\r\n#cy2 {\r\n    height:600px;\r\n    width:90%;\r\n    clear:right;\r\n}\r\n.npval{\r\n    width:15%;\r\n\r\n}\r\n\r\n<\/style>  \r\n\r\n<script>\r\n    <\/script>\r\n<\/head>\r\n<body>\r\n    <h1 style='text-align:center; text-transform: capitalize;'><\/h1>\r\n               <div id='divtable'>\r\n                    <div class=\"modal fade\" id=\"modaldesc\"  role=\"dialog\">\r\n  <div class=\"modal-dialog\">\r\n    <div class=\"modal-content\">\r\n      <div class=\"modal-header\">\r\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\r\n          <span aria-hidden=\"true\">&times;<\/span>\r\n        <\/button>\r\n      <\/div>\r\n      <div class=\"modal-body\">\r\n        <button type=\"button\" id='copy' class=\"btn btn-secondary\">copy\r\n         <img id=\"datahelpcopy\" class=\"help \"src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\"   width=\"15\" \/> \r\n         <\/button>\r\n        <button type=\"button\" id='tsv' class=\"btn btn-secondary\">TSV<\/button>\r\n        <button type=\"button\" id='csv' class=\"btn btn-secondary\">CSV<\/button>\r\n        \r\n                  <div class=\"helpresult\" id=\"helpcopy\"><\/div>\r\n\r\n      <\/div>\r\n    <\/div>\r\n  <\/div>\r\n<\/div>\r\n\r\n                    <br>\r\n                    \r\n<h1 id='titletable'>Overrepresentation Analysis Of Upregulated Genes<\/h1>\r\n<button type=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"#modaldesc\">\r\nDownload\r\n<\/button>\r\n\r\n<button type=\"button\" class=\"btn btn-info\" id='carouselnet'>\r\n                    <a href=\"#cydiv\" style=\"text-decoration: none;color:white\">Network<\/a>\r\n<\/button>\r\n<table id=\"table\" class=\"stripe\" style=\"width:100%\">\r\n<\/table>\r\n<\/div>\r\n\r\n\r\n\r\n\r\n\r\n                <div id='divtable2'>\r\n                                  <div class=\"modal fade\" id=\"modaldesc2\"  role=\"dialog\">\r\n  <div class=\"modal-dialog\">\r\n    <div class=\"modal-content\">\r\n      <div class=\"modal-header\">\r\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\r\n          <span aria-hidden=\"true\">&times;<\/span>\r\n        <\/button>\r\n      <\/div>\r\n      <div class=\"modal-body\">\r\n        <button type=\"button\" id='copy' class=\"btn btn-secondary\">copy\r\n         <img id=\"datahelpcopy2\" class=\"help \"src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\"   width=\"15\" \/> \r\n         <\/button>\r\n        <button type=\"button\" id='tsv' class=\"btn btn-secondary\">TSV<\/button>\r\n        <button type=\"button\" id='csv' class=\"btn btn-secondary\">CSV<\/button>\r\n        \r\n                  <div class=\"helpresult\" id=\"helpcopy2\"><\/div>\r\n\r\n      <\/div>\r\n    <\/div>\r\n  <\/div>\r\n<\/div>\r\n\r\n                    <br>\r\n\r\n<h1 id='titletable'>Overrepresentation Analysis Of Downregulated Genes<\/h1>\r\n                    <button type=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"#modaldesc2\">\r\nDownload\r\n<\/button>\r\n<button type=\"button\" class=\"btn btn-info\" id='carouselnet2'>\r\n                    <a href=\"#cydiv2\" style=\"text-decoration: none;color:white\">Network<\/a>\r\n<\/button>\r\n<table id=\"table1\" class=\"stripe\" style=\"width:100%\">\r\n<\/table>\r\n<\/div>\r\n\r\n        <div id=\"cydiv\">\r\n            <label for=\"inputRange\">Select a p-value:<\/label>\r\n    <input type=\"number\" id=\"inputRange\" name=\"inputRange\" min=\"0.05\" max=\"1\" step=\"0.01\" style=\"width: 20%;\" value=\"1\">\r\n        <button type=\"button\" class=\"btn btn-info\" id='carouselnet3'>\r\n                     <a href=\"#table\" style=\"text-decoration: none;color:white\">UPregulated<\/a>\r\n\r\n<\/button>\r\n    <div id=\"cy\">\r\n    <\/div>\r\n\r\n    <\/div>\r\n        <div id=\"cydiv2\">\r\n<label for=\"inputRange2\">Select a p-value:<\/label>\r\n    <input type=\"number\" id=\"inputRange2\" name=\"inputRange2\" min=\"0.05\" max=\"1\" step=\"0.01\" style=\"width: 20%;\" value=\"1\">\r\n                <button type=\"button\" class=\"btn btn-info\" id='carouselnet4'>\r\n                     <a href=\"#table1\" style=\"text-decoration: none;color:white\">DOWNregulated<\/a>\r\n<\/button>\r\n\r\n    <div id=\"cy2\">\r\n\r\n    <\/div>\r\n    <\/div>\r\n\r\n\r\n\r\n<script>\r\njQuery(document).ready(function($) {  \r\n    \/\/ Define variables and set hide values for css\r\n    $('#cy').hide();\r\n        $('#cy2').hide();\r\n$('.btn-info').hide();\r\n    var datanew= [];\r\n    var idmax;\r\n    var idmax2;\r\nvar nregis=10;\r\nvar type;\r\nvar datadescarga=[];\r\nvar datadescarga2=[];\r\nvar datanew2=[];\r\nvar pagesession=0;\r\nvar nregis2=10;\r\nvar pagesession2=0;\r\nvar arraynom = ['id', 'label','number_in_list','number_in_reference', 'expected', 'fold_enrichment', 'pValue', 'fdr'];\r\n\/\/var arrayreactome = [\"stId\", \"name\", \"llp\", \"entities.found\", \"entities.total\",\"entities.ratio\", \"entities.pValue\",\"entities.fdr\"];\r\nvar arrayreactome = [\"stId\", \"name\", \"llp\", \"found\", \"total\", \"pValue\",\"fdr\"];\r\nvar arraywiki = [\"Term\", \"Overlap\", \"P-value\", \"Adjusted P-value\", 'Odds',\"Ratio\", \"Combined Score\",\"Genes\"];\r\nvar arraywiki2 = [1,2,3,4,6,7,8,9];\r\nvar token = \"\";\r\n\r\nif(token==\"'wikipath'\"){\r\n    $('#cy').show();\r\n        $('#cy2').show();\r\n$('.btn-info').show();\r\n\r\nvar datos3= null;\r\n var datos4= null;\r\n}else{\r\n    var datos= ;\r\n    var datos2= ;\r\n}\r\nvar database = \"\";\r\n\/\/ Checks that enrichment was done and if it worked well\r\n\/\/+ execution of functions to fill the tables and configure their fields\r\n\r\nif(token==\"'typetoken'\"){\r\n    type=1;\r\n    \r\nparseardata2(datos,1);\r\nparseardata2(datos2,2);\r\n\r\n\r\ndatatable=[];\r\n    for (let index = 0; index < datos.length; index++) {\r\n    datatable[index]=[];\r\nfor (var j =0; j < arrayreactome.length; j++){ \r\n    if(j>2){\r\n            datatable[index].push(round(datos[index]['entities'][arrayreactome[j]]));\r\n\r\n    }else {\r\n    datatable[index].push(datos[index][arrayreactome[j]]);\r\n}\r\n}\r\n}\r\nfundatadescarga();\r\ntable = $('#table').DataTable({\r\n        data: datatable,\r\n          \"scrollX\": true ,\r\n\r\n        columns: [\r\n                    { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Click on the word to go to the original information source'> Stable Identifier <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" ,\r\n            \"render\": function (data, type, row) {\r\n                    return '<a href=\"https:\/\/reactome.org\/content\/detail\/' + data + '\" target=\"no_blank\">' + data + '<\/a>';\r\n                }\r\n                \r\n            },\r\n            { title: \"Name pathway\" },\r\n            { title: \"llp\" },\r\n            { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Genes in the top up list from FooDrugs'> Genes in list pathway <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" },\r\n            { title: \"Genes in Reactome\" },\r\n            { title: \"pValue\" },\r\n            { title: \"FDR\" },\r\n           \r\n           \r\n        ],\r\n                 language: {\r\n        \"lengthMenu\": '<h2> Show entries <\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpentries\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>   <div class=\"helpresult\" id=\"helpentries\"><\/div> _MENU_' ,\r\n    \"search\": ' <h2> Filter Records<\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpfilter\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>  <div class=\"helpresult\" id=\"helpfilter\"><\/div> _INPUT_' \r\n    },\r\n    });\r\n    \r\n    \r\n    datatable2=[];\r\n    for (let index = 0; index < datos2.length; index++) {\r\n    datatable2[index]=[];\r\nfor (var j =0; j < arrayreactome.length; j++){ \r\n    if(j>2){\r\n            datatable2[index].push(round(datos2[index]['entities'][arrayreactome[j]]));\r\n\r\n    }else {\r\n    datatable2[index].push(datos2[index][arrayreactome[j]]);\r\n}\r\n}\r\n}\r\ntable1 = $('#table1').DataTable({\r\n        data: datatable2,\r\n          \"scrollX\": true ,\r\n\r\n        columns: [\r\n                                { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Click on the word to go to the original information source'> Stable Identifier <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" ,\r\n            \"render\": function (data, type, row) {\r\n                    return '<a href=\"https:\/\/reactome.org\/content\/detail\/' + data + '\" target=\"no_blank\">' + data + '<\/a>';\r\n                }\r\n                \r\n            },\r\n            { title: \"Name pathway\" },\r\n            { title: \"llp\" },\r\n            { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Genes in the top up list from FooDrugs'> Genes in list pathway <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" },\r\n            { title: \"Genes in Reactome\" },\r\n            { title: \"pValue\" },\r\n            { title: \"FDR\" },\r\n           \r\n           \r\n           \r\n           \r\n        ],\r\n                 language: {\r\n        \"lengthMenu\": '<h2> Show entries <\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpentries2\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>   <div class=\"helpresult\" id=\"helpentries2\"><\/div> _MENU_' ,\r\n    \"search\": ' <h2> Filter Records<\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpfilter2\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>  <div class=\"helpresult\" id=\"helpfilter2\"><\/div> _INPUT_' \r\n    },\r\n    });\r\n    \r\n    \r\n     $('[data-toggle=\"popover\"]').popover({\r\n    'trigger': 'hover',\r\n});\r\n}else if(token==\"'wikipath'\"){\r\n    \r\ntype=3;\r\ndatos=datos3;\r\ndatos2=datos4;\r\n    parseardata3(datos,1);\r\n    parseardata3(datos2,2);\r\ndatatable=[];\r\nvar arraywiki2 = [1,2,3,4,6,7,8,9];\r\nvar idpos;\r\nvar idwp ;\r\nvar numero= [];\r\nvar datatable3=[];\r\n\r\n    for (let index = 0; index < datos.length; index++) {\r\n datatable3[index]=[];    \r\n datatable[index]=[];\r\nfor (var j =0; j < arraywiki2.length; j++){ \r\n    posarray=parseInt(arraywiki2[j]);\r\n    if(j==0)\r\n    {\r\n         idpos= (datos[index][posarray]).search('WP');\r\n        idwp = (datos[index][posarray].substring(idpos))\r\n\r\n            datatable[index]['id']=(idwp);\r\n            \r\n    }else {\r\n         if(j==7){\r\n            var genid=(datos[index][posarray]);\r\n            if(genid.search(';')){\r\n            var xarray =genid.split(';');\r\n            for (let indexgen = 0; indexgen < xarray.length; indexgen++) {\r\n                if(!numero.find(element => element === xarray[indexgen])){\r\n                    numero.push(xarray[indexgen]);\r\n            }\r\n            }\r\n            }\r\n             \r\n         }\r\n                datatable[index].push(datos[index][posarray]);\r\n    \r\n    }\r\n    datatable3[index].push(datos[index][posarray]);\r\n}\r\n}\r\n  table = $('#table').DataTable({\r\n        data: datatable3,\r\n          \"scrollX\": true ,\r\n        columns: [\r\n                        { title: \"Term\" ,\r\n                     \"render\": function (data, type, row) {\r\n                         let x=data.search('WP');\r\n                         var wpx = data.substring(x);\r\n                    return '<a href=\"https:\/\/www.wikipathways.org\/pathways\/' + wpx + '\" target=\"no_blank\">' + data + '<\/a>';\r\n                }\r\n            },\r\n            { title: \"Overlap\" },\r\n            { title: \"P-value\",\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n            { title: \"Adjusted P-value\" ,\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n              { title: \"Odds\" },\r\n            { title: \"Ratio\",\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n            { title: \"Combined Score\",\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n            { title: \"Genes\" }\r\n            ],\r\n                 language: {\r\n        \"lengthMenu\": '<h2> Show entries <\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpentries\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>   <div class=\"helpresult\" id=\"helpentries\"><\/div> _MENU_' ,\r\n    \"search\": ' <h2> Filter Records<\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpfilter\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>  <div class=\"helpresult\" id=\"helpfilter\"><\/div> _INPUT_' \r\n    },\r\n    });\r\n    \r\n\r\n        network(1);\r\n\r\n    datatable2=[];\r\n\r\nvar numero2= [];\r\nvar datatable4=[];\r\n\r\n    for (let index = 0; index < datos2.length; index++) {\r\n datatable4[index]=[];    \r\n datatable2[index]=[];\r\nfor (var j =0; j < arraywiki2.length; j++){ \r\n    posarray=parseInt(arraywiki2[j]);\r\n    if(j==0)\r\n    {\r\n         idpos= (datos2[index][posarray]).search('WP');\r\n        idwp = (datos2[index][posarray].substring(idpos))\r\n\r\n            datatable2[index]['id']=(idwp);\r\n            \r\n    }else {\r\n         if(j==7){\r\n            var genid=(datos2[index][posarray]);\r\n            if(genid.search(';')){\r\n            var xarray =genid.split(';');\r\n            for (let indexgen = 0; indexgen < xarray.length; indexgen++) {\r\n                if(!numero2.find(element => element === xarray[indexgen])){\r\n                    numero2.push(xarray[indexgen]);\r\n            }\r\n            }\r\n            }\r\n             \r\n         }\r\n                datatable2[index].push(datos2[index][posarray]);\r\n    \r\n    }\r\n    datatable4[index].push(datos2[index][posarray]);\r\n}\r\n}\r\n\r\n\r\n\r\n\r\n    table2 = $('#table1').DataTable({\r\n        data: datatable4,\r\n          \"scrollX\": true ,\r\n        columns: [\r\n            { title: \"Term\" ,\r\n                     \"render\": function (data, type, row) {\r\n                         let x=data.search('WP');\r\n                         var wpx = data.substring(x);\r\n                    return '<a href=\"https:\/\/www.wikipathways.org\/pathways\/' + wpx + '\" target=\"no_blank\">' + data + '<\/a>';\r\n                }\r\n            },\r\n            { title: \"Overlap\" },\r\n            { title: \"P-value\",\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n            { title: \"Adjusted P-value\" ,\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n              { title: \"Odds\" },\r\n            { title: \"Ratio\",\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n            { title: \"Combined Score\",\r\n             \"render\": function (data, type, row) {\r\n                    return round(data);\r\n                }},\r\n            { title: \"Genes\" }\r\n            ],\r\n                 language: {\r\n        \"lengthMenu\": '<h2> Show entries <\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpentries2\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>   <div class=\"helpresult\" id=\"helpentries\"><\/div> _MENU_' ,\r\n    \"search\": ' <h2> Filter Records<\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpfilter2\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>  <div class=\"helpresult\" id=\"helpfilter\"><\/div> _INPUT_' \r\n    },\r\n    });  \r\nnetwork2(1);\r\n\r\n}\r\n\r\nelse{\r\n    type=2;\r\nparseardata(datos,1);\r\nparseardata(datos2,2);\r\ndatatable=[];\r\n\r\n\r\n    for (let index = 0; index < datos.length; index++) {\r\n    datatable[index]=[];\r\nfor (var j =0; j < arraynom.length; j++){ \r\n    if(j<2){\r\n                    if(datos[index]['term']['label']=='UNCLASSIFIED'){\r\n                                        datatable[index].push('UNDEFINED');\r\n                                                    datatable[index].push(datos[index]['term'][arraynom[j+1]]);\r\n                                                    j++\r\n        }else {\r\n            datatable[index].push(datos[index]['term'][arraynom[j]]);\r\n}\r\n    }else {\r\n    datatable[index].push(round(datos[index][arraynom[j]]));\r\n}\r\n}\r\n}\r\n\r\n\r\n\r\n\r\n\r\n  table = $('#table').DataTable({\r\n        data: datatable,\r\n          \"scrollX\": true ,\r\n          \r\n        columns: [\r\n                                     { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Click on the word to go to the original information source'> Term ID <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" ,\r\n            \"render\": function (data, type, row) {\r\n                    return '<a href=\"https:\/\/www.ebi.ac.uk\/QuickGO\/term\/' + data + '\" target=\"no_blank\">' + data + '<\/a>';\r\n                }\r\n                \r\n            },\r\n            { title: \"term\" , \"width\": \"20%\" },\r\n                        { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Genes in the top up list from FooDrugs'> Genes in list  <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" },\r\n\r\n            { title: \"Genes in GO term\" },\r\n            { title: \"Genes expected\" },\r\n            { title: \" Fold-Enrichmen\" },\r\n            { title: \"P-value\" },\r\n            { title: \"FDR\" },\r\n           \r\n           \r\n        ],\r\n                 language: {\r\n        \"lengthMenu\": '<h2> Show entries <\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpentries\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>   <div class=\"helpresult\" id=\"helpentries\"><\/div> _MENU_' ,\r\n    \"search\": ' <h2> Filter Records<\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpfilter\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>  <div class=\"helpresult\" id=\"helpfilter\"><\/div> _INPUT_' \r\n    },\r\n    });\r\n    \r\n    datatable2=[];\r\n    for (let index = 0; index < datos2.length; index++) {\r\n    datatable2[index]=[];\r\nfor (var j =0; j < arraynom.length; j++){ \r\n    if(j<2){\r\n                    if(datos2[index]['term']['label']=='UNCLASSIFIED'){\r\n                                        datatable2[index].push('UNDEFINED');\r\n                                                    datatable2[index].push(datos2[index]['term'][arraynom[j+1]]);\r\n                                                    j++\r\n        }else {\r\n            datatable2[index].push(datos2[index]['term'][arraynom[j]]);\r\n}\r\n    }else {\r\n    datatable2[index].push(round(datos2[index][arraynom[j]]));\r\n}\r\n}\r\n}\r\n  table1 = $('#table1').DataTable({\r\n        data: datatable2,\r\n          \"scrollX\": true ,\r\n\r\n        columns: [\r\n                                     { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Click on the word to go to the original information source'> Term ID <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" ,\r\n            \"render\": function (data, type, row) {\r\n                    return '<a href=\"https:\/\/www.ebi.ac.uk\/QuickGO\/term\/' + data + '\" target=\"no_blank\">' + data + '<\/a>';\r\n                }\r\n                \r\n            },\r\n            { title: \"term\" , \"width\": \"20%\" },\r\n                        { title: \"<span  id='tablepopover' tabindex='0' data-toggle='popover' data-content='Genes in the top down list from FooDrugs'> Genes in list  <img  src='http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png'   width='15' \/> <\/span>\" },\r\n\r\n            { title: \"Genes in GO term\" },\r\n            { title: \"Genes expected\" },\r\n            { title: \" Fold-Enrichmen\" },\r\n            { title: \"P-value\" },\r\n            { title: \"FDR\" },\r\n           \r\n           \r\n        ],\r\n                 language: {\r\n        \"lengthMenu\": '<h2> Show entries <\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpentries2\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>   <div class=\"helpresult\" id=\"helpentries2\"><\/div> _MENU_' ,\r\n    \"search\": ' <h2> Filter Records<\/h2> <img decoding=\"async\" class=\"help\" id=\"datahelpfilter2\" src=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/06\/icon1.png\" width=\"15\"><\/img>  <div class=\"helpresult\" id=\"helpfilter2\"><\/div> _INPUT_' \r\n    },\r\n    });\r\n    \r\n    \r\n    \r\n    \r\n    \r\n    \r\n    $('[data-toggle=\"popover\"]').popover({\r\n    'trigger': 'hover',\r\n});\r\n\r\n}\r\nfundatadescarga();\r\n\r\n\/\/Search event in a the table 'tablebusqueda1' and 'tablabusqueda2'\r\n\/\/--->\r\n\/\/<---\r\n\/\/Events when clicking on the img of the header, of any of the two tables\r\n\/\/This event executes and obtains the row to later order it in the function\r\n\/\/ It happens that if it is ascending or descending and the field of the array\r\n\/\/--->\r\n\r\n\/\/Function ordenar\r\n\/\/idcabezera = section of the json contained by the array which will be the criteria for ordering\r\n\/\/ imgorder = descending or ascending\r\n\/\/ data = array which is gonna be sort\r\n\/\/ x = which enrichment was done\r\n\r\n\r\n\/\/Function cabezera\r\n\/\/ Used to change the headers of the table if the enrichment is with reactome\r\n\/\/Functions parseardata\r\n\/\/ They serve to fix the data since it is in json format with and we get the relevant one from one of the fields of this json\r\n\/\/--->\r\nfunction parseardata2(p,a){\r\nvar x=[];\r\nfor (let i = 0; i <= p.pathways.length-1; i++) {\r\n    x[i]=(p.pathways[i]);\r\n}\r\n\r\nif (a==1) {\r\n    datos=x;\r\n    datanew=x;\r\n}else {\r\ndatos2=x;\r\ndatanew2=datos2;\r\n}\r\nreturn x;\r\n}\r\n\r\nfunction parseardata(p,a){\r\nvar x=[];\r\nfor (let i = 0; i <= p.results.result.length-1; i++) {\r\n    x[i]=(p.results.result[i]);\r\n}\r\nif (a==1) {\r\n    datos=x;\r\n    datanew=x;\r\n}else {\r\ndatos2=x;\r\ndatanew2=datos2;\r\n}\r\nconsole.log(datos2.length);\r\n}\r\n\r\nfunction parseardata3(p,a){\r\nvar x=[];\r\np=p.split('\\n');\r\nfor (let i = 1; i < p.length ;i++) {\r\n    if(p[i]!='undefined' && p[i]!=''){\r\n            x[i-1]=[];\r\n    x[i-1]=(p[i].split('\\t'));\r\n}\r\n}\r\nif (a==1) {\r\n    datos=x;\r\n    datanew=x;\r\n}else {\r\ndatos2=x;\r\ndatanew2=datos2;\r\n}\r\n}\r\n\r\n\r\n\r\n\r\n$(document).on(\"mouseenter\", \".help\", function(){\r\n$(\".helpresult\").empty();\r\nvar idhelp = $(this).attr(\"id\");\r\nif (idhelp==\"datahelpentries\") {\r\n            $(\"#helpentries\").append(\"<p>Allow you to filter the number of studies to display<\/p>\");\r\n                    \r\n}   \r\nelse if (idhelp==\"datahelpfilter\") {\r\n            $(\"#helpfilter\").append(\"<p>Allow you to filter with free text on the table by any field<\/p>\");\r\n                    \r\n} else if (idhelp==\"datahelpentries2\") {\r\n            $(\"#helpentries2\").append(\"<p>Allow you to filter the number of studies to display<\/p>\");\r\n                    \r\n}   \r\nelse if (idhelp==\"datahelpfilter2\") {\r\n            $(\"#helpfilter2\").append(\"<p>Allow you to filter with free text on the table by any field<\/p>\");\r\n                    \r\n}else if (idhelp==\"datahelpentries3\") {\r\n            $(\"#helpentries3\").append(\"<p>Allow you to filter the number of studies to display<\/p>\");\r\n                    \r\n}   \r\nelse if (idhelp==\"datahelpfilter3\") {\r\n            $(\"#helpfilter3\").append(\"<p>Allow you to filter with free text on the table by any field<\/p>\");\r\n                    \r\n}\r\nelse if(idhelp==\"datahelpenrich\"){\r\n                $(\"#helpenrich\").append(\"<p>Explore food-drug interactions found by text mining scientific and medical databases. Links to where you can find the original texts are available for further consultation. Feedback is appreciated.<\/p>\");\r\n\r\n}else if (idhelp==\"datahelpcopy\"){\r\n                $(\"#helpcopy\").append(\"<p>Allow to copy the information on the clipboard<\/p>\");\r\n\r\n}else if (idhelp==\"datahelpcopy2\"){\r\n                $(\"#helpcopy2\").append(\"<p>Allow to copy the information on the clipboard<\/p>\");\r\n\r\n}\r\n\r\n\r\n\r\n\r\n});\r\n\r\n $(document).on(\"mouseleave\", \".help\", function(){\r\n    $(\".helpresult\").empty();\r\n        });\r\n\/\/<---\r\n\/\/ Function selectregis and selectnregis 2 where the select is created that is responsible for displaying x rows of the array\r\n\/\/--->\r\n\r\n\r\n\/\/ Function pagination and pagination2 where the page change buttons are created, their maximum length is conditioned by the number of records\r\n\/\/displayed at the same time on the same page\r\n\/\/--->\r\n\r\n\/\/<---\r\n\r\n        \r\n\/\/ Click events change page\r\n\/\/--->\r\n              $(document).on('click', '.pagination_link1', function() { \r\n                    \/\/If it is next or back, the button pressed will be removed or added to the pagecarousel, otherwise it will be replaced by the value of page\r\n        var page = $(this).attr(\"id\");\r\n        if(page==\"tNext\"){\r\n            page = pagesession2+1;            \r\n        }else if(page==\"tBack\"){\r\n            page = pagesession2-1;   \r\n        }else {\r\n            page = page.substr(5);\r\n            page=parseInt(page);\r\n        }\r\n        pagesession2=page;\r\n        load_data2(page);\r\n      }); \r\n  $(document).on('click', '.pagination_link', function() { \r\n        page = $(this).attr(\"id\");\r\n        $(this).hide();\r\n        if(page==\"Next\"){\r\n            page = pagesession+1;            \r\n        }else if(page==\"Back\"){\r\n            page = pagesession-1;   \r\n        }else {\r\n            page = parseInt($(this).text()-1);\r\n        }\r\n        pagesession=page;\r\n        load_data(page);\r\n      }); \r\n\/\/<---\r\n\r\n\r\n\/\/Function load_data and load_data2 are used to load the information to the tables shown on the page a is equal to the current page\r\n\r\n\/\/<---\r\n\r\n\/\/Function fundatadescarga\r\n\/\/ Function elaborated to parse the data so that when downloading they have the format requested in the script\r\n\/\/file download, what this function is in charge of is depending on the enrichment it will do a parse or another\r\n\/\/having in common removing the fields with the relevant information from the json and storing it in a new array\r\nfunction fundatadescarga() {\r\n\r\n                if(type==2){\r\n        for( var i = 0; i<datos.length; i++){\r\n            var dats = datos[i];\r\n            datadescarga[i]={};\r\n            for (let j = 0; j< arraynom.length; j++) {\r\n                datadescarga[i][arraynom[j]]=[];\r\n                if (arraynom[j]==\"term\") {\r\n                    datadescarga[i][arraynom[j]]=dats[arraynom[j]].label;   \r\n                }else if(arraynom[j]==\"term_id\"){\r\n                    datadescarga[i][arraynom[j]]=dats[\"term\"].id;    \r\n                }else {\r\n                    datadescarga[i][arraynom[j]] = dats[arraynom[j]];\r\n                  \r\n                }    \r\n            }\r\n            }\r\n\r\n\r\n                    for( var i = 0; i<datos2.length; i++){\r\n            var dats = datos2[i];\r\n            datadescarga2[i]={};\r\n            for (let j = 0; j< arraynom.length; j++) {\r\n                datadescarga2[i][arraynom[j]]=[];\r\n                if (arraynom[j]==\"term\") {\r\n                    datadescarga2[i][arraynom[j]]=dats[arraynom[j]].label;   \r\n                }else if(arraynom[j]==\"term_id\"){\r\n                    datadescarga2[i][arraynom[j]]=dats[\"term\"].id;    \r\n                }else {\r\n                    datadescarga2[i][arraynom[j]] = dats[arraynom[j]];\r\n                  \r\n                }    \r\n            }\r\n            }\r\n        \r\n            }else if(type==1) {\r\n    \r\n         for( var i = 0; i<datos.length; i++){\r\n            var dats = datos[i];\r\n            datadescarga[i]={};\r\n            for (let j = 0; j< arrayreactome.length; j++) {\r\n                \r\n                datadescarga[i][arrayreactome[j]]=[];\r\n                    if(j>2){\r\n                        datadescarga[i][arrayreactome[j]] = dats[\"entities\"][arrayreactome[j]]\r\n\r\n                }else {\r\n               datadescarga[i][arrayreactome[j]] = dats[arrayreactome[j]]  \r\n            }\r\n            }\r\n        }\r\n\r\n                 for( var i = 0; i<datos2.length; i++){\r\n            var dats = datos2[i];\r\n            datadescarga2[i]={};\r\n            for (let j = 0; j< arrayreactome.length; j++) {\r\n                 datadescarga2[i][arrayreactome[j]]=[];\r\n                    if(j>2){\r\n                        datadescarga2[i][arrayreactome[j]] = dats[\"entities\"][arrayreactome[j]]\r\n\r\n                }else {\r\n               datadescarga2[i][arrayreactome[j]] = dats[arrayreactome[j]]  \r\n            }\r\n            }\r\n        }\r\n}else if (type==3){\r\n\r\n}\r\n}\r\n\r\n\r\n\r\n\r\n $(\".npval\").keyup(function() {\r\n                \/\/ Accede al valor del campo de entrada cuando cambie\r\n                var numberDecimal = $(this).val();\r\n                if(numberDecimal != ''){\r\n                    if(numberDecimal > 1){\r\n                        numberDecimal=1;\r\n                    }else if (numberDecimal<0){\r\n                        numberDecimal=0;\r\n                    }\r\n                    console.log(numberDecimal)\r\n                }\r\n            });\r\n\r\n\/\/ Download Event \r\n\/\/--->\r\n\r\n$(document).on('click', '#modaldesc .btn-secondary', function() {\r\n        \/\/Get the page where you are and what type of download it is\r\n           var subid= $(this).attr(\"id\");\r\n                        \/\/Copy with the obtained data, with this it is added to an input and the copy command is executed later the input is deleted\r\n            \/\/ With this is on the clipboard\r\n            if (subid == \"copy\" ) {\r\n                                    dataacopiar=[];\r\n                copy=\"\";\r\n                                         for (let i = 0; i < datadescarga.length || i  < 10 ; i++) {\r\n                                dataacopiar[i]={};\r\n            for (var  dato in datadescarga[i]){\r\n                \r\n                if(datadescarga[i][dato]!=undefined){\r\n                     copy=copy+dato;\r\n            copy=copy+datadescarga[i][dato];\r\n                    \r\n                }\r\n\r\n}\r\n                    $('<input id=\"textcopy\">').val(copy).appendTo('body').select();         \r\n            document.execCommand('copy'); \r\n            var el = document.getElementById('textcopy');\r\n            el.remove();\r\n            }\r\n                    }                \/\/TSV OR CSV the file is sent to descargararchivo.php and the associative array is sent\r\n            else {\r\n                                if(type==3){\r\n                $.ajax({\r\n            url:'https:\/\/imdeafoodcompubio.com\/wp-content\/themes\/bento-child\/descargararchivo.php',\r\n            type: 'post',\r\n            data: {key:subid,data:datos2,name:\"tablagendnenrichment\"+database,arrkeys:arraywiki},\r\n            dataType: 'json',\r\n            success:function(response){\r\n                fileName=response;\r\n                       fileUrl=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/desc\/\"+fileName;\r\n  var a = document.createElement(\"a\");\r\n  a.href = fileUrl;\r\n  console.log(fileUrl);\r\n  a.setAttribute(\"download\", fileName);\r\n  a.click();\r\n            }\r\n                });\r\n            \r\n                }else {\r\n                $.ajax({\r\n            url:'https:\/\/imdeafoodcompubio.com\/wp-content\/themes\/bento-child\/descargararchivo.php',\r\n            type: 'post',\r\n            \r\n            data: {key:subid,data:datadescarga,name:\"tablagenupenrichment\"+database},\r\n            dataType: 'json',\r\n            success:function(response){\r\n                       \/\/Get the name of the file which is on the response and create an element <a> and add the attribute\r\n                \/\/'download'  and indicate where the file is located and order the element to be clicked\r\n                \/\/and start the download\r\n                fileName=response;\r\n                        fileUrl=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/desc\/\"+fileName;\r\n  var a = document.createElement(\"a\");\r\n  a.href = fileUrl;\r\n\r\n  a.setAttribute(\"download\", fileName);\r\n  a.click();\r\n            }\r\n                });\r\n                }\r\n            }\r\n\r\n            \r\n});\r\n            \r\n            \r\n            \r\n            \r\n            \r\n$(document).on('click', '#modaldesc2 .btn-secondary', function() {\r\n var subid= $(this).attr(\"id\");\r\n            if (subid == \"copy\" ) {\r\n                    dataacopiar=[];\r\n                copy=\"\";\r\n                                         for (let i = 0; i < datadescarga2.length || i  < 10 ; i++) {\r\n                                dataacopiar[i]={};\r\n            for (var  dato in datadescarga2[i]){\r\n                \r\n                if(datadescarga2[i][dato]!=undefined){\r\n                     copy=copy+dato;\r\n            copy=copy+datadescarga2[i][dato];\r\n                    \r\n                }\r\n\r\n}\r\n}\r\n                    $('<input id=\"textcopy\">').val(copy).appendTo('body').select();         \r\n            document.execCommand('copy'); \r\n            var el = document.getElementById('textcopy');\r\n            el.remove();\r\n            }\r\n            else {\r\n                if(type==3){\r\n                $.ajax({\r\n            url:'https:\/\/imdeafoodcompubio.com\/wp-content\/themes\/bento-child\/descargararchivo.php',\r\n            type: 'post',\r\n            data: {key:subid,data:datos2,name:\"tablagendnenrichment\"+database,arrkeys:arraywiki},\r\n            dataType: 'json',\r\n            success:function(response){\r\n                fileName=response;\r\n                       fileUrl=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/desc\/\"+fileName;\r\n  var a = document.createElement(\"a\");\r\n  a.href = fileUrl;\r\n  console.log(fileUrl);\r\n  a.setAttribute(\"download\", fileName);\r\n  a.click();\r\n            }\r\n                });\r\n            \r\n                }else {\r\n                $.ajax({\r\n            url:'https:\/\/imdeafoodcompubio.com\/wp-content\/themes\/bento-child\/descargararchivo.php',\r\n            type: 'post',\r\n            data: {key:subid,data:datadescarga2,name:\"tablagendnenrichment\"+database},\r\n            dataType: 'json',\r\n            success:function(response){\r\n                \r\n                fileName=response;\r\n                        fileUrl=\"http:\/\/imdeafoodcompubio.com\/wp-content\/uploads\/2022\/desc\/\"+fileName;\r\n  var a = document.createElement(\"a\");\r\n  a.href = fileUrl;\r\n  \r\n  a.setAttribute(\"download\", fileName);\r\n  a.click();\r\n            }\r\n                });\r\n                    \r\n                }\r\n            }\r\n            \r\n            });\r\n\r\n\/\/<---\r\n const inputRange = $('#inputRange');\r\n\r\n  inputRange.on('input', function() {\r\n    const currentValue = parseFloat($(this).val());\r\n    const maxValue = 1.0;\r\n    if (currentValue > maxValue) {\r\n      $(this).val(maxValue);\r\n      currentValue=maxValue;\r\n    }\r\n    network(currentValue);\r\n  });\r\n  \r\n   const inputRange2 = $('#inputRange2');\r\n\r\n  inputRange2.on('input', function() {\r\n    const currentValue = parseFloat($(this).val());\r\n    const maxValue = 1.0;\r\n    if (currentValue > maxValue) {\r\n      $(this).val(maxValue);\r\n      currentValue=maxValue;\r\n    }\r\n    network2(currentValue);\r\n  });\r\n\/\/Function round\r\n\/\/Number truncation leaving it in 3 decimal places\r\n\r\nfunction round(num) {\r\n    var m = Number((Math.abs(num) * 1000).toPrecision(15));\r\n    return Math.round(m) \/ 1000 * Math.sign(num);\r\n}\r\n\r\nfunction network(pvalue){\r\n    nodes = [];\r\nedges=[];\r\ndatatable=[];\r\nnumero=[];\r\nfor (let index = 0; index < datos.length; index++) {\r\n datatable[index]=[];\r\n if (round(datos[index][3]) <= pvalue) {\r\n\r\n for (var j =0; j < arraywiki2.length; j++){\r\n        \r\n    posarray=parseInt(arraywiki2[j]);\r\n    if(j==0)\r\n    {\r\n         idpos= (datos[index][posarray]).search('WP');\r\n        idwp = (datos[index][posarray].substring(idpos))\r\n            datatable[index]['label']=datos[index][posarray];\r\n            datatable[index]['id']=(idwp);\r\n            \r\n    }else {\r\n         if(j==7){\r\n            var genid=(datos[index][posarray]);\r\n            if(genid.search(';')){\r\n            var xarray =genid.split(';');\r\n            for (let indexgen = 0; indexgen < xarray.length; indexgen++) {\r\n                if(!numero.find(element => element === xarray[indexgen])){\r\n                    numero.push(xarray[indexgen]);\r\n            }\r\n            }\r\n            }\r\n             \r\n         }\r\n                datatable[index].push(datos[index][posarray]);\r\n    \r\n    }\r\n}\r\n}\r\n}\r\n\r\nnumero.forEach(element => {\r\n    \r\n   var currentNode = {\r\n    data: {\r\n      id: element,\r\n      label: element,\r\n      size: 50,\r\n        shape:'diamond',\r\n        color:'blue'\r\n\r\n    }\r\n   };\r\n     nodes.push(currentNode);\r\n\r\n});\r\n\r\n\r\ndatatable.forEach(element => {\r\n    if(round(element[1])<= pvalue){\r\n\r\n             posi= element[0].search('\/');\r\n        tama = element[0].substring(0,posi);\r\n  var currentNode = {\r\n    data: {\r\n      id: element['id'],\r\n      label: element['id'],\r\n      label2: element['label'],\r\n      size: parseFloat(tama*20),\r\n      gene:element[6],\r\n        shape:'ellipse',\r\n        color:'green'\r\n\r\n    }\r\n  };\r\n\r\n  nodes.push(currentNode);\r\n  \r\n\r\n  \r\nvar targetNodes = nodes.filter(node => element[6].includes(node.data.id));\r\ntargetNodes.forEach(function(nodetarget) {\r\n  if (nodetarget && nodetarget!=currentNode) {\r\n    edges.push({\r\n      data: {\r\n        source: currentNode.data.id,\r\n        target: nodetarget.data.id\r\n      }\r\n    });\r\n  }\r\n}); \r\n    }\r\n});\r\n\r\n\r\n\r\nvar cyOptions = {\r\n          container: document.getElementById(\"cy\"),\r\n          layout: { name: \"circle\" },\r\n          style: [\r\n            {\r\n              selector: \"node\",\r\n              style: {\r\n                \"background-color\": \"data(color)\",\r\n                label: \"data(label)\",\r\n    \"width\": 'mapData(size, 20, 60, 20, 60)',\r\n    \"height\":'mapData(size, 20, 60, 20, 60)',\r\n                shape: \"data(shape)\",\r\n                  \r\n              }\r\n            },\r\n            {\r\n              selector: \"edge\",\r\n              style: {\r\n                width: 3,\r\n                \"line-color\": \"#ccc\"\r\n              }\r\n            }\r\n          ],\r\n          elements: {\r\n            nodes: nodes,\r\n            edges:edges\r\n          }\r\n        };\r\n\r\n        \/\/ Crear el gr\u00e1fico de Cytoscape\r\n\r\n        var cy = cytoscape(cyOptions);\r\n        \r\n            cy.on('mouseover', 'node', function(event) {\r\n       if(event.target._private.data.color=='green'){\r\n    event.target.css('content', event.target._private.data.label2);\r\n           }\r\n    });\r\n        cy.on('mouseout', 'node', function(event) {\r\n       if(event.target._private.data.color=='green'){\r\n    event.target.css('content', event.target._private.data.label);\r\n           }\r\n    });\r\n        \r\n        \r\n        \r\n        cy.on('click', 'node', function(event) {\r\n       if(event.target._private.data.color=='green'){\r\n        window.open(\"https:\/\/www.wikipathways.org\/pathways\/\"+event.target._private.data.id, \"_blank\");\r\n       }\r\n    });\r\n    \r\n    \r\n    \r\n    \r\n}\r\nfunction network2(pvalue){\r\n\r\n    nodes2 = [];\r\nedges2=[];\r\ndatatable2=[];\r\nnumero2=[];\r\nfor (let index = 0; index < datos2.length; index++) {\r\n datatable2[index]=[];\r\n if (round(datos2[index][3]) <= pvalue) {\r\nfor (var j =0; j < arraywiki2.length; j++){\r\n     \r\n    posarray=parseInt(arraywiki2[j]);\r\n    if(j==0)\r\n    {\r\n         idpos= (datos2[index][posarray]).search('WP');\r\n        idwp = (datos2[index][posarray].substring(idpos))\r\n            datatable2[index]['label']=datos2[index][posarray];\r\n            datatable2[index]['id']=(idwp);\r\n            \r\n    }else {\r\n         if(j==7){\r\n            var genid=(datos2[index][posarray]);\r\n            if(genid.search(';')){\r\n            var xarray =genid.split(';');\r\n            for (let indexgen = 0; indexgen < xarray.length; indexgen++) {\r\n                if(!numero2.find(element => element === xarray[indexgen])){\r\n                    numero2.push(xarray[indexgen]);\r\n            }\r\n            }\r\n            }\r\n             \r\n         }\r\n                datatable2[index].push(datos2[index][posarray]);\r\n    \r\n    }\r\n    datatable4[index].push(datos2[index][posarray]);\r\n}\r\n }\r\n}\r\n\r\n\r\n\r\nnumero2.forEach(element => {\r\n\r\n   var currentNode = {\r\n    data: {\r\n      id: element,\r\n      label: element,\r\n      size: 50,\r\n        shape:'diamond',\r\n        color:'blue'\r\n\r\n    }\r\n   };\r\n     nodes2.push(currentNode);\r\n\r\n});\r\n\r\n\r\ndatatable2.forEach(element => {\r\n    if(round(element[1])<= pvalue){\r\n             posi= element[0].search('\/');\r\n        tama = element[0].substring(0,posi);\r\n  var currentNode = {\r\n    data: {\r\n      id: element['id'],\r\n      label: element['id'],\r\n      label2 : element['label'],\r\n      size: parseFloat(tama*20),\r\n      gene:element[6],\r\n        shape:'ellipse',\r\n        color:'green'\r\n\r\n    }\r\n  \r\n  };\r\n\r\n  nodes2.push(currentNode);\r\n  \r\nvar targetNodes = nodes2.filter(node => element[6].includes(node.data.id));\r\ntargetNodes.forEach(function(nodetarget) {\r\n  if (nodetarget && nodetarget!=currentNode) {\r\n    edges2.push({\r\n      data: {\r\n        source: currentNode.data.id,\r\n        target: nodetarget.data.id\r\n      }\r\n    });\r\n  }\r\n}); \r\n}\r\n});\r\n\r\n\r\n\r\nvar cyOptions2 = {\r\n          container: document.getElementById(\"cy2\"),\r\n          layout: { name: \"circle\" },\r\n          style: [\r\n            {\r\n              selector: \"node\",\r\n              style: {\r\n                \"background-color\": \"data(color)\",\r\n                label: \"data(label)\",\r\n    \"width\": 'mapData(size, 20, 60, 20, 60)',\r\n    \"height\":'mapData(size, 20, 60, 20, 60)',\r\n                shape: \"data(shape)\",\r\n                  \r\n              }\r\n            },\r\n            {\r\n              selector: \"edge\",\r\n              style: {\r\n                width: 3,\r\n                \"line-color\": \"#ccc\"\r\n              }\r\n            }\r\n          ],\r\n          elements: {\r\n            nodes: nodes2,\r\n            edges:edges2\r\n          }\r\n        };\r\n\r\n\r\n        var cy2 = cytoscape(cyOptions2);\r\n    cy2.on('mouseover', 'node', function(event) {\r\n       if(event.target._private.data.color=='green'){\r\n    event.target.css('content', event.target._private.data.label2);\r\n           }\r\n    });\r\n        cy2.on('mouseout', 'node', function(event) {\r\n       if(event.target._private.data.color=='green'){\r\n    event.target.css('content', event.target._private.data.label);\r\n           }\r\n    });\r\n\r\n    cy2.on('click', 'node', function(event) {\r\n       if(event.target._private.data.color=='green'){\r\n        window.open(\"https:\/\/www.wikipathways.org\/pathways\/\"+event.target._private.data.id, \"_blank\");\r\n       }\r\n    });\r\n\/\/});\r\n\r\n}\r\n    });\r\n\r\n<\/script>\r\n\r\n<\/body>           \r\n<\/html>\r\n\r\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-789","page","type-page","status-publish","hentry","no-thumb"],"_links":{"self":[{"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/pages\/789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/comments?post=789"}],"version-history":[{"count":5,"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/pages\/789\/revisions"}],"predecessor-version":[{"id":972,"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/pages\/789\/revisions\/972"}],"wp:attachment":[{"href":"https:\/\/imdeafoodcompubio.com\/index.php\/wp-json\/wp\/v2\/media?parent=789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}