diff --git a/verarbeitung/Processing_test_doi_ueberarbeitet.py b/verarbeitung/Processing_test_doi_ueberarbeitet.py index ac6ce63dc512a4e53303ad75f74f04bf6221e191..bfa533a3161063b7ec82231cbc2c34950336eb11 100644 --- a/verarbeitung/Processing_test_doi_ueberarbeitet.py +++ b/verarbeitung/Processing_test_doi_ueberarbeitet.py @@ -10,12 +10,13 @@ import requests as req import sys from pathlib import Path from input_fj import input +from json_demo import output_to_json -def process_main(array, depth): +def process_main(doi_input_array, depth): # ERROR-Handling doi_array = NULL - if (len(array) == 0): + if (len(doi_input_array) == 0): print("Error, no input data") # ERROR- wenn für die Tiefe eine negative Zahl eingegeben wird @@ -30,14 +31,21 @@ def process_main(array, depth): edges = [] # Jede Publikation aus dem Input-Array wird in den Knoten-Array(nodes) eingefügt. - for pub in array: - if (pub not in nodes): + for pub_doi in doi_input_array: + pub = input(pub_doi) + not_in_nodes = True + for node in nodes: + if (pub.doi_url == node.doi_url): + not_in_nodes = False + break + if (not_in_nodes): nodes.append(pub) else: - array.remove(pub) + doi_input_array.remove(pub_doi) - process_rec_depth(array, 0, depth) + process_rec_depth(doi_input_array, 0, depth) + output_to_json(nodes,edges) return(nodes,edges) @@ -56,9 +64,14 @@ def process_rec_depth(array, depth, depth_max): # Wenn die citation noch nicht im Knoten-Array(nodes) existiert UND die maximale Tiefe # noch nicht erreicht wurde, wird diese als Knoten im Knoten-Array gespeichert. Zusätzlich # wird die Verbindung zur Publikation als Tupel im Kanten-Array(edges) gespeichert. - if (citation.doi_url not in nodes): + not_in_nodes = True + for node in nodes: + if (citation.doi_url == node.doi_url): + not_in_nodes = False + break + if (not_in_nodes): if (depth <= depth_max): - nodes.append(citation.doi_url) + nodes.append(citation) edges.append([pub.doi_url,citation.doi_url]) # Wenn die citaion bereits im Knoten-Array existiert, wird nur die Verbindung zur Publikation @@ -85,8 +98,8 @@ def process_rec_depth(array, depth, depth_max): # Programmtest, weil noch keine Verbindung zum Input besteht. arr = [] arr.append('https://pubs.acs.org/doi/10.1021/acs.jcim.9b00249') -#arr.append('https://pubs.acs.org/doi/10.1021/acs.jcim.9b00249') -#arr.append('https://doi.org/10.1021/acs.jmedchem.0c01332') +arr.append('https://pubs.acs.org/doi/10.1021/acs.jcim.9b00249') +arr.append('https://doi.org/10.1021/acs.jmedchem.0c01332') #arr.append('https://doi.org/10.1021/acs.jcim.0c00741') #arr.append('https://doi.org/10.1021/ci700007b') @@ -97,8 +110,8 @@ arr.append('https://pubs.acs.org/doi/10.1021/acs.jcim.9b00249') nodes,edges = process_main(arr,1) print("Knoten:\n") -for vortex in nodes: - print(vortex, "\n") +for node in nodes: + print(node.title, "\n") print("\nKanten:\n") for edge in edges: print(edge,"\n") \ No newline at end of file diff --git a/verarbeitung/__pycache__/input_fj.cpython-38.pyc b/verarbeitung/__pycache__/input_fj.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb7f56fc9742c5d19e2fff3d15c51dc4d59e1b1a Binary files /dev/null and b/verarbeitung/__pycache__/input_fj.cpython-38.pyc differ diff --git a/verarbeitung/__pycache__/json_demo.cpython-38.pyc b/verarbeitung/__pycache__/json_demo.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..519d14366f17ebf12bfdc3f6ae2e985ad9d6d229 Binary files /dev/null and b/verarbeitung/__pycache__/json_demo.cpython-38.pyc differ diff --git a/input/input_fj.py b/verarbeitung/input_fj.py old mode 100755 new mode 100644 similarity index 100% rename from input/input_fj.py rename to verarbeitung/input_fj.py diff --git a/verarbeitung/json_demo.py b/verarbeitung/json_demo.py index e6cd618a807a5b18c7635dc4c4555f7ceaf5d80d..77ce148c8b3898c97472f2c43f1750b99a0ae9a1 100644 --- a/verarbeitung/json_demo.py +++ b/verarbeitung/json_demo.py @@ -1,27 +1,33 @@ #!/usr/bin/env python3 import json +from input_fj import input def output_to_json(V,E): - list_of_node_dicts = list() - list_of_edge_dicts = list() - dict_of_all = dict() - for node in V: - new_dict = dict() - new_dict["doi"] = node - list_of_node_dicts.append(new_dict) - for edge in E: - new_dict_2 = dict() - new_dict_2["source"] = edge[0] - new_dict_2["target"] = edge[1] - list_of_edge_dicts.append(new_dict_2) - dict_of_all["nodes"] = list_of_node_dicts - dict_of_all["links"] = list_of_edge_dicts - return(dict_of_all) - with open('json_text_json','w') as outfile: - json_dump(dict_of_all, outfile) + list_of_node_dicts = list() + list_of_edge_dicts = list() + dict_of_all = dict() + for node in V: + new_dict = dict() + new_dict["name"] = node.title + new_dict["author"] = node.contributors + new_dict["year"] = node.publication_date + new_dict["doi"] = node.doi_url + + + list_of_node_dicts.append(new_dict) + for edge in E: + new_dict_2 = dict() + new_dict_2["source"] = edge[0] + new_dict_2["target"] = edge[1] + list_of_edge_dicts.append(new_dict_2) + dict_of_all["nodes"] = list_of_node_dicts + dict_of_all["links"] = list_of_edge_dicts + #return(dict_of_all) + with open('json_text.txt','w') as outfile: + json.dump(dict_of_all, outfile) -knoten = ["doi1", "doi2", "doi3"] -kanten = [[1,2],[3,4],[5,6]] -output_to_json(knoten,kanten) +#knoten = ["doi1", "doi2", "doi3"] +#kanten = [[1,2],[3,4],[5,6]] +#output_to_json(knoten,kanten) diff --git a/verarbeitung/json_text.txt b/verarbeitung/json_text.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5e7fa9b225b911bcd2d80c5d74097bdf4d40e1c --- /dev/null +++ b/verarbeitung/json_text.txt @@ -0,0 +1 @@ +{"nodes": [{"name": "Comparing Molecular Patterns Using the Example of SMARTS: Applications and Filter Collection Analysis", "doi": "https://doi.org/10.1021/acs.jcim.9b00249"}, {"name": "Combining Machine Learning and Computational Chemistry for Predictive Insights Into Chemical Systems ", "doi": "https://doi.org/10.1021/acs.chemrev.1c00107"}, {"name": "Disconnected Maximum Common Substructures under Constraints ", "doi": "https://doi.org/10.1021/acs.jcim.0c00741"}, {"name": "Evolution of Novartis\u2019 Small Molecule Screening Deck Design ", "doi": "https://doi.org/10.1021/acs.jmedchem.0c01332"}, {"name": "Comparing Molecular Patterns Using the Example of SMARTS: Theory and Algorithms ", "doi": "https://doi.org/10.1021/acs.jcim.9b00250"}, {"name": "Machine learning accelerates quantum mechanics predictions of molecular crystals ", "doi": "https://doi.org/10.1016/j.physrep.2021.08.002"}, {"name": "The Growing Importance of Chirality in 3D Chemical Space Exploration and Modern Drug Discovery Approaches for Hit-ID ", "doi": "https://doi.org/10.1021/acsmedchemlett.1c00251"}, {"name": "Target-Based Evaluation of \u201cDrug-Like\u201d Properties and Ligand Efficiencies ", "doi": "https://doi.org/10.1021/acs.jmedchem.1c00416"}, {"name": "BonMOLi\u00e8re: Small-Sized Libraries of Readily Purchasable Compounds, Optimized to Produce Genuine Hits in Biological Screens across the Protein Space ", "doi": "https://doi.org/10.3390/ijms22157773"}, {"name": "Accelerating high-throughput virtual screening through molecular pool-based active learning ", "doi": "https://doi.org/10.1039/D0SC06805E"}, {"name": "Compound Screening ", "doi": "https://doi.org/10.1016/B978-0-12-820472-6.00078-5"}], "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/verarbeitung/json_text_json.txt b/verarbeitung/json_text_json.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391