From 6b99c012552655bd931247def71542d958a396ba Mon Sep 17 00:00:00 2001
From: Katja <bax5612@studium.uni-hamburg.de>
Date: Wed, 17 Nov 2021 20:39:16 +0100
Subject: [PATCH] dynamic div box, deleted rectangle, first last name on node

---
 Output/data.json      |  23 --------
 Output/index.html     |  78 +++++++++++++--------------
 Output/json_text.json | 123 ++++++++++++++++++++++++++++++++++++++++++
 json_text.json        | 123 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 285 insertions(+), 62 deletions(-)
 delete mode 100644 Output/data.json
 create mode 100644 Output/json_text.json
 create mode 100644 json_text.json

diff --git a/Output/data.json b/Output/data.json
deleted file mode 100644
index 419abd7..0000000
--- a/Output/data.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{"nodes":[{"name":"StudieA","author":"MenschA","year":"JahrA","doi":"doiA","group":"input"},
-    {"name":"StudieB","author":"MenschB","year":"JahrB","doi":"doiB","group":"cited"},
-    {"name":"StudieC","author":"MenschC","year":"JahrC","doi":"doiC","group":"input"},
-    {"name":"StudieD","author":"MenschD","year":"JahrD","doi":"doiD","group":"cited"},
-    {"name":"StudieE","author":"MenschE","year":"JahrE","doi":"doiE","group":"cited"},
-    {"name":"StudieF","author":"MenschF","year":"JahrF","doi":"doiF","group":"cited"},
-    {"name":"StudieG","author":"MenschG","year":"JahrG","doi":"doiG","group":"citing"},
-    {"name":"StudieH","author":"MenschH","year":"JahrH","doi":"doiH","group":"cited"}, 
-    {"name":"StudieI","author":"MenschI","year":"JahrI","doi":"doiI","group":"citing"}],
-"links":[{"source":"doiA","target":"doiB"},
-    {"source":"doiA","target":"doiC"},
-    {"source":"doiC","target":"doiE"},
-    {"source":"doiD","target":"doiB"},
-    {"source":"doiC","target":"doiB"},
-    {"source":"doiA","target":"doiH"},
-    {"source":"doiA","target":"doiI"},
-    {"source":"doiI","target":"doiC"},
-    {"source":"doiH","target":"doiC"},
-    {"source":"doiG","target":"doiA"},
-    {"source":"doiH","target":"doiI"},
-    {"source":"doiE","target":"doiF"}
-
-    ]}
diff --git a/Output/index.html b/Output/index.html
index 2947b15..9825ce8 100644
--- a/Output/index.html
+++ b/Output/index.html
@@ -22,7 +22,22 @@
         top: 500px;
         right: 550px;
         } */
+        div {
+        width:270px;
+        min-height:200px; 
+        max-height:370px;
+        padding: 10px;
+        border: 1px solid #999;
+        position: absolute; 
+        top: 0; 
+        right: 0;
+        display: inline-block;
+        overflow-y: scroll;
+        margin: 0;
+        }
+    
     </style>
+    <!--width: 270px;-->
     <link rel="shortcut icon" href="#">
 </head>
 <body>
@@ -38,6 +53,8 @@
 <button onclick="resetZoom()">Reset zoom</button>
 <button onclick="center()">Center</button>
 
+
+
 <script type="text/javascript">
 //    var colors = d3.scaleOrdinal(d3.schemeCategory10);
     
@@ -112,8 +129,8 @@
         .attr("class", "everything")
         //.call(zoom);
  
-
-    d3.json("data.json", function (error, graph) {
+    //d3.json("data.json", function (error, graph) {
+    d3.json("json_text.json", function (error, graph) {
         if (error) throw error;
         update(graph.links, graph.nodes);
     })
@@ -149,13 +166,6 @@
 
 
     var h = svg.append('g').attr("transform" ,"scale(0)");
-    rect = h.append('rect')
-                    .attr('width', 300)
-                    .attr('height', 90)
-                    .attr('x', width-310)
-                    .attr('y', 10)
-                    .style('fill', 'none')
-                    .attr('stroke', 'none')
     h.transition().duration(500).attr("transform" ,"scale(1)");
         var toRemove;
 
@@ -185,14 +195,14 @@
             })
 
 
-
-        node.append("title")
+        //hovertext
+     /*   node.append("title") 
             .text(function (d) {return "Title: "+d.name+"\nAuthor: "+d.author+"\nYear: "+d.year+"\ndoi: "+d.doi;});
-
+*/
         node.append("text")
             .attr("class", "text") //über selectAll(".text") können objs mit der klasse ausgewählt werden
             .style("font-size", "15px")
-            .text(function (d) {return d.author;})
+            .text(function (d) {return author(d.author);})
             .style('pointer-events', 'auto')
 
             
@@ -213,7 +223,6 @@
                 d3.selectAll(".link").attr('marker-end', function(o) {
                 return isLinkForNode(d, o) ? 'url(#arrowhead2)' : 'url(#arrowhead)';})
 
-
                 textfunc(d,h);
             });
 
@@ -228,40 +237,31 @@
     function isLinkForNode(node, link){
 	return link.source.index == node.index || link.target.index == node.index;
     }
-    function colorlink(o,f){
-                document.getElementById("id").innerHTML = o.target
-                o.source === f || o.target === f ? o.style("stroke","black") : o.style("stroke","#000000");
+    function author(author){
+        if (/,/.test(author)==false){
+            var hmm=/^.*\s+([\w\-]+)[\.\s]*$/.exec(author)
+        }
+        else{
+        var hmm=/^[\s\w\.\-]*\s([\w\-]+)[\.\s]*,.*$/.exec(author)
+    }
+        return hmm[1]
+        
     }
 
 
     function textfunc(d,h){
         d3.selectAll("foreignObject").remove()
-
-                rect.attr('stroke', 'black')
                 h.append('foreignObject')
                     .attr('x', width-300)
                     .attr('y', 15)
                     .attr('width', 300)
-                    .attr('height', 100)
-                    .text("Title: "+d.name)
-                h.append('foreignObject')
-                    .attr('x', width-300)
-                    .attr('y', 35)
-                    .attr('width', 300)
-                    .attr('height', 100)
-                    .text("Author: "+d.author)
-                h.append('foreignObject')
-                    .attr('x', width-300)
-                    .attr('y', 55)
-                    .attr('width', 300)
-                    .attr('height', 100)
-                    .text("Year: "+d.year)
-                h.append('foreignObject')
-                    .attr('x', width-300)
-                    .attr('y', 75)
-                    .attr('width', 300)
-                    .attr('height', 100)
-                    .text("doi: "+d.doi)
+                    .attr('height', 400)
+                    .style("font-size", "15px")
+                    .html(function(h) {
+                return '<div style="border:1px solid">' + "Title:" + '</br>' + d.name +
+                '</br>' +'</br>'+"Author:"+ '</br>' +d.author+'</br>'+'</br>'+"Year:"+'</br>'+d.year+'</br>'+'</br>'
+                +"doi:"+'</br>'+d.doi+'</div>'
+                })
         
     }
 
diff --git a/Output/json_text.json b/Output/json_text.json
new file mode 100644
index 0000000..3846229
--- /dev/null
+++ b/Output/json_text.json
@@ -0,0 +1,123 @@
+{
+    "nodes": [
+        {
+            "name": "Comparing Molecular Patterns Using the Example of SMARTS: Applications and Filter Collection Analysis",
+            "author":"Emanuel S. R. Ehmki,Robert Schmidt, Farina Ohm, Matthias Rarey",
+            "year":"1997",
+            "doi": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "group": "input"
+        },
+        {
+            "name": "Combining Machine Learning and Computational Chemistry for Predictive Insights Into Chemical Systems ",
+            "author": "John A. Keith, Valentin Vassilev-Galindo, Bingqing Cheng, Stefan Chmiela, Michael Gastegger, Klaus-Robert M\u00fcller, Alexandre Tkatchenko. ",
+            "year":"1937",
+            "doi": "https://doi.org/10.1021/acs.chemrev.1c00107",
+            "group": "citing"
+        },
+        {
+            "name": "Disconnected Maximum Common Substructures under Constraints ",
+            "author": "Robert Schmidt, Florian Krull, Anna Lina Heinzke, Matthias Rarey. ",
+            "year":"1991",
+            "doi": "https://doi.org/10.1021/acs.jcim.0c00741",
+            "group": "citing"
+        },
+        {
+            "name": "Evolution of Novartis\u2019 Small Molecule Screening Deck Design ",
+            "author": "Ansgar Schuffenhauer, Nadine Schneider, Samuel Hintermann, Douglas Auld, Jutta Blank, Simona Cotesta, Caroline Engeloch, Nikolas Fechner, Christoph Gaul, Jerome Giovannoni, Johanna Jansen, John Joslin, Philipp Krastel, Eugen Lounkine, John Manchester, Lauren G. Monovich, Anna Paola Pelliccioli, Manuel Schwarze, Michael D. Shultz, Nikolaus Stiefl, Daniel K. Baeschlin. ",
+            "year":"2001",
+            "doi": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "group": "input"
+        },
+        {
+            "name": "Comparing Molecular Patterns Using the Example of SMARTS: Theory and Algorithms ",
+            "author": "Robert Schmidt, Emanuel S. R. Ehmki, Farina Ohm, Hans-Christian Ehrlich, Andriy Mashychev, Matthias Rarey. ",
+            "year":"2021",
+            "doi": "https://doi.org/10.1021/acs.jcim.9b00250",
+            "group": "cited"
+        },
+        {
+            "name": "Machine learning accelerates quantum mechanics predictions of molecular crystals ",
+            "author": "Yanqiang  Han, Imran  Ali, Zhilong  Wang, Junfei  Cai, Sicheng  Wu, Jiequn  Tang, Lin  Zhang, Jiahao  Ren, Rui  Xiao, Qianqian  Lu, Lei  Hang, Hongyuan  Luo, Jinjin  Li. ",
+            "year":"2011",
+            "doi": "https://doi.org/10.1016/j.physrep.2021.08.002",
+            "group": "cited"
+        },
+        {
+            "name": "The Growing Importance of Chirality in 3D Chemical Space Exploration and Modern Drug Discovery Approaches for Hit-ID ",
+            "author": "Ilaria Proietti Silvestri, Paul J. J. Colbon. ",
+            "year":"2001",
+            "doi": "https://doi.org/10.1021/acsmedchemlett.1c00251",
+            "group": "cited"
+        },
+        {
+            "name": "Target-Based Evaluation of \u201cDrug-Like\u201d Properties and Ligand Efficiencies ",
+            "author": "Paul D. Leeson, A. Patricia Bento, Anna Gaulton, Anne Hersey, Emma J. Manners, Chris J. Radoux, Andrew R. Leach. ",
+            "year":"2003",
+            "doi": "https://doi.org/10.1021/acs.jmedchem.1c00416",
+            "group": "cited"
+        },
+        {
+            "name": "BonMOLi\u00e8re: Small-Sized Libraries of Readily Purchasable Compounds, Optimized to Produce Genuine Hits in Biological Screens across the Protein Space ",
+            "author": "Neann  Mathai, Conrad  Stork, Johannes  Kirchmair. ",
+            "year":"2003",
+            "doi": "https://doi.org/10.3390/ijms22157773",
+            "group": "cited"
+        },
+        {
+            "name": "Accelerating high-throughput virtual screening through molecular pool-based active learning ",
+            "author": "David E.  Graff, Eugene I.  Shakhnovich, Connor W.  Coley. ",
+            "year":"2013",
+            "doi": "https://doi.org/10.1039/D0SC06805E",
+            "group": "cited"
+        },
+        {
+            "name": "Compound Screening ",
+            "author": "Shin  Numao.",
+            "year":"2009",
+            "doi": "https://doi.org/10.1016/B978-0-12-820472-6.00078-5",
+            "group": "citing"
+        }
+    ],
+    "links": [
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.chemrev.1c00107"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.jcim.0c00741"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.jmedchem.0c01332"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.jcim.9b00250"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1016/j.physrep.2021.08.002"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1021/acsmedchemlett.1c00251"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1021/acs.jmedchem.1c00416"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.3390/ijms22157773"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1039/D0SC06805E"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1016/B978-0-12-820472-6.00078-5"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/json_text.json b/json_text.json
new file mode 100644
index 0000000..42f0e4b
--- /dev/null
+++ b/json_text.json
@@ -0,0 +1,123 @@
+{
+    "nodes": [
+        {
+            "name": "Comparing Molecular Patterns Using the Example of SMARTS: Applications and Filter Collection Analysis",
+            "author":"Emanuel S. R. Ehmki,Robert Schmidt, Farina Ohm, Matthias Rarey",
+            "year":"7",
+            "doi": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "group": "input"
+        },
+        {
+            "name": "Combining Machine Learning and Computational Chemistry for Predictive Insights Into Chemical Systems ",
+            "author": "John A. Keith, Valentin Vassilev-Galindo, Bingqing Cheng, Stefan Chmiela, Michael Gastegger, Klaus-Robert M\u00fcller, Alexandre Tkatchenko. ",
+            "year":"1937",
+            "doi": "https://doi.org/10.1021/acs.chemrev.1c00107",
+            "group": "citing"
+        },
+        {
+            "name": "Disconnected Maximum Common Substructures under Constraints ",
+            "author": "Robert Schmidt, Florian Krull, Anna Lina Heinzke, Matthias Rarey. ",
+            "year":"1991",
+            "doi": "https://doi.org/10.1021/acs.jcim.0c00741",
+            "group": "citing"
+        },
+        {
+            "name": "Evolution of Novartis\u2019 Small Molecule Screening Deck Design ",
+            "author": "Ansgar Schuffenhauer, Nadine Schneider, Samuel Hintermann, Douglas Auld, Jutta Blank, Simona Cotesta, Caroline Engeloch, Nikolas Fechner, Christoph Gaul, Jerome Giovannoni, Johanna Jansen, John Joslin, Philipp Krastel, Eugen Lounkine, John Manchester, Lauren G. Monovich, Anna Paola Pelliccioli, Manuel Schwarze, Michael D. Shultz, Nikolaus Stiefl, Daniel K. Baeschlin. ",
+            "year":"2001",
+            "doi": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "group": "input"
+        },
+        {
+            "name": "Comparing Molecular Patterns Using the Example of SMARTS: Theory and Algorithms ",
+            "author": "Robert Schmidt, Emanuel S. R. Ehmki, Farina Ohm, Hans-Christian Ehrlich, Andriy Mashychev, Matthias Rarey. ",
+            "year":"2021",
+            "doi": "https://doi.org/10.1021/acs.jcim.9b00250",
+            "group": "cited"
+        },
+        {
+            "name": "Machine learning accelerates quantum mechanics predictions of molecular crystals ",
+            "author": "Yanqiang  Han, Imran  Ali, Zhilong  Wang, Junfei  Cai, Sicheng  Wu, Jiequn  Tang, Lin  Zhang, Jiahao  Ren, Rui  Xiao, Qianqian  Lu, Lei  Hang, Hongyuan  Luo, Jinjin  Li. ",
+            "year":"2011",
+            "doi": "https://doi.org/10.1016/j.physrep.2021.08.002",
+            "group": "cited"
+        },
+        {
+            "name": "The Growing Importance of Chirality in 3D Chemical Space Exploration and Modern Drug Discovery Approaches for Hit-ID ",
+            "author": "Ilaria Proietti Silvestri, Paul J. J. Colbon. ",
+            "year":"2001",
+            "doi": "https://doi.org/10.1021/acsmedchemlett.1c00251",
+            "group": "cited"
+        },
+        {
+            "name": "Target-Based Evaluation of \u201cDrug-Like\u201d Properties and Ligand Efficiencies ",
+            "author": "Paul D. Leeson, A. Patricia Bento, Anna Gaulton, Anne Hersey, Emma J. Manners, Chris J. Radoux, Andrew R. Leach. ",
+            "year":"2003",
+            "doi": "https://doi.org/10.1021/acs.jmedchem.1c00416",
+            "group": "cited"
+        },
+        {
+            "name": "BonMOLi\u00e8re: Small-Sized Libraries of Readily Purchasable Compounds, Optimized to Produce Genuine Hits in Biological Screens across the Protein Space ",
+            "author": "Neann  Mathai, Conrad  Stork, Johannes  Kirchmair. ",
+            "year":"2003",
+            "doi": "https://doi.org/10.3390/ijms22157773",
+            "group": "cited"
+        },
+        {
+            "name": "Accelerating high-throughput virtual screening through molecular pool-based active learning ",
+            "author": "David E.  Graff, Eugene I.  Shakhnovich, Connor W.  Coley. ",
+            "year":"2013",
+            "doi": "https://doi.org/10.1039/D0SC06805E",
+            "group": "cited"
+        },
+        {
+            "name": "Compound Screening ",
+            "author": "Shin  Numao, Gianluca  Etienne. ",
+            "year":"2009",
+            "doi": "https://doi.org/10.1016/B978-0-12-820472-6.00078-5",
+            "group": "citing"
+        }
+    ],
+    "links": [
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.chemrev.1c00107"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.jcim.0c00741"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.jmedchem.0c01332"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1021/acs.jcim.9b00250"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jcim.9b00249",
+            "target": "https://doi.org/10.1016/j.physrep.2021.08.002"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1021/acsmedchemlett.1c00251"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1021/acs.jmedchem.1c00416"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.3390/ijms22157773"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1039/D0SC06805E"
+        },
+        {
+            "source": "https://doi.org/10.1021/acs.jmedchem.0c01332",
+            "target": "https://doi.org/10.1016/B978-0-12-820472-6.00078-5"
+        }
+    ]
+}
\ No newline at end of file
-- 
GitLab