From b1757d8631b649714d30d2ba8fd455ae6d59448d Mon Sep 17 00:00:00 2001 From: Merle Stahl <merle.stahl@studium.uni-hamburg.de> Date: Mon, 17 Jan 2022 17:50:19 +0100 Subject: [PATCH] Farben angepasst --- assets/cn.js | 2 +- assets/cn2.js | 2 +- assets/index.html | 2 +- assets/json_text.json | 115 +--------------------------------------- citation_parser_main.py | 72 +++++++++++++------------ 5 files changed, 43 insertions(+), 150 deletions(-) diff --git a/assets/cn.js b/assets/cn.js index 5b2ba32..1eb8d52 100644 --- a/assets/cn.js +++ b/assets/cn.js @@ -18,7 +18,7 @@ perc; */ var color = d3.scaleOrdinal() .domain(["Citedby", "Input", "Reference"]) - .range(['#01d7c0', '#8b90fe', '#a15eb2']), + .range(['#01d7c0', '#7fa9d4', '#a15eb2']), y_scale = d3.scaleOrdinal() .domain(["Citedby", "Input", "Reference"]) .range([0, 200, 400]), diff --git a/assets/cn2.js b/assets/cn2.js index de4ab78..992356f 100644 --- a/assets/cn2.js +++ b/assets/cn2.js @@ -18,7 +18,7 @@ perc; */ var color = d3.scaleOrdinal() .domain(["Citedby", "Input", "Reference"]) - .range(['#01d7c0', '#8b90fe', '#a15eb2']), + .range(['#01d7c0', '#7fa9d4', '#a15eb2']), y_scale = d3.scaleOrdinal() .domain(["Citedby", "Input", "Reference"]) .range([0, 200, 400]), diff --git a/assets/index.html b/assets/index.html index 981e9f8..ed4ed32 100644 --- a/assets/index.html +++ b/assets/index.html @@ -82,7 +82,7 @@ svg.graph { position: absolute; - top: 20px + top: 20px; } </style> </head> diff --git a/assets/json_text.json b/assets/json_text.json index c023ef5..b8177a3 100644 --- a/assets/json_text.json +++ b/assets/json_text.json @@ -1,114 +1 @@ -{ - "nodes": [ - { - "doi": "https://doi.org/10.1021/acs.jcim.5b00332", - "name": "Feasibility of Active Machine Learning for Multiclass Compound Classification", - "author": [ - "Tobias Löang", - "Florian Flachsenberg", - "Ulrike von Luxburg", - "Matthias Rarey" - ], - "year": "January 7, 2016", - "journal": "Journal of Chemical Information and Modeling", - "group": "Input", - "depth": 0, - "citations": 5 - }, - { - "doi": "https://doi.org/10.1021/acs.jcim.7b00729", - "name": "Modeling Kinase Inhibition Using Highly Confident Data Sets", - "author": [ - "Sorin Avram", - "Alina Bora", - "Liliana Halip", - "Ramona Curp\u0103n" - ], - "year": "April 30, 2018", - "journal": "Journal of Chemical Information and Modeling", - "group": "Citedby", - "depth": 1, - "citations": 0 - }, - { - "doi": "https://doi.org/10.1021/acs.jcim.7b00729", - "name": "Modeling Kinase Inhibition Using Highly Confident Data Sets", - "author": [ - "Sorin Avram", - "Alina Bora", - "Liliana Halip", - "Ramona Curp\u0103n" - ], - "year": "April 30, 2018", - "journal": "Journal of Chemical Information and Modeling", - "group": "Citedby", - "depth": 1, - "citations": 0 - }, - { - "doi": "https://doi.org/10.1021/acs.jcim.5b00646", - "name": "Predictive Models for Fast and Effective Profiling of Kinase Inhibitors", - "author": [ - "Alina Bora", - "Sorin Avram", - "Ionel Ciucanu", - "Marius Raica", - "Stefana Avram" - ], - "year": "April 11, 2016", - "journal": "Journal of Chemical Information and Modeling", - "group": "Citedby", - "depth": 1, - "citations": 2 - }, - { - "doi": "https://doi.org/10.1021/acs.jcim.6b00709", - "name": "Matched Molecular Series: Measuring SAR Similarity", - "author": [ - "Emanuel S. R. Ehmki", - "Christian Kramer" - ], - "year": "May 1, 2017", - "journal": "Journal of Chemical Information and Modeling", - "group": "Input", - "depth": 0, - "citations": 5 - }, - { - "doi": "https://doi.org/10.1021/acs.jcim.0c00269", - "name": "Matched Molecular Series Analysis for ADME Property Prediction", - "author": [ - "Mahendra Awale", - "Sereina Riniker", - "Christian Kramer" - ], - "year": "May 5, 2020", - "journal": "Journal of Chemical Information and Modeling", - "group": "Citedby", - "depth": 1, - "citations": 6 - } - ], - "links": [ - { - "source": "https://doi.org/10.1021/acs.jcim.7b00729", - "target": "https://doi.org/10.1021/acs.jcim.5b00332" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.7b00729", - "target": "https://doi.org/10.1021/acs.jcim.5b00332" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.5b00646", - "target": "https://doi.org/10.1021/acs.jcim.5b00332" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.7b00729", - "target": "https://doi.org/10.1021/acs.jcim.5b00646" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00269", - "target": "https://doi.org/10.1021/acs.jcim.6b00709" - } - ] -} +{"nodes": [], "links": []} \ No newline at end of file diff --git a/citation_parser_main.py b/citation_parser_main.py index c2b119d..997a8c1 100644 --- a/citation_parser_main.py +++ b/citation_parser_main.py @@ -10,9 +10,9 @@ from dash.exceptions import PreventUpdate from input.interface import InputInterface import input.publication from verarbeitung.process_main import Processing -from dash.dependencies import Input, Output, State #Loading Bar +from dash.dependencies import Input, Output, State import plotly.express as px -import dash_bootstrap_components as dbc # pip install dash-bootstrap-components for Loading Bar +import dash_bootstrap_components as dbc # pip install dash-bootstrap-components @@ -21,57 +21,58 @@ app = dash.Dash(__name__, external_stylesheets=[dbc.themes.SPACELAB]) #SPACELAB # List of options when inputting data and generating the graph additional_options = ['Update Automatically','Smart Input'] -# Reads the contents of info_box.txt. +# Reads the contents of info_box.txt. # They can later be displayed by pressing the corresponding button. f = open('info_box.txt', 'r') boxcontent = f.read() f.close() app.layout = html.Div([ +html.Div(children=[ # Layer 0: For the Header and Help Function(s) dbc.Button( - 'show Info', + 'Show Info', id='collapse-button', className="me-1", color="primary", n_clicks=0, ), dbc.Collapse( - dbc.Card(dbc.CardBody(html.Div(boxcontent, style={'whiteSpace': 'pre-line'}))), + dbc.Card(dbc.CardBody(html.Div(boxcontent, style={'whiteSpace': 'pre-line', 'font-size': '10px'}))), id='collapse', is_open=False, ), # Layer 1: For the string input - html.Div([ + dbc.Spinner(html.Div([ "Input: ", - # A simple box for inputting a string. + # A simple box for inputting a string. # Value is transmitted upon pressing return or clicking out of the box. dcc.Input(id='string-input', value='', type='text',debounce=True, - style={ "width": "400px"}, + style={ "width": "362px", 'margin-top': "10px"}, ), - ]), + ]),size="lg", color="primary", type="border", fullscreen=True,), # Layer 2: For file input and recursion depths - html.Div([ - "Cited-by Depth: ", + html.Div([ + "References Depth: ", # Forward recursion. Values between 1 and 10 can be entered. dcc.Input(id='forward-depth',value='1',type='number',min='0',max='5', - style={ "width": "50px"}, + style={ "width": "50px", 'margin-top': "10px"}, ), - "References Depth: ", + " Cited-by Depth: ", # Backward recursion. Values between 1 and 10 can be entered. dcc.Input(id='backward-depth',value='1',type='number',min='0',max='5', - style={"width": "50px"}, + style={"width": "50px", 'margin-top': "10px"}, ), # Upload box. Can be used via drag-and-drop or byclicking on it to open a file viewer. - dcc.Upload( + dbc.Spinner(dcc.Upload( id="file-input", children=html.Div( #Drag and drop or click to select a file to upload ["Drag and drop"]), style={ - "width": "30%", + "width": "400px", "height": "60px", "lineHeight": "60px", "borderWidth": "1px", @@ -79,23 +80,23 @@ app.layout = html.Div([ "borderRadius": "5px", "textAlign": "center", "margin": "10px", - }) + }),size="lg", color="primary", type="border", fullscreen=True,), ]), # Layer 3: For the checklist, Remove-/Start-Buttons and error message html.Div([ - # All input DOIs are collected in this checklist. + # All input DOIs are collected in this checklist. # It is initialized to avoid error messages. dcc.Checklist(id='input-checklist',options=[], labelStyle = dict(display='block'),value=[]), # Displays error message if 'Smart Input' is active. html.Div(id='input-err',style={'color':'red'}), # Clears the entire list. - dbc.Button(id='clear-all-button',children='Clear All', color="primary", className="me-1"), + dbc.Button(id='clear-all-button',children='Clear All', color="primary", className="me-1",style={'display': 'inline-block'}), # Clear all selected elements. - dbc.Button(id='clear-selected-button',children='Clear Selected', color="primary", className="me-1"), + dbc.Button(id='clear-selected-button',children='Clear Selected', color="primary", className="me-1",style={'display': 'inline-block'}), # Starts the process that generates a graph. - dbc.Button(id='start-button',children='Generate Graph', color="primary", className="me-1") + dbc.Button(id='start-button',children='Generate Graph', color="primary", className="me-1",style={'display': 'inline-block'}) ]), # Layer 4: For additional Options html.Div([ @@ -103,17 +104,22 @@ app.layout = html.Div([ # A checklist of all additional options that are listed above. dcc.Checklist(id='additional-options', options=[{'label':k,'value':k} for k in additional_options], - value=[]) - ]), + value=[],labelStyle = dict(display= 'block')) + ],style={'margin-top': "50px"}), + + ], style={'padding': 10, 'flex': 0.8}), + + html.Div(children=[ # Layer 5: For the Graph and corresponding error messages - html.Div([ + dbc.Spinner(html.Div([ html.Div(id='generate-graph-error',style={'color':'red'}), html.Iframe( src="assets/index.html", - style={"height": "600px", "width": "100%"}, + style={"height": "650px", "width": "980px"}, ), - ]) -]) + ]),size="lg", color="primary", type="border", fullscreen=True,), + ], style={'padding': 10, 'flex': 1.2}) +], style={'display': 'flex', 'flex-direction': 'row'}) @app.callback( Output('input-checklist','options'), @@ -170,14 +176,14 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs, # when a new element is added via dcc.Input if 'string-input' in changed_id: # Creates a list of previously added inputs to make sure nothing is added twice - currValues = [x['value'] for x in all_inputs] + currValues = [x['value'] for x in all_inputs] if input_value not in currValues: - # if 'Smart Input' is selected, the input will be checked for validity + # if 'Smart Input' is selected, the input will be checked for validity # and a more readable string will be returned if 'Smart Input' in additional_options: try: - # Attempts to call get_publication. If unsuccesful, + # Attempts to call get_publication. If unsuccesful, # the DOI is not added and an error message is returned i = InputInterface() pub = i.get_pub_light(input_value) @@ -225,7 +231,7 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs, all_inputs.append({'label':input_value,'value':input_value}) return all_inputs,selected_inputs,'','' # when the programm is first started: - # if this is not done, the input_checklist will be generated + # if this is not done, the input_checklist will be generated # with one element that contains an empty string if input_value == '': return list(),list(),'','' @@ -258,7 +264,7 @@ def toggle_collapse(n, is_open): ) def generate_output(n_clicks,all_inputs,forward_depth,backward_depth,additional_options): ''' - Basic structure for a callback that generates an output. This is only a + Basic structure for a callback that generates an output. This is only a proof of concept and has noting to do with the intended output yet. :param n_clicks: how often has Generate Graph been clicked @@ -277,7 +283,7 @@ def generate_output(n_clicks,all_inputs,forward_depth,backward_depth,additional_ if n_clicks is None: raise PreventUpdate elif 'Update Automatically' in additional_options \ - or 'start-button' in changed_id: + or 'start-button' in changed_id: input_links = [x['value'] for x in all_inputs] errors = Processing(input_links,int(forward_depth),int(backward_depth),'assets/json_text.json') if errors: -- GitLab