diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 695e47d575e9dcc596b87eca086cee6d98942d8b..0000000000000000000000000000000000000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.VSCodeCounter/2022-01-05_11-11-20/details.md b/.VSCodeCounter/2022-01-05_11-11-20/details.md deleted file mode 100644 index c6c03fa2963e931cfb54b535cf305844ce510fed..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-11-20/details.md +++ /dev/null @@ -1,75 +0,0 @@ -# Details - -Date : 2022-01-05 11:11:20 - -Directory c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung - -Total : 60 files, 4426 codes, 857 comments, 956 blanks, all 6239 lines - -[summary](results.md) - -## Files -| filename | language | code | comment | blank | total | -| :--- | :--- | ---: | ---: | ---: | ---: | -| [assets/cn.js](/assets/cn.js) | JavaScript | 347 | 134 | 68 | 549 | -| [assets/index.html](/assets/index.html) | HTML | 84 | 8 | 15 | 107 | -| [assets/json_text.json](/assets/json_text.json) | JSON | 1 | 0 | 0 | 1 | -| [citation_parser_ui.py](/citation_parser_ui.py) | Python | 198 | 40 | 17 | 255 | -| [count_journal.py](/count_journal.py) | Python | 29 | 4 | 8 | 41 | -| [example_input.py](/example_input.py) | Python | 6 | 4 | 4 | 14 | -| [input/.VSCodeCounter/2021-12-24_13-19-53/details.md](/input/.VSCodeCounter/2021-12-24_13-19-53/details.md) | Markdown | 22 | 0 | 6 | 28 | -| [input/.VSCodeCounter/2021-12-24_13-19-53/results.md](/input/.VSCodeCounter/2021-12-24_13-19-53/results.md) | Markdown | 18 | 0 | 7 | 25 | -| [input/README.md](/input/README.md) | Markdown | 38 | 0 | 12 | 50 | -| [input/__init__.py](/input/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [input/get/__init__.py](/input/get/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [input/get/acs.py](/input/get/acs.py) | Python | 105 | 41 | 47 | 193 | -| [input/get/journal_fetcher.py](/input/get/journal_fetcher.py) | Python | 59 | 25 | 12 | 96 | -| [input/get/nature.py](/input/get/nature.py) | Python | 21 | 23 | 16 | 60 | -| [input/get/template_.py](/input/get/template_.py) | Python | 10 | 31 | 10 | 51 | -| [input/interface.py](/input/interface.py) | Python | 46 | 47 | 21 | 114 | -| [input/publication.py](/input/publication.py) | Python | 80 | 49 | 15 | 144 | -| [input/requirements.txt](/input/requirements.txt) | pip requirements | 2 | 0 | 0 | 2 | -| [input/test/__init__.py](/input/test/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [input/test/test_acs.py](/input/test/test_acs.py) | Python | 285 | 7 | 11 | 303 | -| [input/test/test_input.py](/input/test/test_input.py) | Python | 40 | 28 | 14 | 82 | -| [input_old/README.md](/input_old/README.md) | Markdown | 2 | 0 | 2 | 4 | -| [input_old/input_fj.py](/input_old/input_fj.py) | Python | 118 | 20 | 17 | 155 | -| [input_old/pub.py](/input_old/pub.py) | Python | 24 | 4 | 5 | 33 | -| [input_old/test.py](/input_old/test.py) | Python | 11 | 1 | 4 | 16 | -| [output/README.md](/output/README.md) | Markdown | 40 | 0 | 6 | 46 | -| [output/graph/cn.js](/output/graph/cn.js) | JavaScript | 347 | 134 | 68 | 549 | -| [output/graph/index.html](/output/graph/index.html) | HTML | 84 | 8 | 15 | 107 | -| [output/graph/json_text.json](/output/graph/json_text.json) | JSON | 819 | 0 | 0 | 819 | -| [start_script.py](/start_script.py) | Python | 12 | 4 | 4 | 20 | -| [test.json](/test.json) | JSON | 1 | 0 | 0 | 1 | -| [ui_programm_fragmente/README.md](/ui_programm_fragmente/README.md) | Markdown | 23 | 0 | 16 | 39 | -| [ui_programm_fragmente/input_to_checklist.py](/ui_programm_fragmente/input_to_checklist.py) | Python | 144 | 9 | 8 | 161 | -| [ui_programm_fragmente/upload_to_checklist.py](/ui_programm_fragmente/upload_to_checklist.py) | Python | 52 | 5 | 22 | 79 | -| [verarbeitung/README.md](/verarbeitung/README.md) | Markdown | 39 | 0 | 22 | 61 | -| [verarbeitung/__init__.py](/verarbeitung/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [verarbeitung/construct_new_graph/README.md](/verarbeitung/construct_new_graph/README.md) | Markdown | 18 | 0 | 11 | 29 | -| [verarbeitung/construct_new_graph/__init__.py](/verarbeitung/construct_new_graph/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [verarbeitung/construct_new_graph/add_citations_rec.py](/verarbeitung/construct_new_graph/add_citations_rec.py) | Python | 140 | 15 | 50 | 205 | -| [verarbeitung/construct_new_graph/export_to_json.py](/verarbeitung/construct_new_graph/export_to_json.py) | Python | 66 | 12 | 13 | 91 | -| [verarbeitung/construct_new_graph/initialize_graph.py](/verarbeitung/construct_new_graph/initialize_graph.py) | Python | 127 | 25 | 45 | 197 | -| [verarbeitung/dev_files/README.md](/verarbeitung/dev_files/README.md) | Markdown | 1 | 0 | 0 | 1 | -| [verarbeitung/dev_files/__init__.py](/verarbeitung/dev_files/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [verarbeitung/dev_files/print_graph_test.py](/verarbeitung/dev_files/print_graph_test.py) | Python | 53 | 36 | 19 | 108 | -| [verarbeitung/get_pub_from_input.py](/verarbeitung/get_pub_from_input.py) | Python | 27 | 12 | 9 | 48 | -| [verarbeitung/process_main.py](/verarbeitung/process_main.py) | Python | 29 | 12 | 15 | 56 | -| [verarbeitung/test/README.md](/verarbeitung/test/README.md) | Markdown | 16 | 0 | 9 | 25 | -| [verarbeitung/test/__init__.py](/verarbeitung/test/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [verarbeitung/test/construct_graph_unittest.py](/verarbeitung/test/construct_graph_unittest.py) | Python | 165 | 10 | 56 | 231 | -| [verarbeitung/test/input_test.py](/verarbeitung/test/input_test.py) | Python | 83 | 0 | 22 | 105 | -| [verarbeitung/test/update_graph_unittest.py](/verarbeitung/test/update_graph_unittest.py) | Python | 125 | 4 | 32 | 161 | -| [verarbeitung/update_graph/README.md](/verarbeitung/update_graph/README.md) | Markdown | 24 | 0 | 17 | 41 | -| [verarbeitung/update_graph/__init__.py](/verarbeitung/update_graph/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [verarbeitung/update_graph/compare_old_and_new_node_lists.py](/verarbeitung/update_graph/compare_old_and_new_node_lists.py) | Python | 23 | 7 | 8 | 38 | -| [verarbeitung/update_graph/connect_new_input.py](/verarbeitung/update_graph/connect_new_input.py) | Python | 91 | 23 | 39 | 153 | -| [verarbeitung/update_graph/delete_nodes_edges.py](/verarbeitung/update_graph/delete_nodes_edges.py) | Python | 62 | 13 | 21 | 96 | -| [verarbeitung/update_graph/import_from_json.py](/verarbeitung/update_graph/import_from_json.py) | Python | 46 | 20 | 25 | 91 | -| [verarbeitung/update_graph/update_depth.py](/verarbeitung/update_graph/update_depth.py) | Python | 135 | 14 | 46 | 195 | -| [verarbeitung/update_graph/update_edges.py](/verarbeitung/update_graph/update_edges.py) | Python | 19 | 10 | 9 | 38 | -| [verarbeitung/update_graph/update_graph.py](/verarbeitung/update_graph/update_graph.py) | Python | 69 | 18 | 30 | 117 | - -[summary](results.md) \ No newline at end of file diff --git a/.VSCodeCounter/2022-01-05_11-11-20/results.csv b/.VSCodeCounter/2022-01-05_11-11-20/results.csv deleted file mode 100644 index 238cb3b6fe549e7e2122b0dfe63b36af70047d46..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-11-20/results.csv +++ /dev/null @@ -1,62 +0,0 @@ -"filename", "language", "Python", "Markdown", "JSON", "HTML", "JavaScript", "pip requirements", "comment", "blank", "total" -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\assets\cn.js", "JavaScript", 0, 0, 0, 0, 347, 0, 134, 68, 549 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\assets\index.html", "HTML", 0, 0, 0, 84, 0, 0, 8, 15, 107 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\assets\json_text.json", "JSON", 0, 0, 1, 0, 0, 0, 0, 0, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\citation_parser_ui.py", "Python", 198, 0, 0, 0, 0, 0, 40, 17, 255 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\count_journal.py", "Python", 29, 0, 0, 0, 0, 0, 4, 8, 41 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\example_input.py", "Python", 6, 0, 0, 0, 0, 0, 4, 4, 14 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\.VSCodeCounter\2021-12-24_13-19-53\details.md", "Markdown", 0, 22, 0, 0, 0, 0, 0, 6, 28 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\.VSCodeCounter\2021-12-24_13-19-53\results.md", "Markdown", 0, 18, 0, 0, 0, 0, 0, 7, 25 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\README.md", "Markdown", 0, 38, 0, 0, 0, 0, 0, 12, 50 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\acs.py", "Python", 105, 0, 0, 0, 0, 0, 41, 47, 193 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\journal_fetcher.py", "Python", 59, 0, 0, 0, 0, 0, 25, 12, 96 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\nature.py", "Python", 21, 0, 0, 0, 0, 0, 23, 16, 60 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\template_.py", "Python", 10, 0, 0, 0, 0, 0, 31, 10, 51 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\interface.py", "Python", 46, 0, 0, 0, 0, 0, 47, 21, 114 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\publication.py", "Python", 80, 0, 0, 0, 0, 0, 49, 15, 144 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\requirements.txt", "pip requirements", 0, 0, 0, 0, 0, 2, 0, 0, 2 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\test\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\test\test_acs.py", "Python", 285, 0, 0, 0, 0, 0, 7, 11, 303 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\test\test_input.py", "Python", 40, 0, 0, 0, 0, 0, 28, 14, 82 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\README.md", "Markdown", 0, 2, 0, 0, 0, 0, 0, 2, 4 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\input_fj.py", "Python", 118, 0, 0, 0, 0, 0, 20, 17, 155 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\pub.py", "Python", 24, 0, 0, 0, 0, 0, 4, 5, 33 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\test.py", "Python", 11, 0, 0, 0, 0, 0, 1, 4, 16 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\README.md", "Markdown", 0, 40, 0, 0, 0, 0, 0, 6, 46 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\cn.js", "JavaScript", 0, 0, 0, 0, 347, 0, 134, 68, 549 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\index.html", "HTML", 0, 0, 0, 84, 0, 0, 8, 15, 107 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\json_text.json", "JSON", 0, 0, 819, 0, 0, 0, 0, 0, 819 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\start_script.py", "Python", 12, 0, 0, 0, 0, 0, 4, 4, 20 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\test.json", "JSON", 0, 0, 1, 0, 0, 0, 0, 0, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\ui_programm_fragmente\README.md", "Markdown", 0, 23, 0, 0, 0, 0, 0, 16, 39 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\ui_programm_fragmente\input_to_checklist.py", "Python", 144, 0, 0, 0, 0, 0, 9, 8, 161 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\ui_programm_fragmente\upload_to_checklist.py", "Python", 52, 0, 0, 0, 0, 0, 5, 22, 79 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\README.md", "Markdown", 0, 39, 0, 0, 0, 0, 0, 22, 61 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\README.md", "Markdown", 0, 18, 0, 0, 0, 0, 0, 11, 29 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\add_citations_rec.py", "Python", 140, 0, 0, 0, 0, 0, 15, 50, 205 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\export_to_json.py", "Python", 66, 0, 0, 0, 0, 0, 12, 13, 91 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\initialize_graph.py", "Python", 127, 0, 0, 0, 0, 0, 25, 45, 197 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\dev_files\README.md", "Markdown", 0, 1, 0, 0, 0, 0, 0, 0, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\dev_files\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\dev_files\print_graph_test.py", "Python", 53, 0, 0, 0, 0, 0, 36, 19, 108 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\get_pub_from_input.py", "Python", 27, 0, 0, 0, 0, 0, 12, 9, 48 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\process_main.py", "Python", 29, 0, 0, 0, 0, 0, 12, 15, 56 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\README.md", "Markdown", 0, 16, 0, 0, 0, 0, 0, 9, 25 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\construct_graph_unittest.py", "Python", 165, 0, 0, 0, 0, 0, 10, 56, 231 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\input_test.py", "Python", 83, 0, 0, 0, 0, 0, 0, 22, 105 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\update_graph_unittest.py", "Python", 125, 0, 0, 0, 0, 0, 4, 32, 161 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\README.md", "Markdown", 0, 24, 0, 0, 0, 0, 0, 17, 41 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\__init__.py", "Python", 0, 0, 0, 0, 0, 0, 0, 1, 1 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\compare_old_and_new_node_lists.py", "Python", 23, 0, 0, 0, 0, 0, 7, 8, 38 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\connect_new_input.py", "Python", 91, 0, 0, 0, 0, 0, 23, 39, 153 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\delete_nodes_edges.py", "Python", 62, 0, 0, 0, 0, 0, 13, 21, 96 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\import_from_json.py", "Python", 46, 0, 0, 0, 0, 0, 20, 25, 91 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\update_depth.py", "Python", 135, 0, 0, 0, 0, 0, 14, 46, 195 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\update_edges.py", "Python", 19, 0, 0, 0, 0, 0, 10, 9, 38 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\update_graph.py", "Python", 69, 0, 0, 0, 0, 0, 18, 30, 117 -"Total", "-", 2500, 241, 821, 168, 694, 2, 857, 956, 6239 \ No newline at end of file diff --git a/.VSCodeCounter/2022-01-05_11-11-20/results.md b/.VSCodeCounter/2022-01-05_11-11-20/results.md deleted file mode 100644 index c151a7d32c9afd6e29c26c8daac04077b5ba1b8d..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-11-20/results.md +++ /dev/null @@ -1,41 +0,0 @@ -# Summary - -Date : 2022-01-05 11:11:20 - -Directory c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung - -Total : 60 files, 4426 codes, 857 comments, 956 blanks, all 6239 lines - -[details](details.md) - -## Languages -| language | files | code | comment | blank | total | -| :--- | ---: | ---: | ---: | ---: | ---: | -| Python | 41 | 2,500 | 573 | 682 | 3,755 | -| JSON | 3 | 821 | 0 | 0 | 821 | -| JavaScript | 2 | 694 | 268 | 136 | 1,098 | -| Markdown | 11 | 241 | 0 | 108 | 349 | -| HTML | 2 | 168 | 16 | 30 | 214 | -| pip requirements | 1 | 2 | 0 | 0 | 2 | - -## Directories -| path | files | code | comment | blank | total | -| :--- | ---: | ---: | ---: | ---: | ---: | -| . | 60 | 4,426 | 857 | 956 | 6,239 | -| assets | 3 | 432 | 142 | 83 | 657 | -| input | 15 | 726 | 251 | 174 | 1,151 | -| input\.VSCodeCounter | 2 | 40 | 0 | 13 | 53 | -| input\.VSCodeCounter\2021-12-24_13-19-53 | 2 | 40 | 0 | 13 | 53 | -| input\get | 5 | 195 | 120 | 86 | 401 | -| input\test | 3 | 325 | 35 | 26 | 386 | -| input_old | 4 | 155 | 25 | 28 | 208 | -| output | 4 | 1,290 | 142 | 89 | 1,521 | -| output\graph | 3 | 1,250 | 142 | 83 | 1,475 | -| ui_programm_fragmente | 3 | 219 | 14 | 46 | 279 | -| verarbeitung | 26 | 1,358 | 231 | 503 | 2,092 | -| verarbeitung\construct_new_graph | 5 | 351 | 52 | 120 | 523 | -| verarbeitung\dev_files | 3 | 54 | 36 | 20 | 110 | -| verarbeitung\test | 5 | 389 | 14 | 120 | 523 | -| verarbeitung\update_graph | 9 | 469 | 105 | 196 | 770 | - -[details](details.md) \ No newline at end of file diff --git a/.VSCodeCounter/2022-01-05_11-11-20/results.txt b/.VSCodeCounter/2022-01-05_11-11-20/results.txt deleted file mode 100644 index 0327635ea105ae782fcbfaa999a93fb0c86e22b7..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-11-20/results.txt +++ /dev/null @@ -1,104 +0,0 @@ -Date : 2022-01-05 11:11:20 -Directory : c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung -Total : 60 files, 4426 codes, 857 comments, 956 blanks, all 6239 lines - -Languages -+------------------+------------+------------+------------+------------+------------+ -| language | files | code | comment | blank | total | -+------------------+------------+------------+------------+------------+------------+ -| Python | 41 | 2,500 | 573 | 682 | 3,755 | -| JSON | 3 | 821 | 0 | 0 | 821 | -| JavaScript | 2 | 694 | 268 | 136 | 1,098 | -| Markdown | 11 | 241 | 0 | 108 | 349 | -| HTML | 2 | 168 | 16 | 30 | 214 | -| pip requirements | 1 | 2 | 0 | 0 | 2 | -+------------------+------------+------------+------------+------------+------------+ - -Directories -+----------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| path | files | code | comment | blank | total | -+----------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| . | 60 | 4,426 | 857 | 956 | 6,239 | -| assets | 3 | 432 | 142 | 83 | 657 | -| input | 15 | 726 | 251 | 174 | 1,151 | -| input\.VSCodeCounter | 2 | 40 | 0 | 13 | 53 | -| input\.VSCodeCounter\2021-12-24_13-19-53 | 2 | 40 | 0 | 13 | 53 | -| input\get | 5 | 195 | 120 | 86 | 401 | -| input\test | 3 | 325 | 35 | 26 | 386 | -| input_old | 4 | 155 | 25 | 28 | 208 | -| output | 4 | 1,290 | 142 | 89 | 1,521 | -| output\graph | 3 | 1,250 | 142 | 83 | 1,475 | -| ui_programm_fragmente | 3 | 219 | 14 | 46 | 279 | -| verarbeitung | 26 | 1,358 | 231 | 503 | 2,092 | -| verarbeitung\construct_new_graph | 5 | 351 | 52 | 120 | 523 | -| verarbeitung\dev_files | 3 | 54 | 36 | 20 | 110 | -| verarbeitung\test | 5 | 389 | 14 | 120 | 523 | -| verarbeitung\update_graph | 9 | 469 | 105 | 196 | 770 | -+----------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ - -Files -+----------------------------------------------------------------------------------------------------------------------+------------------+------------+------------+------------+------------+ -| filename | language | code | comment | blank | total | -+----------------------------------------------------------------------------------------------------------------------+------------------+------------+------------+------------+------------+ -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\assets\cn.js | JavaScript | 347 | 134 | 68 | 549 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\assets\index.html | HTML | 84 | 8 | 15 | 107 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\assets\json_text.json | JSON | 1 | 0 | 0 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\citation_parser_ui.py | Python | 198 | 40 | 17 | 255 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\count_journal.py | Python | 29 | 4 | 8 | 41 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\example_input.py | Python | 6 | 4 | 4 | 14 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\.VSCodeCounter\2021-12-24_13-19-53\details.md | Markdown | 22 | 0 | 6 | 28 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\.VSCodeCounter\2021-12-24_13-19-53\results.md | Markdown | 18 | 0 | 7 | 25 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\README.md | Markdown | 38 | 0 | 12 | 50 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\acs.py | Python | 105 | 41 | 47 | 193 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\journal_fetcher.py | Python | 59 | 25 | 12 | 96 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\nature.py | Python | 21 | 23 | 16 | 60 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\get\template_.py | Python | 10 | 31 | 10 | 51 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\interface.py | Python | 46 | 47 | 21 | 114 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\publication.py | Python | 80 | 49 | 15 | 144 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\requirements.txt | pip requirements | 2 | 0 | 0 | 2 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\test\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\test\test_acs.py | Python | 285 | 7 | 11 | 303 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input\test\test_input.py | Python | 40 | 28 | 14 | 82 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\README.md | Markdown | 2 | 0 | 2 | 4 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\input_fj.py | Python | 118 | 20 | 17 | 155 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\pub.py | Python | 24 | 4 | 5 | 33 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\input_old\test.py | Python | 11 | 1 | 4 | 16 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\README.md | Markdown | 40 | 0 | 6 | 46 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\cn.js | JavaScript | 347 | 134 | 68 | 549 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\index.html | HTML | 84 | 8 | 15 | 107 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\json_text.json | JSON | 819 | 0 | 0 | 819 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\start_script.py | Python | 12 | 4 | 4 | 20 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\test.json | JSON | 1 | 0 | 0 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\ui_programm_fragmente\README.md | Markdown | 23 | 0 | 16 | 39 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\ui_programm_fragmente\input_to_checklist.py | Python | 144 | 9 | 8 | 161 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\ui_programm_fragmente\upload_to_checklist.py | Python | 52 | 5 | 22 | 79 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\README.md | Markdown | 39 | 0 | 22 | 61 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\README.md | Markdown | 18 | 0 | 11 | 29 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\add_citations_rec.py | Python | 140 | 15 | 50 | 205 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\export_to_json.py | Python | 66 | 12 | 13 | 91 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\construct_new_graph\initialize_graph.py | Python | 127 | 25 | 45 | 197 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\dev_files\README.md | Markdown | 1 | 0 | 0 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\dev_files\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\dev_files\print_graph_test.py | Python | 53 | 36 | 19 | 108 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\get_pub_from_input.py | Python | 27 | 12 | 9 | 48 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\process_main.py | Python | 29 | 12 | 15 | 56 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\README.md | Markdown | 16 | 0 | 9 | 25 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\construct_graph_unittest.py | Python | 165 | 10 | 56 | 231 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\input_test.py | Python | 83 | 0 | 22 | 105 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\test\update_graph_unittest.py | Python | 125 | 4 | 32 | 161 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\README.md | Markdown | 24 | 0 | 17 | 41 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\compare_old_and_new_node_lists.py | Python | 23 | 7 | 8 | 38 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\connect_new_input.py | Python | 91 | 23 | 39 | 153 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\delete_nodes_edges.py | Python | 62 | 13 | 21 | 96 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\import_from_json.py | Python | 46 | 20 | 25 | 91 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\update_depth.py | Python | 135 | 14 | 46 | 195 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\update_edges.py | Python | 19 | 10 | 9 | 38 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\verarbeitung\update_graph\update_graph.py | Python | 69 | 18 | 30 | 117 | -| Total | | 4,426 | 857 | 956 | 6,239 | -+----------------------------------------------------------------------------------------------------------------------+------------------+------------+------------+------------+------------+ \ No newline at end of file diff --git a/.VSCodeCounter/2022-01-05_11-23-29/details.md b/.VSCodeCounter/2022-01-05_11-23-29/details.md deleted file mode 100644 index 0e70130b691ea9a351f0c36230251bd4b9cf16bd..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-23-29/details.md +++ /dev/null @@ -1,19 +0,0 @@ -# Details - -Date : 2022-01-05 11:23:29 - -Directory c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output - -Total : 4 files, 1290 codes, 142 comments, 89 blanks, all 1521 lines - -[summary](results.md) - -## Files -| filename | language | code | comment | blank | total | -| :--- | :--- | ---: | ---: | ---: | ---: | -| [output/README.md](/output/README.md) | Markdown | 40 | 0 | 6 | 46 | -| [output/graph/cn.js](/output/graph/cn.js) | JavaScript | 347 | 134 | 68 | 549 | -| [output/graph/index.html](/output/graph/index.html) | HTML | 84 | 8 | 15 | 107 | -| [output/graph/json_text.json](/output/graph/json_text.json) | JSON | 819 | 0 | 0 | 819 | - -[summary](results.md) \ No newline at end of file diff --git a/.VSCodeCounter/2022-01-05_11-23-29/results.csv b/.VSCodeCounter/2022-01-05_11-23-29/results.csv deleted file mode 100644 index aa8e5c38deb738d27f159d0d911eadb6abf42e8a..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-23-29/results.csv +++ /dev/null @@ -1,6 +0,0 @@ -"filename", "language", "Markdown", "HTML", "JavaScript", "JSON", "comment", "blank", "total" -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\README.md", "Markdown", 40, 0, 0, 0, 0, 6, 46 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\cn.js", "JavaScript", 0, 0, 347, 0, 134, 68, 549 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\index.html", "HTML", 0, 84, 0, 0, 8, 15, 107 -"c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\json_text.json", "JSON", 0, 0, 0, 819, 0, 0, 819 -"Total", "-", 40, 84, 347, 819, 142, 89, 1521 \ No newline at end of file diff --git a/.VSCodeCounter/2022-01-05_11-23-29/results.md b/.VSCodeCounter/2022-01-05_11-23-29/results.md deleted file mode 100644 index e3c40ca3387db6b6a8c4a0e026bf732b686fa374..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-23-29/results.md +++ /dev/null @@ -1,25 +0,0 @@ -# Summary - -Date : 2022-01-05 11:23:29 - -Directory c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output - -Total : 4 files, 1290 codes, 142 comments, 89 blanks, all 1521 lines - -[details](details.md) - -## Languages -| language | files | code | comment | blank | total | -| :--- | ---: | ---: | ---: | ---: | ---: | -| JSON | 1 | 819 | 0 | 0 | 819 | -| JavaScript | 1 | 347 | 134 | 68 | 549 | -| HTML | 1 | 84 | 8 | 15 | 107 | -| Markdown | 1 | 40 | 0 | 6 | 46 | - -## Directories -| path | files | code | comment | blank | total | -| :--- | ---: | ---: | ---: | ---: | ---: | -| . | 4 | 1,290 | 142 | 89 | 1,521 | -| graph | 3 | 1,250 | 142 | 83 | 1,475 | - -[details](details.md) \ No newline at end of file diff --git a/.VSCodeCounter/2022-01-05_11-23-29/results.txt b/.VSCodeCounter/2022-01-05_11-23-29/results.txt deleted file mode 100644 index a71dc0ce078a7cad90eaf6b08532619188ff2b8e..0000000000000000000000000000000000000000 --- a/.VSCodeCounter/2022-01-05_11-23-29/results.txt +++ /dev/null @@ -1,32 +0,0 @@ -Date : 2022-01-05 11:23:29 -Directory : c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output -Total : 4 files, 1290 codes, 142 comments, 89 blanks, all 1521 lines - -Languages -+------------+------------+------------+------------+------------+------------+ -| language | files | code | comment | blank | total | -+------------+------------+------------+------------+------------+------------+ -| JSON | 1 | 819 | 0 | 0 | 819 | -| JavaScript | 1 | 347 | 134 | 68 | 549 | -| HTML | 1 | 84 | 8 | 15 | 107 | -| Markdown | 1 | 40 | 0 | 6 | 46 | -+------------+------------+------------+------------+------------+------------+ - -Directories -+--------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| path | files | code | comment | blank | total | -+--------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| . | 4 | 1,290 | 142 | 89 | 1,521 | -| graph | 3 | 1,250 | 142 | 83 | 1,475 | -+--------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ - -Files -+--------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| filename | language | code | comment | blank | total | -+--------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\README.md | Markdown | 40 | 0 | 6 | 46 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\cn.js | JavaScript | 347 | 134 | 68 | 549 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\index.html | HTML | 84 | 8 | 15 | 107 | -| c:\Users\Malte\Git\CiS-Projekt\ci-s-projekt-verarbeitung\output\graph\json_text.json | JSON | 819 | 0 | 0 | 819 | -| Total | | 1,290 | 142 | 89 | 1,521 | -+--------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+ \ No newline at end of file diff --git a/.gitignore b/.gitignore index df2eaf4579d8730d30a9b69b2e0568794c12e27f..8b23d3cc4a0b27822a26b0a473b2cf04f7213786 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,9 @@ Thumbs.db # Source for the following rules: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore # Byte-compiled / optimized / DLL files -__pycache__/ +.__pycache__/ *.py[cod] +*.pyc *$py.class # C extensions @@ -38,6 +39,7 @@ wheels/ *.egg-info/ .installed.cfg *.egg +.start_script.py MANIFEST # PyInstaller diff --git a/ui_programm_fragmente/README.md b/README.md similarity index 100% rename from ui_programm_fragmente/README.md rename to README.md diff --git a/output/README.md b/assets/README.md similarity index 100% rename from output/README.md rename to assets/README.md diff --git a/assets/cn.js b/assets/cn.js deleted file mode 100644 index 389935df5f1469ec2f152f0adc6995a72302fde7..0000000000000000000000000000000000000000 --- a/assets/cn.js +++ /dev/null @@ -1,561 +0,0 @@ -/** -* creates a new zoom behavior -*/ -var zoom = d3.zoom().on("zoom", handle_zoom); - -/** -* creates svg object and associated attributes -* applies the zoom behavior to svg -*/ -var svg = d3.select("svg.graph") - .call(zoom), -width = svg.attr("width"), -height = svg.attr("height"), -perc; - -/** -* scale functions that return y coordinate/color of node depending on group -*/ -var color = d3.scaleOrdinal() - .domain(["Citedby", "Input", "Reference"]) - .range([' #01d7c0', ' #8b90fe ', ' #a15eb2 ']), -y_scale = d3.scaleOrdinal() - .domain(["Citedby", "Input", "Reference"]) - .range([0, 200, 400]), -to_remove; - -/** -* creates node object and (default) radius -*/ -var node, -r = 10; - -/** -* creates link object -*/ -var link; - -/** -* creates a background with a click functionality -*/ -var rect = svg.append("rect") - .attr("x", 0) - .attr("y", 0) - .attr("height", height) - .attr("width", width) - .style("fill", 'white') - .on('click', click_rect); - -/** -* creates svg object (legend) and associated attributes -* transform -*/ -var svg_legend = d3.select("svg.legendsvg"), -legend_position = [65,95,125], -arrow_legend_position = [0,25], -arrow_group_names = ["citation","self-citation"], -group_names = ["cited by","input","reference"], -line_type = d3.scaleOrdinal() - .domain(["line","dotted"]) - .range([("8,0"),("8,8")]), -text_info = '', -text_abstract = ''; - -var legend = svg_legend.selectAll(".legend") - .data(legend_position) - .enter() - .append("g") - .attr("class","legend") - .attr("transform", function(d,i) {return "translate(0," + d + ")"; }); - -legend.append("text") - .attr("x", 80) - .attr("y", 0) - .attr("dy", ".35em") - .style("text-anchor", "start") - .text(function(d,i) {return group_names[i]}); - -legend.append("circle") - .attr("r", r) - .attr("cx",30-r) - .style("fill", color); - -var legend_arrow = svg_legend.selectAll(".legendarr") - .data(arrow_legend_position) - .enter() - .append("g") - .attr("class","legendarr") - .attr("transform", function(d) { return "translate(0," + d + ")"; }); - -legend_arrow.append("line") - .attr("x1", 10) - .attr("x2", 50) - .attr("y1", 10) - .attr("y2", 10) - .style("stroke-dasharray",line_type) - .style("stroke", '#999') - .style("stroke-width", "1px") - .style('pointer-events', 'none') - .attr('marker-end',update_marker('#999',this)); - -legend_arrow.append("text") - .attr("x", 80) - .attr("y", 10) - .attr("dy", ".35em") - .style("text-anchor", "start") - .text(function(d,i){return arrow_group_names[i]}); - -/** -* creates a new simulation -* updates the positions of the links and nodes when the - state of the layout has changed (simulation has advanced by a tick) -*/ -var simulation = d3.forceSimulation() - .force("link", d3.forceLink().id(function(d) {return d.doi;}).distance(50).strength(function(d) { - if (d.group == "Input") {return 0;} - else {return 5;} - })) - .force("collide", d3.forceCollide(function(d) { - if (d.group == "Input") {return 70;} - else {return 70;} - }).strength(0.5)) - .force("charge", d3.forceManyBody().strength(0.001)) - .force("center", d3.forceCenter(width/2, height/2+20)) - .force("yscale", d3.forceY().strength(function(d) { - if (d.group == "Input") {return 300;} - else {return 200;} - }).y(function(d) {return y_scale(d.group)})) - .alpha(0.004) - .on("end", zoom_to); - -/** -* creates group element -*/ -var g = svg.append("g") - .attr("class", "everything") - -/** -* loads JSON data and calls the update function -*/ -d3.json("json_text.json").then(function(graph) { - update(graph.links, graph.nodes); -}) - -var intervalId=window.setInterval(function(){ - d3.json("json_text.json").then(function(graph) { - newjson_string=JSON.stringify(graph) - var newjson = CryptoJS.MD5(newjson_string).toString(); - oldjson=localStorage.getItem("oldjson") - if(newjson !== oldjson){ - localStorage.setItem("oldjson", newjson); - window.location.reload() - } - }) -},5000); - -/** -* calls update functions for links and nodes -* adds the nodes, links and tick functionality to the simulation -* @param {object} nodes - nodes -* @param {object} links - links -*/ -function update(links, nodes) { - update_links(links); - update_nodes(nodes); - - simulation - .nodes(nodes) - .on("tick", handle_tick); - simulation.force("link") - .links(links); - - link.attr('marker-end', function(d) {return update_marker("#999", d.target);}) - .style("stroke-dasharray",function(d){return self_citation(d.source,d.target)? ("8,8"): ("1,0")}); -} - -/** -* initializes and shows links (edges) -* @param {object} links - links -*/ -function update_links(links) { - link = g.append("g") - .selectAll(".link") - .data(links) - .enter() - .append("line") - .style("stroke-width", "1px") - .style("stroke", "#999") - .attr("class", "link"); -} - -/** -* initializes and shows nodes with circles, texts and a click functionality -* creates a new drag behavior and applies it to the circles -* @param {object} nodes - nodes -*/ -function update_nodes(nodes) { - node = g.selectAll(".node") - .data(nodes) - .enter() - .append("g") - .attr("class", "node") - .call(d3.drag() - .on("start", start_drag) - .on("drag", dragged) - ); - - node.append("circle") - .attr("class", "circle") - .attr("r", function(d) {return 1.5*r+d.citations*0.05}) - .style("fill", function(d){ return color(d.group)}) - .on('click', click_node); - - node.append("text") - .attr("class", "text") - .style("font-size", "15px") - .style('pointer-events', 'auto') - .text(function (d) {const first_author=d.author[0].split(" ") - return first_author[first_author.length-1];}) - .on('click', click_node); -} - -/** -* creates arrowhead and returns its url -* @param {string} color - color of arrowhead -* @param {string} target - target node -*/ -function update_marker(color, target) { - var radius = 1.5*r+target.citations*0.05; - svg.append('defs').append('marker') - .attr('id',color.replace("#", "")+radius) - .attr('viewBox','-0 -5 10 10') - .attr('refX',radius+9.5) - .attr('refY',0) - .attr('orient','auto') - .attr('markerWidth',10) - .attr('markerHeight',15) - .attr('xoverflow','visible') - .append('svg:path') - .attr('d', 'M 0,-5 L 10 ,0 L 0,5') - .attr('fill', color) - .style('stroke','none'); - return "url(" + color + radius + ")"; -}; - -/** -* sets color of circle and its links to black and removes the previous highlights -* displays overview info of node in textbox -* @param {object} node - node -*/ -function click_node(node) { - d3.select(this.parentNode).raise(); - fix_nodes(node); - if(to_remove){ - d3.select(to_remove).selectAll(".circle").style("stroke","none") - } - to_remove = this.parentNode; - d3.select(this.parentNode).selectAll(".circle").style("stroke","black") - mark_link(node) - textbox_content(node) - reset_button_highlight() - highlight_button("overview") -} - -/** -* removes the highlights of the circles and their links -*/ -function click_rect() { - fix_nodes(node); - d3.selectAll(".circle").style("stroke", "none") - d3.selectAll(".link") - .style("stroke", "#999") - .attr('marker-end', function(d) {return update_marker('#999', d.target);}) - text_abstract=''; - text_info=''; - reset_button_highlight() - document.getElementById('textbox').innerHTML = "Click node"; -} - -/** -* returns true if journals have a common author (self-citation) -* @param {object} source - node -* @param {object} target - node -*/ -function self_citation(source,target) { - return source.author.some(item=>target.author.includes(item)) -} - -/** -* sets color of link (line and arrowhead) to black if it is directly connected to node -* and to grey otherwise -* @param {object} node - node -*/ -function mark_link(node) { - d3.selectAll(".link") - .style("stroke", function(o) { - return is_link_for_node(node, o) ? "black" : "#DEDEDE";}) - .attr('marker-end', function(o) { - return is_link_for_node(node, o) ? update_marker('#000000', o.target) : update_marker('#DEDEDE', o.target);}) -} - -/** -* returns true if link is directly connected to node and false if it is not -* @param {object} node - node -* @param {object} link - link -*/ -function is_link_for_node(node, link) { - return link.source.index == node.index || link.target.index == node.index; -} - -/** -* saves text for overview and abstract of node -* outputs node info to textbox -* @param {object} node - node -*/ -function textbox_content(node) { - text_info = "Title:" + '</br>' + node.name + - '</br>' +'</br>'+"Author:"+ '</br>' +node.author+'</br>'+'</br>'+"Date:"+'</br>' - +node.year+'</br>'+'</br>'+"Journal:"+'</br>'+node.journal+'</br>'+'</br>'+"doi:" - +'</br>'+'<a href="'+node.doi+ '">'+node.doi+'</a>'+'</br>'+'</br>'+"Citations:" - +'</br>'+node.citations; - text_abstract = node.abstract; - document.getElementById('textbox').innerHTML = text_info; -} - -/** -* sets color of btn to dark gray -* @param {object} btn - button -*/ -function highlight_button(btn) { - reset_button_highlight(); - document.getElementById(btn).style.background = "#CACACA"; -} - -/** -* sets color of all buttons to default light gray -*/ -function reset_button_highlight() { - document.getElementById("overview").style.background = ''; - document.getElementById("abstract").style.background = ''; -} - -/** -* displays abstract in textbox if a is true, overview text otherwise -* @param {bool} a- bool -*/ -function display_abstract(a) { - if (text_abstract == '' && text_info == '') { - document.getElementById('textbox').innerHTML="Click node"; - } - else { - if (a == true) { - document.getElementById('textbox').innerHTML = text_abstract; - } - else { - document.getElementById('textbox').innerHTML = text_info; - } - } -} - -/** -* updates the positions of the links and nodes -*/ -function handle_tick() { - link.attr("x1", function (d) {return d.source.x;}) - .attr("y1", function (d) {return d.source.y;}) - .attr("x2", function (d) {return d.target.x;}) - .attr("y2", function (d) {return d.target.y;}); - node.attr("transform", function (d) {return "translate(" + d.x + ", " + d.y + ")";}); -} - -/** -* initializes the dragging of the node -* @param {object} node - node -*/ -function start_drag(node) { - d3.select(this).raise(); - if (!d3.event.active) - simulation.alphaTarget(0.3).restart() - node.fx = node.x; - node.fy = node.y; - fix_nodes(node); -} - -/** -* applies the dragging to the node -* @param {object} node - node -*/ -function dragged(node) { - node.fx = d3.event.x; - node.fy = d3.event.y; - fix_nodes(node); -} - -/** -* fix positions of all nodes except for the current node -* @param {object} this_node - node -*/ -function fix_nodes(this_node) { - node.each(function(d) { - if (this_node != d) { - d.fx = d.x; - d.fy = d.y; - } - }); -} - -/** -* applies the transformation (zooming or dragging) to the g element -*/ -function handle_zoom() { - d3.select('g').attr("transform", d3.event.transform); -} - -/** -* transforms svg so that the zoom is adapted to the size of the graph -*/ -function zoom_to() { - node_bounds = d3.selectAll("svg.graph").node().getBBox(); - svg_bounds = d3.select("rect").node().getBBox(); - - perc_x = width/(node_bounds.width+100); - perc_y = height/(node_bounds.height+100); - perc = d3.min([perc_x, perc_y]) - - d3.select('svg') - .call(zoom.scaleBy, perc); -} - -/** -* transforms svg so that the zoom and drag is reset -*/ -function reset_view() { - d3.select('svg') - .call(zoom.scaleTo, 1) - d3.select('svg') - .call(zoom.translateTo, 0.5 * width, 0.5 * height); - d3.select('svg') - .call(zoom.scaleBy, perc); -} - -/** -* save svg as png -*/ -function save_svg(){ - var svgString = get_svg_string(svg.node()); - svg_string_to_image(svgString, 2*width, 2*height, 'png', save); // passes Blob and filesize String to the callback - - function save( dataBlob, filesize ){ - saveAs(dataBlob, 'D3 vis exported to PNG.png'); // FileSaver.js function - } -}; - -/** -* generate svgString -* @param {object} svgNode - node -*/ -function get_svg_string(svgNode) { - svgNode.setAttribute('xlink', 'http://www.w3.org/1999/xlink'); - var cssStyleText = get_css_styles(svgNode); - append_css(cssStyleText, svgNode); - - var serializer = new XMLSerializer(); - var svgString = serializer.serializeToString(svgNode); - svgString = svgString.replace(/(\w+)?:?xlink=/g, 'xmlns:xlink='); // Fix root xlink without namespace - svgString = svgString.replace(/NS\d+:href/g, 'xlink:href'); // Safari NS namespace fix - - return svgString; - - function get_css_styles(parentElement) { - var selectorTextArr = []; - - // Add Parent element Id and Classes to the list - selectorTextArr.push('#' + parentElement.id); - for (var c = 0; c < parentElement.classList.length; c++) - if (!contains('.'+parentElement.classList[c], selectorTextArr)) - selectorTextArr.push('.'+parentElement.classList[c]); - - // Add Children element Ids and Classes to the list - var nodes = parentElement.getElementsByTagName("*"); - for (var i = 0; i < nodes.length; i++) { - var id = nodes[i].id; - if (!contains('#'+id, selectorTextArr)) - selectorTextArr.push('#' + id); - - var classes = nodes[i].classList; - for (var c = 0; c < classes.length; c++) - if (!contains('.'+classes[c], selectorTextArr)) - selectorTextArr.push('.'+classes[c]); - } - - // Extract CSS Rules - var extractedCSSText = ""; - for (var i = 0; i < document.styleSheets.length; i++) { - var s = document.styleSheets[i]; - - try { - if(!s.cssRules) continue; - } catch(e) { - if(e.name !== 'SecurityError') throw e; // for Firefox - continue; - } - - var cssRules = s.cssRules; - for (var r = 0; r < cssRules.length; r++) { - if (contains(cssRules[r].selectorText, selectorTextArr)) - extractedCSSText += cssRules[r].cssText; - } - } - - - return extractedCSSText; - - function contains(str,arr) { - return arr.indexOf(str) === -1 ? false : true; - } - - } - - function append_css(cssText, element) { - var styleElement = document.createElement("style"); - styleElement.setAttribute("type","text/css"); - styleElement.innerHTML = cssText; - var refNode = element.hasChildNodes() ? element.children[0] : null; - element.insertBefore(styleElement, refNode); - } -} - -/** -* convert svgString to image and export it -* @param {object} svgString - svgString -* @param {object} width - width of image -* @param {object} height - height of image -* @param {object} format - format to save image in -* @param {object} callback - callback function -*/ -function svg_string_to_image( svgString, width, height, format, callback ) { - var format = format ? format : 'png'; - - var imgsrc = 'data:image/svg+xml;base64,'+ btoa(unescape(encodeURIComponent(svgString))); // Convert SVG string to data URL - - var canvas = document.createElement("canvas"); - var context = canvas.getContext("2d"); - - canvas.width = width; - canvas.height = height; - - var image = new Image(); - image.onload = function() { - context.clearRect(0, 0, width, height); - context.drawImage(image, 0, 0, width, height); - - canvas.toBlob(function(blob) { - var filesize = Math.round(blob.length/1024) + ' KB'; - if (callback) callback(blob, filesize); - }); - - }; - - image.src = imgsrc; -} - diff --git a/output/graph/cn.js b/assets/cn_default.js similarity index 94% rename from output/graph/cn.js rename to assets/cn_default.js index 389935df5f1469ec2f152f0adc6995a72302fde7..efa888526d9b244937a4ebe334d4e9bd198e9756 100644 --- a/output/graph/cn.js +++ b/assets/cn_default.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]), @@ -53,8 +53,8 @@ var rect = svg.append("rect") var svg_legend = d3.select("svg.legendsvg"), legend_position = [65,95,125], arrow_legend_position = [0,25], -arrow_group_names = ["citation","self-citation"], -group_names = ["cited by","input","reference"], +arrow_group_names = ["Citation","Self-Citation"], +group_names = ["Cited-by","Input","Reference"], line_type = d3.scaleOrdinal() .domain(["line","dotted"]) .range([("8,0"),("8,8")]), @@ -120,7 +120,7 @@ var simulation = d3.forceSimulation() else {return 70;} }).strength(0.5)) .force("charge", d3.forceManyBody().strength(0.001)) - .force("center", d3.forceCenter(width/2, height/2+20)) + .force("center", d3.forceCenter(width/2-20, height/2+20)) .force("yscale", d3.forceY().strength(function(d) { if (d.group == "Input") {return 300;} else {return 200;} @@ -137,9 +137,14 @@ var g = svg.append("g") /** * loads JSON data and calls the update function */ -d3.json("json_text.json").then(function(graph) { +d3.json("json_text.json").then(success,failure) +function success(graph){ update(graph.links, graph.nodes); -}) + +} +function failure(graph){ + localStorage.setItem("oldjson","irgendwaswasimmergespeichertwirdwennkeinejsondaist") +} var intervalId=window.setInterval(function(){ d3.json("json_text.json").then(function(graph) { @@ -206,7 +211,7 @@ function update_nodes(nodes) { node.append("circle") .attr("class", "circle") - .attr("r", function(d) {return 1.5*r+d.citations*0.05}) + .attr("r", function(d) {return 1.5*r+d.citations*0.15}) .style("fill", function(d){ return color(d.group)}) .on('click', click_node); @@ -225,7 +230,7 @@ function update_nodes(nodes) { * @param {string} target - target node */ function update_marker(color, target) { - var radius = 1.5*r+target.citations*0.05; + var radius = 1.5*r+target.citations*0.15; svg.append('defs').append('marker') .attr('id',color.replace("#", "")+radius) .attr('viewBox','-0 -5 10 10') @@ -313,10 +318,14 @@ function is_link_for_node(node, link) { * @param {object} node - node */ function textbox_content(node) { + authors = node.author[0] + for (i = 1; i < node.author.length; i++) { + authors += (", "+node.author[i]) + } text_info = "Title:" + '</br>' + node.name + - '</br>' +'</br>'+"Author:"+ '</br>' +node.author+'</br>'+'</br>'+"Date:"+'</br>' - +node.year+'</br>'+'</br>'+"Journal:"+'</br>'+node.journal+'</br>'+'</br>'+"doi:" - +'</br>'+'<a href="'+node.doi+ '">'+node.doi+'</a>'+'</br>'+'</br>'+"Citations:" + '</br>' +'</br>'+"Author:"+ '</br>' +authors+'</br>'+'</br>'+"Date:"+'</br>' + +node.year+'</br>'+'</br>'+"Journal:"+'</br>'+node.journal+'</br>'+'</br>'+"DOI:" + +'</br>'+node.doi+'</br>'+'</br>'+"Citations:" +'</br>'+node.citations; text_abstract = node.abstract; document.getElementById('textbox').innerHTML = text_info; @@ -369,7 +378,7 @@ function handle_tick() { } /** -* initializes the dragging of the node +* initializes dragging of the node * @param {object} node - node */ function start_drag(node) { @@ -382,7 +391,7 @@ function start_drag(node) { } /** -* applies the dragging to the node +* applies dragging to the node * @param {object} node - node */ function dragged(node) { @@ -558,4 +567,3 @@ function svg_string_to_image( svgString, width, height, format, callback ) { image.src = imgsrc; } - diff --git a/assets/cn2.js b/assets/cn_timeline.js similarity index 91% rename from assets/cn2.js rename to assets/cn_timeline.js index dce918d24e11ba191318915544fd9c8179eb9414..900cc2ab968572a4b9ccad7e0cb34233802f6891 100644 --- a/assets/cn2.js +++ b/assets/cn_timeline.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]), @@ -49,13 +49,12 @@ var rect = svg.append("rect") /** * creates svg object (legend) and associated attributes * transform -* mehr kommentare */ var svg_legend = d3.select("svg.legendsvg"), legend_position = [65,95,125], arrow_legend_position = [0,25], -arrow_group_names = ["citation","self-citation"], -group_names = ["cited by","input","reference"], +arrow_group_names = ["Citation","Self-Citation"], +group_names = ["Cited-by","Input","Reference"], line_type = d3.scaleOrdinal() .domain(["line","dotted"]) .range([("8,0"),("8,8")]), @@ -122,8 +121,9 @@ var simulation = d3.forceSimulation() else {return 75;} }).strength(1)) .force("charge", d3.forceManyBody().strength(0.001)) - .force("center", d3.forceCenter(width/2, height/2+20)) + .force("center", d3.forceCenter(width/2-20, height/2+40)) .alpha(0.004) + .velocityDecay(0.65) .on("end", zoom_to); /** @@ -136,8 +136,8 @@ var g = svg.append("g") * creates xAxis element */ var xAxis = d3.axisBottom() - .tickFormat(function(d) {return d;}) - .ticks(10);; + .tickFormat(function(d) {if (d%1==0) return d;}) + .ticks(10); /** * draw xAxis @@ -146,18 +146,24 @@ var gX = svg.append("g") .attr("class", "axis axis--x") .attr("transform", "translate(0,25)") gX.append("text") - .attr("y", 0) - .attr("x", 80) + .attr("y", -5) + .attr("x", 85) .attr("text-anchor", "end") - .attr("stroke", "black") - .text("year"); + .style('fill', 'black') + .text("Year") + .style("font-size", "15px"); /** * loads JSON data and calls the update function */ -d3.json("json_text.json").then(function(graph) { +d3.json("json_text.json").then(success,failure) +function success(graph){ update(graph.links, graph.nodes); -}) +} + +function failure(graph){ + localStorage.setItem("oldjson","irgendwaswasimmergespeichertwirdwennkeinejsondaist") +} var intervalId=window.setInterval(function(){ d3.json("json_text.json").then(function(graph) { @@ -199,12 +205,12 @@ function update(links, nodes) { function updateXAxis(nodes) { years = []; for (i = 0; i < nodes.length; i++) { - years.push(parseInt((nodes[i]["year"]).split(" ")[2])); + years.push(parseInt(parseInt(/\d{4}\s*$/.exec(nodes[i]["year"])))); } xscale = d3.scaleLinear() .domain([d3.min(years)-1, d3.max(years)+1]) - .range([50, width-50]) + .range([1, width-1]) xAxis.scale(xscale); gX.call(xAxis); @@ -243,7 +249,7 @@ function update_nodes(nodes) { node.append("circle") .attr("class", "circle") - .attr("r", function(d) {return 1.5*r+d.citations*0.05}) + .attr("r", function(d) {return 1.5*r+d.citations*0.15}) .style("fill", function(d){ return color(d.group)}) .on('click', click_node); @@ -262,7 +268,7 @@ function update_nodes(nodes) { * @param {string} target - target node */ function update_marker(color, target) { - var radius = 1.5*r+target.citations*0.05; + var radius = 1.5*r+target.citations*0.15; svg.append('defs').append('marker') .attr('id',color.replace("#", "")+radius) .attr('viewBox','-0 -5 10 10') @@ -285,6 +291,7 @@ function update_marker(color, target) { * @param {object} node - node */ function click_node(node) { + d3.select(this.parentNode).raise(); fix_nodes(node); if(to_remove){ @@ -344,16 +351,24 @@ function is_link_for_node(node, link) { return link.source.index == node.index || link.target.index == node.index; } + + /** * saves text for overview and abstract of node * outputs node info to textbox * @param {object} node - node */ + + function textbox_content(node) { + authors = node.author[0] + for (i = 1; i < node.author.length; i++) { + authors += (", "+node.author[i]) + } text_info = "Title:" + '</br>' + node.name + - '</br>' +'</br>'+"Author:"+ '</br>' +node.author+'</br>'+'</br>'+"Date:"+'</br>' - +node.year+'</br>'+'</br>'+"Journal:"+'</br>'+node.journal+'</br>'+'</br>'+"doi:" - +'</br>'+'<a href="'+node.doi+ '">'+node.doi+'</a>'+'</br>'+'</br>'+"Citations:" + '</br>' +'</br>'+"Author:"+ '</br>' +authors+'</br>'+'</br>'+"Date:"+'</br>' + +node.year+'</br>'+'</br>'+"Journal:"+'</br>'+node.journal+'</br>'+'</br>'+"DOI:" + +'</br>'+node.doi+'</br>'+'</br>'+"Citations:" +'</br>'+node.citations; text_abstract = node.abstract; document.getElementById('textbox').innerHTML = text_info; @@ -398,11 +413,11 @@ function display_abstract(a) { * updates the positions of the links and nodes */ function handle_tick() { - link.attr("x1", function (d) {return xscale(parseInt((d.source.year).split(" ")[2]));}) + link.attr("x1", function (d) {return xscale(parseInt(/\d{4}\s*$/.exec(d.source.year)));}) .attr("y1", function (d) {return d.source.y;}) - .attr("x2", function (d) {return xscale(parseInt((d.target.year).split(" ")[2]));}) + .attr("x2", function (d) {return xscale(parseInt(/\d{4}\s*$/.exec(d.target.year)));}) .attr("y2", function (d) {return d.target.y;}); - node.attr("transform", function (d) {return "translate(" + xscale(parseInt((d.year).split(" ")[2])) + ", " + d.y + ")";}); + node.attr("transform", function (d) {return "translate(" + xscale(parseInt(/\d{4}\s*$/.exec(d.year))) + ", " + d.y + ")";}); } /** @@ -597,4 +612,3 @@ function svg_string_to_image( svgString, width, height, format, callback ) { image.src = imgsrc; } - diff --git a/assets/index.html b/assets/index.html index 374abe283271574e67bd8d73e3691ef35b9e782d..72477ea7b9ed378ee590d170bdaab71c45b1b58e 100644 --- a/assets/index.html +++ b/assets/index.html @@ -7,18 +7,18 @@ <style type="text/css"> button { width: 100px; - height:20px; + height: 20px; display: flex; justify-content: center; position: absolute; - left: 455px; - top: 575px; + left: 180px; + top: 580px; transition-duration: 0.4s; - border-radius:3px; - border:1px solid #909090; + border-radius: 3px; + border: 1px solid #909090; } - button.display{ + button.display { width: 120px; top: 0px; margin-left: 100px; @@ -37,57 +37,61 @@ } button.abstract { - width:146px; - position:absolute; + width: 146px; + position: absolute; top: 181px; - left: 1114px; - border-radius:0; - border:1px solid #909090; + left: 834px; + border-radius: 0; + border: 1px solid #909090; } button.overview { - width:147px; - position:absolute; - display:inline-block; + width: 147px; + position: absolute; + display: inline-block; top: 181px; - left: 968px; - border-radius:0; - border:1px solid #909090; + left: 688px; + border-radius: 0; + border: 1px solid #909090; } div.legendbox { - width:270px; - height:170px; + width: 270px; + height: 170px; padding: 10px; - /*border: 1px solid #999;*/ position: absolute; top: 10px; - left: 968px; + left: 688px; display: inline-block; margin: 0; } div.textbox { - width:270px; - min-height:200px; - max-height:370px; + width: 270px; + min-height: 200px; + max-height: 375px; padding: 10px; border: 1px solid #999; position: absolute; top: 200px; - left: 968px; + left: 688px; display: inline-block; overflow-y: scroll; margin: 0; } + + svg.graph { + position: absolute; + top: 20px; + } </style> </head> <body> - <button id="change_graph" class="display" onclick="display()">display timeline</button> + <button id="change_graph" class="display" onclick="display()">Display Timeline</button> - <!-- graph --> - <svg class="graph" width="960" height="560"></svg> + <!-- graph 576--> + <svg class="graph" width="680" height="560"></svg> <p id="oldjson"></p> <!-- legend --> @@ -114,59 +118,56 @@ <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/md5.js"></script> <script type="text/javascript" > - if(window.location.hash=='#default'){ - document.getElementById("change_graph").innerHTML = 'display timeline'; + if (window.location.hash=='#default') { + document.getElementById("change_graph").innerHTML = 'Display Timeline'; + load_default(); + } + else if (window.location.hash=='#time') { + document.getElementById("change_graph").innerHTML = 'Display Default'; + load_time(); + } + else if (window.location.hash=='') { + window.location.hash = 'default'; + document.getElementById("change_graph").innerHTML = 'Display Timeline'; load_default(); + } + function display(){ + if (window.location.hash=='#time') { + display_default(); + } + else if (window.location.hash=='#default'){ + display_time(); + } } - else if(window.location.hash=='#time'){ - document.getElementById("change_graph").innerHTML = 'display default'; - load_time(); + function display_default() { + window.location.hash = 'default'; + window.location.reload(); } - else if(window.location.hash==''){ - window.location.hash = 'default'; - document.getElementById("change_graph").innerHTML = 'display timeline'; - load_default(); + + function display_time() { + window.location.hash = 'time'; + window.location.reload(); } - function display(){ - if(window.location.hash=='#time'){ - display_default(); - } - else if(window.location.hash=='#default'){ - display_time(); - } + + function load_default() { + var htmlHeader = document.getElementsByTagName("head")[0]; + var myScript = document.createElement('script'); + myScript.type = 'text/javascript'; + myScript.src = 'cn_default.js'; + myScript.id='abc'; + htmlHeader.appendChild(myScript); } - function display_default(){ - window.location.hash = 'default'; - window.location.reload(); - } - function display_time(){ - window.location.hash = 'time'; - window.location.reload(); - - } - function load_default(){ - var htmlHeader = document.getElementsByTagName("head")[0]; - var myScript = document.createElement('script'); - myScript.type = 'text/javascript'; - myScript.src = 'cn.js'; - myScript.id='abc'; - htmlHeader.appendChild(myScript); - } - function load_time(){ - var htmlHeader = document.getElementsByTagName("head")[0]; - var myScript = document.createElement('script'); - myScript.type = 'text/javascript'; - myScript.src = 'cn2.js'; - myScript.id='abc'; - htmlHeader.appendChild(myScript); - - } - </script> - - <!-- javascript for force-directed graph - <script type="text/javascript" id="cn" src="cn.js"></script> --> + function load_time() { + var htmlHeader = document.getElementsByTagName("head")[0]; + var myScript = document.createElement('script'); + myScript.type = 'text/javascript'; + myScript.src = 'cn_timeline.js'; + myScript.id='abc'; + htmlHeader.appendChild(myScript); + } + </script> </body> </html> \ No newline at end of file diff --git a/citation_parser_main.py b/citation_parser_main.py index 0b7e6886de198c4f5793622da6c361b55a96ae94..45e0321ce56703512330b7748cffde1b9748a515 100644 --- a/citation_parser_main.py +++ b/citation_parser_main.py @@ -38,7 +38,7 @@ html.Div(children=[ 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, ), @@ -49,7 +49,7 @@ html.Div(children=[ # 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": "322px", 'margin-top': "10px"}, ), ]),size="lg", color="primary", type="border", fullscreen=True,), @@ -58,12 +58,12 @@ html.Div(children=[ "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"}, ), " 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. dbc.Spinner(dcc.Upload( @@ -72,14 +72,22 @@ html.Div(children=[ #Drag and drop or click to select a file to upload ["Drag and drop"]), style={ +<<<<<<< HEAD:citation_parser_main.py "width": "400px", +======= + "width": "360px", +>>>>>>> main:citation_parser_ui.py "height": "60px", "lineHeight": "60px", "borderWidth": "1px", "borderStyle": "dashed", "borderRadius": "5px", "textAlign": "center", +<<<<<<< HEAD:citation_parser_main.py "margin": "10px", +======= + "margin": "10px" +>>>>>>> main:citation_parser_ui.py }),size="lg", color="primary", type="border", fullscreen=True,), ]), @@ -105,17 +113,28 @@ html.Div(children=[ dcc.Checklist(id='additional-options', options=[{'label':k,'value':k} for k in additional_options], value=[],labelStyle = dict(display= 'block')) +<<<<<<< HEAD:citation_parser_main.py ]), +======= + ],style={'margin-top': "50px"}), +>>>>>>> main:citation_parser_ui.py ], style={'padding': 10, 'flex': 0.8}), html.Div(children=[ # Layer 5: For the Graph and corresponding error messages dbc.Spinner(html.Div([ +<<<<<<< HEAD:citation_parser_main.py html.Div(id='generate-graph-error',style={'color':'red'}), html.Iframe( src="assets/index.html", style={"height": "650px", "width": "100%"}, +======= + html.Div(id='generate-graph-error',style={'color':'red', 'position': "absolute", 'margin-top': "650px"}), + html.Iframe( + src="assets/index.html", + style={"height": "650px", "width": "1000px"}, +>>>>>>> main:citation_parser_ui.py ), ]),size="lg", color="primary", type="border", fullscreen=True,), ], style={'padding': 10, 'flex': 1.2}) @@ -282,17 +301,22 @@ def generate_output(n_clicks,all_inputs,forward_depth,backward_depth,additional_ changed_id = [p['prop_id'] for p in callback_context.triggered][0] if n_clicks is None: raise PreventUpdate + # This branch is entered when 'Generate Graph' is pushed or 'Update Automatically' is selected + # and the checklist or recursion depths are changed. elif 'Update Automatically' in additional_options \ or 'start-button' in changed_id: input_links = [x['value'] for x in all_inputs] + # Processing only returns a potential error message. The data for the graph is simply saved + # in the specified file. errors = Processing(input_links,int(forward_depth),int(backward_depth),'assets/json_text.json') if errors: + # This construct is needed because dash removes white spaces and newlines when concatinating + # strings with '\n'.join(...) or similar methods. message = ['The following inputs are invalid and were not used:'] for error in errors: message.append(html.Br()) message.append(error) message = html.P(message) - #message = [html.P(error) for error in errors] return message if __name__ == '__main__': diff --git a/count_journal.py b/count_journal.py deleted file mode 100755 index 13886a2e7badf339bdd23475f7d3de713329f472..0000000000000000000000000000000000000000 --- a/count_journal.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 - -from input.interface import InputInterface as Input - -def count_journals(url: str): - inter = Input() - pub = inter.get_publication(url) - - if pub.citations: - for citation in pub.citations: - journal = citation.journal - if journal in cit: - cit[journal] += 1 - else: - cit[journal] = 1 - - if pub.references: - for reference in pub.references: - journal = reference.journal - if journal in cit: - cit[journal] += 1 - else: - cit[journal] = 1 - -if __name__ == "__main__": - cit = {} - - count_journals("https://doi.org/10.1021/acs.jcim.1c00203") - count_journals("https://doi.org/10.1021/acs.jcim.6b00561") - count_journals("https://doi.org/10.1021/acs.jcim.6b00613") - count_journals("https://doi.org/10.1021/acs.jcim.1c00917") - count_journals("https://doi.org/10.1021/acs.jmedchem.0c01332") - #count_journals("https://pubs.acs.org/doi/10.1021/acs.biochem.1c00290") - #count_journals("https://pubs.acs.org/doi/10.1021/acsenvironau.1c00007") - #count_journals("https://pubs.acs.org/doi/10.1021/acs.biochem.7b01162") - - cit = dict(sorted(cit.items(), key=lambda item: item[1])) - for journal in cit: - if journal != "": - print(f'{journal}: {cit[journal]}') diff --git a/example_input.py b/example_input.py deleted file mode 100755 index c9bca4189fce4c1fd0a0dfc42ef4e517baa5f406..0000000000000000000000000000000000000000 --- a/example_input.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -from input.interface import InputInterface as Input - -def main(url: str): - i = Input() - #print(i.get_publication(url)) - print(i.get_pub_light(url)) - # print(i.get_supported_fetchers()) Useless because all classes are called the same - -if __name__ == "__main__": - #main("https://doi.org/10.1021/acs.jcim.1c0023") - main("https://doi.org/10.1021/acs.jcim.5b00332") diff --git a/info_box.txt b/info_box.txt index cd539241042c267b186893e62883038a67819fed..8f5017b51ed12f9e8a697b6b7c6484430e4caf82 100644 --- a/info_box.txt +++ b/info_box.txt @@ -1,8 +1,14 @@ Deutsch +<<<<<<< HEAD Bei Eingabe eines DOI ("Digital Object Identifier") oder Hyperlinks zu einem wissenschaftlichen Artikel ist es diesem Programm möglich die Zitierungs-Beziehungen zwischen diesen wissenschaftlichen Artikeln, mittels eines Graphen visuell darzustellen. Smart Input: direkte Überprüfung der Eingabe auf Richtigkeit zudem wird nicht mehr der DOI angezeigt sondern: +======= +Bei Eingabe eines DOI ("Digital Object Identifier") oder Hyperlinks zu einem wissenschaftlichen Artikel ist es diesem Programm möglich, die Zitierungs-Beziehungen zwischen diesen wissenschaftlichen Artikeln mittels eines Graphen visuell darzustellen. + +Smart Input: direkte Überprüfung der Eingabe auf Korrektheit, zudem wird nicht mehr der DOI angezeigt sondern: +>>>>>>> main Der Autor, Das Journal, Das Veröffentlichungsdatum. (muss vor Hinzufügen aktiviert worden sein) @@ -11,4 +17,8 @@ English By entering a DOI ("Digital Object Identifier") or hyperlink to a scientific article, this program is able to visualize the citation relationships between these scientific articles using a graph. Smart Input: Direct verification for correctness of the input. In addition, the DOI is no longer displayed but: -The Author, The Journal, The Publication Date. (must be activated before adding the DOI) \ No newline at end of file +<<<<<<< HEAD +The Author, The Journal, The Publication Date. (must be activated before adding the DOI) +======= +The Author, The Journal, The Publication Date. (must be activated before adding the DOI) +>>>>>>> main diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/details.md b/input/.VSCodeCounter/2021-12-24_13-19-53/details.md deleted file mode 100644 index 92cb09557c39cd9ebb3217836e595927a3d7ae52..0000000000000000000000000000000000000000 --- a/input/.VSCodeCounter/2021-12-24_13-19-53/details.md +++ /dev/null @@ -1,28 +0,0 @@ -# Details - -Date : 2021-12-24 13:19:53 - -Directory c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input - -Total : 13 files, 686 codes, 251 comments, 161 blanks, all 1098 lines - -[summary](results.md) - -## Files -| filename | language | code | comment | blank | total | -| :--- | :--- | ---: | ---: | ---: | ---: | -| [README.md](/README.md) | Markdown | 38 | 0 | 12 | 50 | -| [__init__.py](/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [get/__init__.py](/get/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [get/acs.py](/get/acs.py) | Python | 105 | 41 | 47 | 193 | -| [get/journal_fetcher.py](/get/journal_fetcher.py) | Python | 59 | 25 | 12 | 96 | -| [get/nature.py](/get/nature.py) | Python | 21 | 23 | 16 | 60 | -| [get/template_.py](/get/template_.py) | Python | 10 | 31 | 10 | 51 | -| [interface.py](/interface.py) | Python | 46 | 47 | 21 | 114 | -| [publication.py](/publication.py) | Python | 80 | 49 | 15 | 144 | -| [requirements.txt](/requirements.txt) | pip requirements | 2 | 0 | 0 | 2 | -| [test/__init__.py](/test/__init__.py) | Python | 0 | 0 | 1 | 1 | -| [test/test_acs.py](/test/test_acs.py) | Python | 285 | 7 | 11 | 303 | -| [test/test_input.py](/test/test_input.py) | Python | 40 | 28 | 14 | 82 | - -[summary](results.md) \ No newline at end of file diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/results.csv b/input/.VSCodeCounter/2021-12-24_13-19-53/results.csv deleted file mode 100644 index 77ac68ce0727afa9a371eae468a7fc13e6cb360c..0000000000000000000000000000000000000000 --- a/input/.VSCodeCounter/2021-12-24_13-19-53/results.csv +++ /dev/null @@ -1,15 +0,0 @@ -"filename", "language", "Python", "pip requirements", "Markdown", "comment", "blank", "total" -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\README.md", "Markdown", 0, 0, 38, 0, 12, 50 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\__init__.py", "Python", 0, 0, 0, 0, 1, 1 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\__init__.py", "Python", 0, 0, 0, 0, 1, 1 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\acs.py", "Python", 105, 0, 0, 41, 47, 193 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\journal_fetcher.py", "Python", 59, 0, 0, 25, 12, 96 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\nature.py", "Python", 21, 0, 0, 23, 16, 60 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\template_.py", "Python", 10, 0, 0, 31, 10, 51 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\interface.py", "Python", 46, 0, 0, 47, 21, 114 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\publication.py", "Python", 80, 0, 0, 49, 15, 144 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\requirements.txt", "pip requirements", 0, 2, 0, 0, 0, 2 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\__init__.py", "Python", 0, 0, 0, 0, 1, 1 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_acs.py", "Python", 285, 0, 0, 7, 11, 303 -"c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_input.py", "Python", 40, 0, 0, 28, 14, 82 -"Total", "-", 646, 2, 38, 251, 161, 1098 \ No newline at end of file diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/results.md b/input/.VSCodeCounter/2021-12-24_13-19-53/results.md deleted file mode 100644 index dd9bc10e465df85327b145db801d55454660abce..0000000000000000000000000000000000000000 --- a/input/.VSCodeCounter/2021-12-24_13-19-53/results.md +++ /dev/null @@ -1,25 +0,0 @@ -# Summary - -Date : 2021-12-24 13:19:53 - -Directory c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input - -Total : 13 files, 686 codes, 251 comments, 161 blanks, all 1098 lines - -[details](details.md) - -## Languages -| language | files | code | comment | blank | total | -| :--- | ---: | ---: | ---: | ---: | ---: | -| Python | 11 | 646 | 251 | 149 | 1,046 | -| Markdown | 1 | 38 | 0 | 12 | 50 | -| pip requirements | 1 | 2 | 0 | 0 | 2 | - -## Directories -| path | files | code | comment | blank | total | -| :--- | ---: | ---: | ---: | ---: | ---: | -| . | 13 | 686 | 251 | 161 | 1,098 | -| get | 5 | 195 | 120 | 86 | 401 | -| test | 3 | 325 | 35 | 26 | 386 | - -[details](details.md) \ No newline at end of file diff --git a/input/.VSCodeCounter/2021-12-24_13-19-53/results.txt b/input/.VSCodeCounter/2021-12-24_13-19-53/results.txt deleted file mode 100644 index 8a04330b72336fd3ca4b5f8ca7203efb17167ca9..0000000000000000000000000000000000000000 --- a/input/.VSCodeCounter/2021-12-24_13-19-53/results.txt +++ /dev/null @@ -1,41 +0,0 @@ -Date : 2021-12-24 13:19:53 -Directory : c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input -Total : 13 files, 686 codes, 251 comments, 161 blanks, all 1098 lines - -Languages -+------------------+------------+------------+------------+------------+------------+ -| language | files | code | comment | blank | total | -+------------------+------------+------------+------------+------------+------------+ -| Python | 11 | 646 | 251 | 149 | 1,046 | -| Markdown | 1 | 38 | 0 | 12 | 50 | -| pip requirements | 1 | 2 | 0 | 0 | 2 | -+------------------+------------+------------+------------+------------+------------+ - -Directories -+---------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| path | files | code | comment | blank | total | -+---------------------------------------------------------------------------+------------+------------+------------+------------+------------+ -| . | 13 | 686 | 251 | 161 | 1,098 | -| get | 5 | 195 | 120 | 86 | 401 | -| test | 3 | 325 | 35 | 26 | 386 | -+---------------------------------------------------------------------------+------------+------------+------------+------------+------------+ - -Files -+---------------------------------------------------------------------------+------------------+------------+------------+------------+------------+ -| filename | language | code | comment | blank | total | -+---------------------------------------------------------------------------+------------------+------------+------------+------------+------------+ -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\README.md | Markdown | 38 | 0 | 12 | 50 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\acs.py | Python | 105 | 41 | 47 | 193 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\journal_fetcher.py | Python | 59 | 25 | 12 | 96 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\nature.py | Python | 21 | 23 | 16 | 60 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\get\template_.py | Python | 10 | 31 | 10 | 51 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\interface.py | Python | 46 | 47 | 21 | 114 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\publication.py | Python | 80 | 49 | 15 | 144 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\requirements.txt | pip requirements | 2 | 0 | 0 | 2 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\__init__.py | Python | 0 | 0 | 1 | 1 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_acs.py | Python | 285 | 7 | 11 | 303 | -| c:\Users\Gamin\git\ci-s-projekt-verarbeitung\input\test\test_input.py | Python | 40 | 28 | 14 | 82 | -| Total | | 686 | 251 | 161 | 1,098 | -+---------------------------------------------------------------------------+------------------+------------+------------+------------+------------+ \ No newline at end of file diff --git a/input/get/README.md b/input/get/README.md new file mode 100644 index 0000000000000000000000000000000000000000..56c610a06043789e1574f0a29fbf3fbb477c5d9f --- /dev/null +++ b/input/get/README.md @@ -0,0 +1,30 @@ +# Journal Fetcher +In this Directory there are all the Fetcher, to create an publication-instance. +These Fetchers should inherit from [**JournalFetcher**](journal_fetcher.py). + +## Template +There is a [**template file**](template_.py) with no functionality but can be used to get to see what needs to be added. + +## Naming Convention +The filename of the fetcher should be <[a-z]+>.py and the classname should be \<Filename\>Fetcher. +Example: +filename: [acs.py](acs.py) +classname: [AcsFetcher](acs.py) + +## Format +Fetchers should keep this format: +- doi_url : *https://doi.org/10.xxxx/...* +- title : *title* +- contributors: *[contrib_1, contrib_2, ...]* +- journal = *full name* +- publication_date = *dd.mm.yyyy* +- subjects = *[subject_1, subject_2, ...]* +- references = *[reference_1, reference_2, ...]* +- citations = *[citations_1, citation_2, ...]* +- abstract = *abstract without '\n'* + + +## Tests +Tests for these Modules are in **input/test/**. +These tests should inherit from [**FetcherTestCase**](../test/test_input.py) and should have positive and negative testcases. Look in [**test_acs.py**](../test/test_acs.py) for reference. +There are also tests which compares the string representation of the publication with a predefined one.[*](../test/test_txt/acs.txt) \ No newline at end of file diff --git a/input/get/__pycache__/__init__.cpython-38.pyc b/input/get/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 52f5d64aa3f72e25accf523fb850635617afbf5e..0000000000000000000000000000000000000000 Binary files a/input/get/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/input/get/__pycache__/acs.cpython-38.pyc b/input/get/__pycache__/acs.cpython-38.pyc deleted file mode 100644 index 78c1fb0c8b885e90285224e745b09af56faf9b01..0000000000000000000000000000000000000000 Binary files a/input/get/__pycache__/acs.cpython-38.pyc and /dev/null differ diff --git a/input/get/__pycache__/journal_fetcher.cpython-38.pyc b/input/get/__pycache__/journal_fetcher.cpython-38.pyc deleted file mode 100644 index af9bd12b47a0bae4c1683adf78d92884b7e51193..0000000000000000000000000000000000000000 Binary files a/input/get/__pycache__/journal_fetcher.cpython-38.pyc and /dev/null differ diff --git a/input/get/__pycache__/nature.cpython-38.pyc b/input/get/__pycache__/nature.cpython-38.pyc deleted file mode 100644 index ca8c9862b7234c55e49b676136ab64a62f91e58b..0000000000000000000000000000000000000000 Binary files a/input/get/__pycache__/nature.cpython-38.pyc and /dev/null differ diff --git a/input/get/_springer.py b/input/get/_springer.py new file mode 100644 index 0000000000000000000000000000000000000000..4ed7e8c978a8e3a3539a884b0fb235499dc20554 --- /dev/null +++ b/input/get/_springer.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 + +""" +Child class of JournalFetcher +Usage: Check if Url can be used with 'can_use_url' + and then fetch publication with 'get_publication' +""" + +import re +from input.get.journal_fetcher import JournalFetcher +from input.publication import Citation, Publication + + +class NatureFetcher(JournalFetcher): + + """ + scrapes publication metadata from a provided url + """ + + # NOTE: nature does not use journal names in doi links, must match by 10.xxxx identifier instead + SUPPORTED_JOURNALS = ['1038'] + + @staticmethod + def can_use_url(url: str) -> bool: + """ + Uses regex to extract journal specific substrings in doi. + TODO: Support non doi-urls, maybe parse specific journals from s[5 digit] part of nature doi if necessary + """ + + + + matched_url = re.match(r'^(https?://)?(doi.org/)?10.(\d{4})/s(\d{5})-(\d{3})-(\d{5})-(\d{1})', url.strip(". \t\r\n")) + + #checks if match exists + if matched_url is not None: + return matched_url[3] in NatureFetcher.SUPPORTED_JOURNALS + else: + return False + + @staticmethod + def get_pub_light(url: str) -> Publication: + pass + + @staticmethod + def get_publication(url: str) -> Publication: + """ + takes a url, scrapes article and citation metadata from corresponding website, and returns + that metadata as a Publication instance. + """ + + #creation of soup + try: + soup = JournalFetcher.get_soup(url) + except Exception as error: + raise error + + # raise error if re recognizes pattern, but url isnt correct: + # For other Urls + if soup.text.strip(" \t\n")=="Missing resource null": + raise ValueError("'{}' is not a valid doi url".format(url)) + + # For dois + if soup.title is not None: + if soup.title.text == "Error: DOI Not Found": + raise ValueError("'{}' matches pattern for 'Nature', but doesnt link to paper.".format(url)) + + #fetching metadata from soup + doi_url = "https://doi.org/" + soup.head.find(attrs={"name": "DOI"}).get("content") + title = soup.head.find(attrs={"name": "citation_title"}).get("content") + journal = soup.head.find(attrs={"name": "citation_journal_title"}).get("content") + published = soup.head.find(attrs={"name": "prism.publicationDate"}).get("content") + contributors = [] + subjects = [] + references = [] + + for creator in soup.head.findAll(attrs={"name": "dc.creator"}): + contributors.append(creator.get("content")) + + for subject in soup.head.findAll(attrs={"name": "dc.subject"}): + subjects.append(subject.get("content")) + + for reference in soup.head.findAll(atts={"name": "citation_reference"}): + + if re.match('citation_journal_title=', reference.get("content")): + ref_doi = re.search(r'citation_doi=(.+); ', reference.get("content"))[1] + ref_title = re.search(r'citation_title=(.+); ', reference.get("content"))[1] + ref_journal = re.search(r'citation_journal_title=(.+); ',reference.get("content"))[1] + ref_contributors = re.split(r', ', re.search(r'citation_author=(.+); ', reference.get("content"))) + else: + ref_doi = "" + ref_title = reference.get("content") + ref_journal = "" + ref_contributors = "" + + references.append(Citation(doi_url=ref_doi, title=ref_title\ + , journal=ref_journal, contributors=ref_contributors\ + , cit_type="Referenz" )) + + + return Publication(doi_url, title, contributors, journal, published, subjects, references) + + # TODO: Exceptions-handling + # raise ValueException("Cant Fetch: '{}'".format(error)) + # return None diff --git a/input/get/acs.py b/input/get/acs.py old mode 100755 new mode 100644 index 9691845b27ae694a8213a0f0fe5f827c75890eee..c7ea64735bc83502c8df3c5f8dd984ea29f196aa --- a/input/get/acs.py +++ b/input/get/acs.py @@ -12,58 +12,57 @@ from input.get.journal_fetcher import JournalFetcher from input.publication import Publication, Citation -class Fetcher(JournalFetcher): +class AcsFetcher(JournalFetcher): """ - Specific Fetcher for the ACS journals. + Specific Fetcher for the ACS-journals. """ - # Constant for the abbreviations of the supported Journals + # Constant for the specific doi-url of the supported Journals SUPPORTED_JOURNALS = ['1021'] @staticmethod def can_use_url(url: str) -> str: """ - Uses Regex to extract journal specific substrings in Doi. - TODO: Support non Doi-urls + Uses Regex to extract journal specific substrings in (Doi-)Urls. """ - matched_url = re.match(r'^(https?://)?(doi.org/|pubs.acs.org/doi/)?(10.(\d{4})/\w+.\S+)', url.strip(". \t\r\n")) + matched_url = re.match(r'^(https?://)?(doi.org/|pubs.acs.org/doi/)?([a-z]+/)?(10.(\d{4})/\w+.\S+)', url.strip(". \t\r\n")) - #Checks if match exists + # Checks if match exists if matched_url is not None: - return matched_url[4] in Fetcher.SUPPORTED_JOURNALS + return matched_url[5] in AcsFetcher.SUPPORTED_JOURNALS else: return False - @staticmethod - + @staticmethod def get_pub_light(url: str) -> Publication: """ Fetches html and creates Beatifulsoup-instance in parent class. - Specific css-searches for ACS-Journals and creates Publication-instance. + Specific css-searches for ACS-Journals and creates Publication-instance (without References, Citations and abstract). """ - # Creation of Soup + # Create soup try: soup = JournalFetcher.get_soup(url) except Exception as error: raise error # Raise Error if re recognizes Pattern, but url isnt correct: - # For other Urls + # - for other Urls if soup.text.strip(" \t\n")=="Missing resource null": raise ValueError("'{}' matches Pattern for 'ACS', but doesnt link to Paper.".format(url)) - # For Dois + # - for Dois if soup.title is not None: if soup.title.text == "Error: DOI Not Found": raise ValueError("'{}' matches Pattern for 'ACS', but doesnt link to Paper.".format(url)) - + # Presearch for a smaller soup soup_header = soup.select('.article_header')[0] - # Creates Publication + # fetches info for publication doi_url = soup_header.select('a[title="DOI URL"]')[0].string + title = soup_header.select(".hlFld-Title")[0].text contributors = [] @@ -71,21 +70,30 @@ class Fetcher(JournalFetcher): contributors.append(author.text) journal = soup_header.select(".cit-title")[0].text - # Replaces abbreviation with whole name if journal in JournalFetcher.abbrev_dict: journal = JournalFetcher.abbrev_dict[journal] - + # Format in acs :"month dd, yyyy" published = soup_header.select(".pub-date-value")[0].text - - subjects = [] - subject_soup = soup_header.select('.article_header-taxonomy')[0] - for subject in subject_soup.select('a'): - subjects.append(subject.text) - - return Publication(doi_url, title, contributors, journal, published, - subjects) + re_date = re.match(r'\s*(\w+) (\d+), (\d+)\s*',published) + # dd.mm.yyyy + if re_date is not None: + published = (re_date[2].zfill(2) + "." + + JournalFetcher.mont_to_num[re_date[1].lower()] + + "." + re_date[3]) + + subjects = ["None Found"] + subject_soup = soup_header.select('.article_header-taxonomy') + # Some Papers have no Subjects + if subject_soup != []: + subjects = [] + for subject in subject_soup[0].select('a'): + subjects.append(subject.text) + + return Publication(doi_url = doi_url,title = title, contributors = contributors\ + , journal = journal, publication_date = published, subjects = subjects\ + , references = None, citations = None, abstract = None) def get_publication(url: str) -> Publication: """ @@ -93,30 +101,28 @@ class Fetcher(JournalFetcher): Specific css-searches for ACS-Journals and creates Publication-instance. """ - # Creation of Soup + # Create soup try: soup = JournalFetcher.get_soup(url) except Exception as error: raise error # Raise Error if re recognizes Pattern, but url isnt correct: - # For other Urls + # - for other Urls if soup.text.strip(" \t\n")=="Missing resource null": raise ValueError("'{}' matches Pattern for 'ACS', but doesnt link to Paper.".format(url)) - # For Dois + # - for Dois if soup.title is not None: if soup.title.text == "Error: DOI Not Found": raise ValueError("'{}' matches Pattern for 'ACS', but doesnt link to Paper.".format(url)) - + # Presearch for a smaller soup soup_header = soup.select('.article_header')[0] - #Could be used for more specific search - ref_cit_soup = soup - - # Creates Publication + # fetches info for publication doi_url = soup_header.select('a[title="DOI URL"]')[0].string + title = soup_header.select(".hlFld-Title")[0].text contributors = [] @@ -124,29 +130,45 @@ class Fetcher(JournalFetcher): contributors.append(author.text) journal = soup_header.select(".cit-title")[0].text - # Replaces abbreviation with whole name if journal in JournalFetcher.abbrev_dict: journal = JournalFetcher.abbrev_dict[journal] - + # Format in acs :"month dd, yyyy" published = soup_header.select(".pub-date-value")[0].text - - subjects = [] - subject_soup = soup_header.select('.article_header-taxonomy')[0] - for subject in subject_soup.select('a'): - subjects.append(subject.text) + re_date = re.match(r'\s*(\w+) (\d+), (\d+)\s*',published) + # dd.mm.yyyy + if re_date is not None: + published = (re_date[2].zfill(2) + "." + + JournalFetcher.mont_to_num[re_date[1].lower()] + + "." + re_date[3]) + + subjects = ["None Found"] + subject_soup = soup_header.select('.article_header-taxonomy') + # Some Papers have no Subjects + if subject_soup != []: + subjects = [] + for subject in subject_soup[0].select('a'): + subjects.append(subject.text) + + abstract_soup = soup.select('.articleBody_abstractText') + abstract = "Found Nothing" + # Some Papers have no abstract in the html + if abstract_soup != []: + abstract = abstract_soup[0].text references = [] - references_soup = ref_cit_soup.select('ol#references') + references_soup = soup.select('ol#references') + # Some Papers have no References in the html if references_soup != []: for reference in references_soup[0].select('li'): if reference.select('.refDoi') != []: ref_doi = "https://doi.org/{}".format(reference.select('.refDoi')[0].text.strip()[5:]) else: - # No Doi -> No Paper + # Some references aren't Paper and have no Doi, we ignore those continue + ref_title = reference.select('.NLM_article-title')[0].text\ if reference.select('.NLM_article-title') != [] else None ref_journal = reference.select('i')[0].text\ @@ -163,14 +185,16 @@ class Fetcher(JournalFetcher): references.append(Citation(ref_doi, ref_title, ref_journal, ref_contributors, cit_type="Reference")) citations = [] - citation_soup = ref_cit_soup.select('.cited-content_cbyCitation') + citation_soup = soup.select('.cited-content_cbyCitation') + # Some Papers have no Citations in the html if citation_soup != []: for citation in citation_soup[0].select('li'): if citation.select('a[title="DOI URL"]') != []: cit_doi = citation.select('a[title="DOI URL"]')[0].text else: - # No Doi -> No Paper + # Some citations aren't Paper and have no Doi, we ignore those continue + cit_title = citation.select('.cited-content_cbyCitation_article-title')[0].text\ if citation.select('.cited-content_cbyCitation_article-title')!= [] else None cit_journal = citation.select('.cited-content_cbyCitation_journal-name')[0].text\ @@ -179,14 +203,17 @@ class Fetcher(JournalFetcher): # Replaces abbreviation with whole name if cit_journal in JournalFetcher.abbrev_dict: cit_journal = JournalFetcher.abbrev_dict[cit_journal] + cit_contributors =[] cit_contributors = citation.select('.cited-content_cbyCitation_article-contributors')[0]\ .text.replace("\n", " ").replace("\r", "").split(', ') - # clean up of the last Entry + # clean up of the last Entry, because sometimes there is an extra ',' cit_contributors_last = cit_contributors.pop().strip(". ") if cit_contributors_last != '': - cit_contributors.append(cit_contributors_last) + cit_contributors.append(cit_contributors_last) + citations.append(Citation(cit_doi, cit_title, cit_journal, cit_contributors, cit_type = "Citation")) - return Publication(doi_url, title, contributors, journal, published - , subjects, references, citations) + return Publication(doi_url = doi_url,title = title, contributors = contributors\ + , journal = journal,publication_date = published,subjects = subjects\ + ,references = references,citations = citations, abstract = abstract) diff --git a/input/get/elsevier.py b/input/get/elsevier.py new file mode 100755 index 0000000000000000000000000000000000000000..5c947a7c13a3133473cd926d04022f7964728c3c --- /dev/null +++ b/input/get/elsevier.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 + +""" +Child class of JournalFetcher +Usage: None, this is just a template and should be ignored +""" + +# import re +from input.get.journal_fetcher import JournalFetcher +from input.publication import Publication + + +class TemplateFetcher(JournalFetcher): + + """ + This is only a template and therefore has no functionality + """ + + # TODO: Naming-Convention: + # Class: '[filename]Fetcher' + # file: [journal-/organisation-name] + # format: "<[a-z]>+.py" allowed + # Not having this convention -> not imported + # TODO: List of Compatable Journals + SUPPORTED_JOURNALS = [] + + @staticmethod + def can_use_url(url: str) -> bool: + """ + Checks if given url links to a supported journal. + """ + + # TODO: Check the URL for compatability + # Maybe like: + # url_re = re.match(r'(https?://)?(doi.org/)?(10.(\d{4})/\w+.\S+)', url) + # if url_re is not None: + # return url_re[4] in SUPPORTED_JOURNALS + # else: + return False + + @staticmethod + def get_publication(url: str) -> Publication: + """ + Creates a Publication-instance. + """ + + # Create soup + try: + soup = JournalFetcher.get_soup(url) + except Exception as errir: + raise error + + # TODO: Fetch data from the HTML + # soup = JournalFetcher.get_soup(url) + # Check if soup fetched a Paper + # doi -- https://doi.org/10.xxxx/.... + # title + # contributors[] + # journal -- if journal in JournalFetcher.abbrev_dict: journal = JournalFetcher.abbrev_dict[journal] + # publication_date -- dd.mm.yyyy + # subjects[] + # abstract + # references[] + # citations[] + # TODO: Create new Publication-instance + # return Publication(doi_url = doi_url,title = title, contributors = contributors\ + # , journal = journal,publication_date = published,subjects = subjects\ + # ,references = references,citations = citations, abstract = abstract) + return None + + @staticmethod + def get_pub_light(url: str) -> Publication: + """ + Creates a Publication-instance without Citations and References. + """ + # Create soup + try: + soup = JournalFetcher.get_soup(url) + except Exception as errir: + raise error + + + # TODO: Fetch data from the HTML + # soup = JournalFetcher.get_soup(url) + # Check if soup fetched a Paper + # doi -- https://doi.org/10.xxxx/.... + # title + # contributors[] + # journal -- if journal in JournalFetcher.abbrev_dict: journal = JournalFetcher.abbrev_dict[journal] + # publication_date -- dd.mm.yyyy + # subjects[] + # TODO: Create new Publication-instance + # return Publication(doi_url = doi_url,title = title, contributors = contributors\ + # , journal = journal,publication_date = published, subjects = subjects\ + # , references = None, citations = None, abstract = None) + return None diff --git a/input/get/journal_fetcher.py b/input/get/journal_fetcher.py index 514af1f80f5c7d442b790aebf5fe3954d50f8f5d..03ce6324dc38aae05bbabbb6512183e498f9d7a3 100755 --- a/input/get/journal_fetcher.py +++ b/input/get/journal_fetcher.py @@ -12,7 +12,8 @@ from input.publication import Publication class JournalFetcher(metaclass=ABCMeta): """ - This is a abstract-class for fetcher modules + This is a abstract-class for fetcher modules. + It defines common functions, common dictionaries and functions to be implemented """ @staticmethod @@ -41,7 +42,7 @@ class JournalFetcher(metaclass=ABCMeta): Abstract-function to be implemented in subclass. Checks if given url links to a supported journal """ - raise AttributeError("JournalFetcher for '{}' hasnt implemented 'can_use_url()'".format(url)) + raise AttributeError("JournalFetcher for '{}' hasnt implemented 'can_use_url(url)'".format(url)) @staticmethod @@ -51,46 +52,70 @@ class JournalFetcher(metaclass=ABCMeta): Abstract-function to be implemented in subclass. Creates a Publication-instance. """ - raise AttributeError("JournalFetcher for '{}' hasnt implemented 'get_publication()'".format(url)) + raise AttributeError("JournalFetcher for '{}' hasnt implemented 'get_publication(url)'".format(url)) + @staticmethod + @abstractmethod + def get_pub_light(url: str) -> Publication: + """ + Abstract-function to be implemented in subclass. + Creates a Publication-instance without Reference and Citation + """ + raise AttributeError("JournalFetcher for '{}' hasnt implemented 'get_pub_light(url)'".format(url)) + + # Dictionary to get from month to number + mont_to_num= { + "january": "01", + "february": "02", + "march": "03", + "april": "04", + "may": "05", + "june": "06", + "july": "07", + "august": "08", + "september": "09", + "october": "10", + "november": "11", + "december": "12" + } - # A Dictionary, which connects abbreviation to whole journal-name + # A Dictionary, which connects abbreviation to whole journal name abbrev_dict = { - "Nat. Protoc.":"Journal of Natural Products" - ,"PLoS Comput. Biol.":"PLoS Computational Biology" - ,"PLoS One":"PLoS One" - ,"Protein Sci.":"Protein Science" + "Nat. Protoc.":"Journal of Natural Products" + ,"Nat. Chem.":"Nature Chemistry" + ,"Nat. Med.":"Nature Medicine" + ,"Nat. Commun.":"Nature Communications" + ,"Nat. Cell Biol.":"Nature Cell Biology" + ,"Nat. Methods":"Nature Methods" + ,"Nat. Chem. Biol.":"Nature Chemical Biology" ,"J. Am. Chem. Soc.":"Journal of the American Chemical Society" ,"J. Chem. Phys.":"Journal of Chemical Physics" - ,"Appl. Sci.":"Applied Science" - ,"Comput. Sci. Eng.":"Computing in Science & Engineering" - ,"Beilstein J. Org. Chem.":"Beilstein Journal of Organic Chemistry" - ,"Biol. Chem.":"Biological Chemistry" - ,"Isr. J. Chem.":"Israel Journal of Chemistry" - ,"Nat. Methods":"Nature Methods" - ,"Proc. Natl. Acad. Sci. U. S. A.":"Proceedings of the National Academy of Sciences of the United States of America" ,"J. Phys. Chem. B":"Journal of Physical Chemistry B" - ,"Carbohydr. Res.":"Carbohydrate Research" ,"J. Chem. Theory Comput.":"Journal of Chemical Theory and Computation" ,"J. Mol. Biol.":"Journal of Molecular Biology" - ,"Nucleic Acids Res.":"Nucleic Acids Research" ,"J. Comput. Chem.":"Journal of Computational Chemistry" ,"J. Cheminf.":"Journal of Cheminformatics" ,"J. Med. Chem.":"Journal of Medicinal Chemistry" ,"J. Comput.-Aided Mol. Des.":"Journal of Computer-Aided Molecular Design" ,"J. Chem. Inf. Model.":"Journal of Chemical Information and Modeling" - ,"Mol. Cell":"Molecular Cell" ,"J. Cell Biolog.":"Journal of Cell Biology" - ,"Mol. Cell Biol.":"Molecular and Cellular Biology" ,"J. Cell Sci.":"Journal of Cell Science" - ,"Nat. Cell Biol.":"Nature Cell Biology" ,"J. Aerosol Sci. Technol.":"Aerosol Science and Technology" + ,"Mol. Cell":"Molecular Cell" + ,"Mol. Cell Biol.":"Molecular and Cellular Biology" ,"Mol. Biol. Cell":"Molecular Biology of the Cell" + ,"Exp. Cell Res.":"Experimental Cell Research" + ,"PLoS Comput. Biol.":"PLoS Computational Biology" + ,"PLoS One":"PLoS One" + ,"Protein Sci.":"Protein Science" + ,"Appl. Sci.":"Applied Science" + ,"Comput. Sci. Eng.":"Computing in Science & Engineering" + ,"Beilstein J. Org. Chem.":"Beilstein Journal of Organic Chemistry" + ,"Biol. Chem.":"Biological Chemistry" + ,"Isr. J. Chem.":"Israel Journal of Chemistry" + ,"Proc. Natl. Acad. Sci. U. S. A.":"Proceedings of the National Academy of Sciences of the United States of America" + ,"Carbohydr. Res.":"Carbohydrate Research" + ,"Nucleic Acids Res.":"Nucleic Acids Research" ,"Build. Environ.":"Building and Environment" ,"Sci. Rep.":"Scientific Reports" - ,"Nat. Chem.":"Nature Chemistry" - ,"Nat. Med.":"Nature Medicine" - ,"Nat. Commun.":"Nature Communications" - ,"Exp. Cell Res.":"Experimental Cell Research" - ,"Nat. Chem. Biol.":"Nature Chemical Biology" } \ No newline at end of file diff --git a/input/get/nature.py b/input/get/nature.py deleted file mode 100644 index c50ea0ef9d1d4a9a386730e31cc72372cbf698c0..0000000000000000000000000000000000000000 --- a/input/get/nature.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 - -""" -Child class of JournalFetcher -Usage: Check if Url can be used with 'can_use_url' - and then fetch publication with 'get_publication' -""" - -# import re -from input.get.journal_fetcher import JournalFetcher -from input.publication import Publication - - -class Fetcher(JournalFetcher): - - """ - scrapes publication metadata from a provided url - """ - - # TODO: List of Compatable Journals - # NOTE: nature does not use journal names in doi links, must match by 10.xxxx identifier instead - SUPPORTED_JOURNALS = [] - - @staticmethod - def can_use_url(url: str) -> bool: - """ - Checks if given url links to a supported journal. - """ - - # TODO: Check the URL for compatability - # re.match in SUPPORTED_JOURNALS - return False - - @staticmethod - def get_publication(url: str) -> Publication: - """ - Creates a Publication-instance. - """ - - soup = JournalFetcher.get_soup(url) - - _doi_url = "https://doi.org/" + soup.head.find(attrs={"name": "DOI"}).get("content") - _title = soup.head.find(attrs={"name": "citation_title"}).get("content") - _journal = soup.head.find(attrs={"name": "citation_journal_title"}).get("content") - _published = soup.head.find(attrs={"name": "prism.publicationDate"}).get("content") - _contributors = [] - _subjects = [] - - for creator in soup.head.findAll(attrs={"name": "dc.creator"}): - _contributors.append(creator.get("content")) - - for subject in soup.head.findAll(attrs={"name": "dc.subject"}): - _subjects.append(subject.get("content")) - - return Publication(_doi_url, _title, _contributors, _journal, _published, _subjects) - - # TODO: Exceptions-handling - # raise ValueException("Cant Fetch: '{}'".format(error)) - # return None diff --git a/input/get/template_.py b/input/get/template_.py index 58de0237bd514f7dd1b5b25f251b740d33e3589e..7e4ba32b6bcaffe3cc9c6f4d605b06db8ed6c71c 100755 --- a/input/get/template_.py +++ b/input/get/template_.py @@ -10,16 +10,17 @@ from input.get.journal_fetcher import JournalFetcher from input.publication import Publication -class Fetcher(JournalFetcher): +class TemplateFetcher(JournalFetcher): """ This is only a template and therefore has no functionality """ # TODO: Naming-Convention: - # Class: 'Fetcher' + # Class: '[filename]Fetcher' # file: [journal-/organisation-name] - # format = "[a-z]*.py" allowed + # format: "<[a-z]>+.py" allowed + # Not having this convention -> not imported # TODO: List of Compatable Journals SUPPORTED_JOURNALS = [] @@ -30,10 +31,11 @@ class Fetcher(JournalFetcher): """ # TODO: Check the URL for compatability - # url_re = re.match(r'(https?://)?(doi.org/)?(10.(\d{4})/\w+.\S+)', url) - # if url_re is not None: - # return url_re[4] in SUPPORTED_JOURNALS - # else: + # Maybe like: + # url_re = re.match(r'(https?://)?(doi.org/)?(10.(\d{4})/\w+.\S+)', url) + # if url_re is not None: + # return url_re[4] in SUPPORTED_JOURNALS + # else: return False @staticmethod @@ -44,8 +46,39 @@ class Fetcher(JournalFetcher): # TODO: Fetch data from the HTML # soup = JournalFetcher.get_soup(url) - # doi,title,contributors[],journal,publication_date,subjects[],references[],citations[] + # Check if soup fetched a Paper + # doi -- https://doi.org/10.xxxx/.... + # title + # contributors[] + # journal -- if journal in JournalFetcher.abbrev_dict: journal = JournalFetcher.abbrev_dict[journal] + # publication_date -- dd.mm.yyyy + # subjects[] + # abstract + # references[] + # citations[] # TODO: Create new Publication-instance - # return Publication(doi_url, title, contributors = [], journal - # , publication_date, subjects = [], references = [], citations = []) + # return Publication(doi_url = doi_url,title = title, contributors = contributors\ + # , journal = journal,publication_date = published,subjects = subjects\ + # ,references = references,citations = citations, abstract = abstract) + return None + + @staticmethod + def get_pub_light(url: str) -> Publication: + """ + Creates a Publication-instance without Citations and References. + """ + + # TODO: Fetch data from the HTML + # soup = JournalFetcher.get_soup(url) + # Check if soup fetched a Paper + # doi -- https://doi.org/10.xxxx/.... + # title + # contributors[] + # journal -- if journal in JournalFetcher.abbrev_dict: journal = JournalFetcher.abbrev_dict[journal] + # publication_date -- dd.mm.yyyy + # subjects[] + # TODO: Create new Publication-instance + # return Publication(doi_url = doi_url,title = title, contributors = contributors\ + # , journal = journal,publication_date = published, subjects = subjects\ + # , references = None, citations = None, abstract = None) return None \ No newline at end of file diff --git a/input/interface.py b/input/interface.py index 59515b3a3a2a5361222b8e55d3a7314ab3907132..f0c9ca39f863fe894769dd6fdbc97a13e6e2caad 100755 --- a/input/interface.py +++ b/input/interface.py @@ -2,8 +2,10 @@ """ Interface for the Input-Package only this should be accessed from outside this Package. - +Usage: Create an InputInterface instance and call 'get_publication(url)' to get + an publication instance """ + from os import walk import importlib import pathlib @@ -19,44 +21,51 @@ class InputInterface: get_path = None fetcher_classes=[] - # '__new__' is called before '__init__' and gives us an instance + def __new__(cls, *args, **kwargs): - - # checks if an instance exists and if it doesnt creates one + """ + Creates and/or returns the one class-instance. (Singleton-Pattern) + this method is automaticly called before '__init__' + """ + # checks if an instance exists and if it doesnt, it creates one if cls.instance == None: + # standard '__new__' cls.instance = super(InputInterface, cls).__new__(cls,*args, **kwargs) return cls.instance + def __init__(self): - # imports all modules + """ + Initializes the Singleton and imports all modules in <path>/input/get/ + Fetchers in that directory will be autoimported. + """ if self.fetcher_classes ==[]: self.import_fetcher_classes() if self.fetcher_classes ==[]: - raise AttributeError("No specific Fetchers where found at: '{}'" + raise ImportError("No specific Fetchers where found at: '{}'" .format(self.get_path)) def get_publication(self, url: str) -> Publication: """ - The interface-method to get a Publication-instance - (including it's citations and references) + The interface-method to get a publication-instance + (including its citations and references) Parameters ---------- - :param url: url to a Publication + :param url: url to a publication :type url: str - :return: Publication instance or None if not supported + :return: Publication instance, else ValueError """ - # Checks if module supports the 'url' and - # returns a Publication if it does. + # Checks every fetcher if it can use url and if it can tries to fetch it for fetcher_class in InputInterface.fetcher_classes: if fetcher_class.can_use_url(url): return fetcher_class.get_publication(url) - # No Module for given url was found + # No fetcher for given url was found raise ValueError("'{}' is not supported".format(url)) def get_pub_light(self, url: str) -> Publication: @@ -66,18 +75,17 @@ class InputInterface: Parameters ---------- - :param url: url to a Publication + :param url: url to a publication :type url: str - :return: Publication instance or None if not supported + :return: publication instance, else ValueError """ - # Checks if module supports the 'url' and - # returns a Publication if it does. + # Checks every fetcher if it can use url and if it can tries to fetch it for fetcher_class in InputInterface.fetcher_classes: if fetcher_class.can_use_url(url): return fetcher_class.get_pub_light(url) - # No Module for given url was found + # No fetcher for given url was found raise ValueError("'{}' is not supported".format(url)) def get_supported_fetchers(self): @@ -87,9 +95,9 @@ class InputInterface: def import_fetcher_classes(self): """ - Searches in 'get', if there are [a-z]*.py modules (specific Fetchers) + Searches in '<path>/input/get', if there are [a-z]+.py modules (specific Fetchers) and tries to import them. - Saves found modules in 'fetcher_files'. + Saves found modules in 'fetcher_classes'. """ # Path to 'get'-package @@ -101,13 +109,22 @@ class InputInterface: if re.match(r'[a-z]+.py', file) is not None: fetcher_file_names.append(file) - # Tries to import those modules and saves their 'Fetcher'-class + # Tries to import those modules and saves their class for file in fetcher_file_names: + imported = True try: fetcher_class = importlib.import_module("input.get.{}".format(file[:-3])) - try: - self.fetcher_classes.append(fetcher_class.__getattribute__('Fetcher')) - except Exception as error: - ImportError("Module '{}' does not have a 'Fetcher'-class".format(file[:-3])) except Exception: + # Raises exception if naming convention not correct + # file: <[a-z]+>.py (like 'acs.py') + # class: <filename>Fetcher (like 'AcsFetcher') + imported = False raise ImportError("Module '{}' can not be imported".format(file[:-3])) + try: + if imported: + # Looks if class-name has the naming convention and then adds it to 'fetcher_classes' + self.fetcher_classes.append(fetcher_class\ + .__getattribute__('{}Fetcher'.format(file[:-3].capitalize()))) + except Exception as error: + ImportError("Module '{}' does not have a '{}Fetcher'-class"\ + .format(file[:-3],file[:-3].capitalize())) diff --git a/input/publication.py b/input/publication.py index fc512e7173a84695ea566706784c565a7b5ebb8f..5fa8ef0f8d62d73465db8219de35cc286717a044 100755 --- a/input/publication.py +++ b/input/publication.py @@ -1,17 +1,18 @@ #!/usr/bin/env python3 -# this is needed for typing pre python 3.9, this maybe as an large Overhead +# this is needed for typing pre python 3.9, this maybe has an large Overhead from typing import Any, List class Publication: """ - Represents a Publications + Represents a publication """ def __init__(self, doi_url: str, title: str \ , contributors: List[str], journal: str \ , publication_date: str, subjects: List[str]\ - , references: List[Any] = None, citations: List[Any] = None ): + , references: List[Any] = None, citations: List[Any] = None\ + , abstract: str = None): """ Parameters ---------- @@ -21,14 +22,18 @@ class Publication: :type title: str :param contributors:list of all contributors :type contributors: list[] - :param published: date of release - :type published: str + :param journal: the journal of the publication + :type journal: str + :param publication_date: date of release + :type publication_date: str (format dd.mm.yyyy) :param subjects: the subject of the Publication :type subjects: List[str] - :param references: the Citation which is been referenced by this Publication + :param references: the Citation which is been referenced by this publication :type references: List[Any] - :param citations: the Citation which references this Publication + :param citations: the Citation which references this publication :type citations: List[Any] + :param abstract: the abstract of this publication + :typr abstract: str :return: None """ self.doi_url = doi_url @@ -45,27 +50,37 @@ class Publication: self.citations = [] else: self.citations = citations + self.abstract = abstract # For the 'Verarbeitungsgruppe' self.group = None + def __str__(self) -> str: - return ("Title: {}\n" - "Doi-url: {}\n" - "Authors: {}\n" - "Journal: {}\n" - "Published on: {}\n" - "Subjects: {}\n" - "References: \n{}\n" - "Citations: \n{}")\ + """ + Default string-converter for this class + """ + return ("Title:\t\t\t{}\n" + "Doi-url:\t\t{}\n" + "Authors:\t\t{}\n" + "Journal:\t\t{}\n" + "Published on:\t{}\n" + "Subjects:\t\t{}\n" + "Abstract:\t\t{}\n" + "References:\n{}\n\n" + "Citations:\n{}")\ .format(self.title, self.doi_url, ", ".join(self.contributors) , self.journal, self.publication_date - , ", ".join(self.subjects) + , ", ".join(self.subjects), self.abstract , "\n".join(self.get_citation_string(self.references)) , "\n".join(self.get_citation_string(self.citations))) + @staticmethod def get_citation_string(citations): + """ + Helper-method for __str__ + """ if citations == []: return ["None"] else: @@ -74,38 +89,16 @@ class Publication: citation_string.append(citation.__str__()) return citation_string - def add_citations(self, citation) -> None: - """ - Appends a list of Citations or Citation to self.citations. - - Parameter - --------- - :param citation: Citation or Reference of the Publication - :type citation: Citation or list[Citation] - :return: self.citations - """ - if type(citation) is Citation: - self.citations.append(citation) - - # Checks if 'citation' is a list of Citations - elif type(citation) is list: - for _cit in citation: - if type(_cit) is Citation: - self.citations.append(_cit) - else: - raise TypeError("_set_citation expects Citations or List of Citations, not: '{}'" - .format(type(_cit))) - else: - raise TypeError("_set_citation expects Citations or List of Citations, not: '{}'" - .format(type(citation))) - - return self.citations def __eq__(self, other) -> bool: - """ Compares the unique doi_url of two Publications""" - if type(self)==type(other): + """ + Compares the unique doi_url of this publications to a publication, citation or string. + Overrides the "==" operator. + """ + if type(other) == Publication or type(other) == Citation: return self.doi_url == other.doi_url - return False + else: + return self.doi_url == other class Citation: @@ -115,13 +108,15 @@ class Citation: """ Parameters ---------- - :param doi_url: doi_url of the publication + :param doi_url: doi_url of the citation :type doi_url: str - :param title: title of the publication + :param title: title of the citation :type title: str + :param journal: the journal of the citation + :type journal: str :param contributors: list of all contributors :type contributors: List[str] - :param cit_type: Specifies if Reference or Citation + :param cit_type: Specifies if it's a Reference or Citation :type cit_type: str :return: None """ @@ -132,12 +127,28 @@ class Citation: self.contributors = contributors self.cit_type = cit_type + def __str__(self) -> str: - return ("\t{}-Title: {}\n" - "\t{}-Doi: {}\n" - "\t{}-Journal: {}\n" - "\t{}-Contributors: {}\n")\ + """ + Default string-converter for this class + """ + return ("\n" + "\t{}-Title:\t\t\t{}\n" + "\t{}-Doi:\t\t\t{}\n" + "\t{}-Journal:\t\t{}\n" + "\t{}-Contributors:\t\t{}")\ .format(self.cit_type, self.title , self.cit_type, self.doi_url , self.cit_type, self.journal , self.cit_type, ", ".join(self.contributors)) + + + def __eq__(self, other) -> bool: + """ + Compares the unique doi_url of this publications to a publication, citation or string + Overrides the "==" operator. + """ + if type(other) == Publication or type(other) == Citation: + return self.doi_url == other.doi_url + else: + return self.doi_url == other diff --git a/input/test/test_acs.py b/input/test/test_acs.py index e3dfe84a09d3599de32efbab0dd60655b5414152..601cf02122cd2c8404ad600335c4a983b5f73ddb 100644 --- a/input/test/test_acs.py +++ b/input/test/test_acs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from input.get.acs import Fetcher as Acs +from input.get.acs import AcsFetcher as Acs from input.publication import Publication, Citation from input.test.test_input import FetcherTestCase @@ -11,6 +11,9 @@ class AcsTestCase(FetcherTestCase): """ def test_acs_url(self): + """ + Test if AcsFetcher recognizes its 'urls'. + """ # Positive Testing self.can_use_url_test(Acs, "https://doi.org/10.1021/acs.jcim.1c00203" , True) self.can_use_url_test(Acs, "doi.org/10.1021/acs.jcim.1c00203" , True) @@ -29,6 +32,9 @@ class AcsTestCase(FetcherTestCase): def test_acs_publication(self): + """ + Compares fetched Publication with a static one. + """ url = "https://doi.org/10.1021/acs.jcim.1c00203" self.get_publication_test(Acs, url, self.expectedPubs[url]) @@ -44,8 +50,9 @@ class AcsTestCase(FetcherTestCase): title = "AutoDock Vina 1.2.0: New Docking Methods, Expanded Force Field, and Python Bindings", contributors = ["Jerome Eberhardt", "Diogo Santos-Martins", "Andreas F. Tillack", "Stefano Forli"], journal="Journal of Chemical Information and Modeling", - publication_date = "July 19, 2021", + publication_date = "19.07.2021", subjects = ["Algorithms","Ligands","Molecules","Receptors","Macrocycles"], + abstract = "AutoDock Vina is arguably one of the fastest and most widely used open-source programs for molecular docking. However, compared to other programs in the AutoDock Suite, it lacks support for modeling specific features such as macrocycles or explicit water molecules. Here, we describe the implementation of this functionality in AutoDock Vina 1.2.0. Additionally, AutoDock Vina 1.2.0 supports the AutoDock4.2 scoring function, simultaneous docking of multiple ligands, and a batch mode for docking a large number of ligands. Furthermore, we implemented Python bindings to facilitate scripting and the development of docking workflows. This work is an effort toward the unification of the features of the AutoDock4 and AutoDock Vina programs. The source code is available at https://github.com/ccsb-scripps/AutoDock-Vina.", references = [ Citation(doi_url = "https://doi.org/10.1002/jcc.21334" , title ="AutoDock Vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization, and multithreading" diff --git a/input/test/test_input.py b/input/test/test_input.py index b2ca55f961565fd1192b72ce992c9ff95bd23020..33bccbeecdb753c4339b008a2bc199abed54aa07 100755 --- a/input/test/test_input.py +++ b/input/test/test_input.py @@ -5,43 +5,74 @@ from input.publication import Publication """ Testing the Publication fetcher - -Publication 1: 'https://doi.org/10.1021/acs.jcim.1c00203' -Publication 2: 'doi.org/10.1021/acs.jcim.1c00917' -Publication 3: '10.1038/nchem.1781' -Publication 4: '11.12/jaj' -Publication 5: '11.12/' -Publication 6: 'https://doi.org/10.1021/acs.jmedchem.0c01332' # Paper is a PDF """ -# TODO: Testcases for: -# - Specific Journals: Inherit from FetcherTestCase -# - interface module-importer (test case) -# - Error detection -# - wrong/no Journal_fetchers -# - wrong urls -# - correct Types in publication -# - Edgecases (i.e. paper as pdf, no connection, etc) + + +txt_files=["acs.txt"] +supported_fetchers=["AcsFetcher","NatureFetcher"] class InterfaceTestCase(unittest.TestCase): + """ + Testcase for the InputInterface-class + """ + def setUp(self): - self.assertEqual(InputInterface.instance, None) + """ + Is called at the start of this TestCase + """ + self.interface = InputInterface() + def test_singleton(self): - # interface should already be made in setUp() + """ + Checks if InputInterface is a Singleton. + """ + # Interface should already be made in setUp() self.assertNotEqual(self.interface.instance, None) + # Checks if there is only one instance new_interface = InputInterface() self.assertEqual(self.interface, new_interface) - # def test_imported_modules(self): - # fetchers = self.interface.get_supported_fetchers -class FetcherTestCase(unittest.TestCase): + def test_imported_modules(self): + """ + Checks if every Fetcher has been automaticlly imported. + """ + for fetcher in self.interface.get_supported_fetchers(): + self.assertIn(fetcher, supported_fetchers) + + + def test_fetcher_selection(self): + + """ + fetches every txt-file in 'txt_files', extracts Doi-Url of the publication + and then compares the the txt-string with the newly fetched one. + """ + for txt in txt_files: + f = open("input/test/test_txt/{}".format(txt),'r') + txt_list = f.readlines() + # Extracts the doi-url + url = txt_list[1][8:].strip() + # Creates new publication with the doi-url + pub = self.interface.get_publication(url) + self.maxDiff = None + # Important: remove \n at the end, which is made by print() + self.assertEqual("".join(txt_list),pub.__str__()) + f.close() + + +class FetcherTestCase(unittest.TestCase): + """ + Parent class for all journal specific fetchers. + """ def can_use_url_test(self, fetcher : JournalFetcher, test_url: str, expected_res: bool): - # Tests the 'can_use_url'-method + """ + Tests the 'can_use_url'-method + """ self.assertEqual(fetcher.can_use_url(test_url), expected_res) @@ -56,6 +87,7 @@ class FetcherTestCase(unittest.TestCase): self.assertEqual(actual_res.journal, expected_res.journal) self.assertEqual(actual_res.publication_date, expected_res.publication_date) self.assertEqual(actual_res.subjects, expected_res.subjects) + self.assertEqual(actual_res.abstract, expected_res.abstract) # Checking for all references self.assertEqual(len(actual_res.references), len(expected_res.references)) @@ -77,6 +109,8 @@ class FetcherTestCase(unittest.TestCase): def get_publication_exception_test(self, fetcher: JournalFetcher, test_url: str): - # Ckecks + """ + Checks if fetcher gives expected ValueError. + """ with self.assertRaises(ValueError): fetcher.get_publication(test_url) \ No newline at end of file diff --git a/input/test/test_txt/acs.txt b/input/test/test_txt/acs.txt new file mode 100644 index 0000000000000000000000000000000000000000..c21c3ace6c41d23b73147719ba6c34a712dbec08 --- /dev/null +++ b/input/test/test_txt/acs.txt @@ -0,0 +1,166 @@ +Title: Feasibility of Active Machine Learning for Multiclass Compound Classification +Doi-url: https://doi.org/10.1021/acs.jcim.5b00332 +Authors: Tobias Lang, Florian Flachsenberg, Ulrike von Luxburg, Matthias Rarey +Journal: Journal of Chemical Information and Modeling +Published on: 07.01.2016 +Subjects: Algorithms, Molecules, Drug discovery, Screening assays, Receptors +Abstract: A common task in the hit-to-lead process is classifying sets of compounds into multiple, usually structural classes, which build the groundwork for subsequent SAR studies. Machine learning techniques can be used to automate this process by learning classification models from training compounds of each class. Gathering class information for compounds can be cost-intensive as the required data needs to be provided by human experts or experiments. This paper studies whether active machine learning can be used to reduce the required number of training compounds. Active learning is a machine learning method which processes class label data in an iterative fashion. It has gained much attention in a broad range of application areas. In this paper, an active learning method for multiclass compound classification is proposed. This method selects informative training compounds so as to optimally support the learning progress. The combination with human feedback leads to a semiautomated interactive multiclass classification procedure. This method was investigated empirically on 15 compound classification tasks containing 86–2870 compounds in 3–38 classes. The empirical results show that active learning can solve these classification tasks using 10–80% of the data which would be necessary for standard learning techniques. +References: +None + +Citations: + + Citation-Title: Active Learning for Drug Design: A Case Study on the Plasma Exposure of Orally Administered Drugs. + Citation-Doi: https://doi.org/10.1021/acs.jmedchem.1c01683 + Citation-Journal: Journal of Medicinal Chemistry + Citation-Contributors: Xiaoyu Ding, Rongrong Cui, Jie Yu, Tiantian Liu, Tingfei Zhu, Dingyan Wang, Jie Chang, Zisheng Fan, Xiaomeng Liu, Kaixian Chen, Hualiang Jiang, Xutong Li, Xiaomin Luo, Mingyue Zheng + + Citation-Title: Concepts of Artificial Intelligence for Computer-Assisted Drug Discovery. + Citation-Doi: https://doi.org/10.1021/acs.chemrev.8b00728 + Citation-Journal: Chemical Reviews + Citation-Contributors: Xin Yang, Yifei Wang, Ryan Byrne, Gisbert Schneider, Shengyong Yang + + Citation-Title: De Novo Molecule Design by Translating from Reduced Graphs to SMILES. + Citation-Doi: https://doi.org/10.1021/acs.jcim.8b00626 + Citation-Journal: Journal of Chemical Information and Modeling + Citation-Contributors: Peter Pogány, Navot Arad, Sam Genway, Stephen D. Pickett + + Citation-Title: Designing Algorithms To Aid Discovery by Chemical Robots. + Citation-Doi: https://doi.org/10.1021/acscentsci.8b00176 + Citation-Journal: ACS Central Science + Citation-Contributors: Alon B. Henson, Piotr S. Gromski, Leroy Cronin + + Citation-Title: Modeling Kinase Inhibition Using Highly Confident Data Sets. + Citation-Doi: https://doi.org/10.1021/acs.jcim.7b00729 + Citation-Journal: Journal of Chemical Information and Modeling + Citation-Contributors: Sorin Avram, Alina Bora, Liliana Halip, Ramona Curpăn + + Citation-Title: Predictive Models for Fast and Effective Profiling of Kinase Inhibitors. + Citation-Doi: https://doi.org/10.1021/acs.jcim.5b00646 + Citation-Journal: Journal of Chemical Information and Modeling + Citation-Contributors: Alina Bora, Sorin Avram, Ionel Ciucanu, Marius Raica, and Stefana Avram + + Citation-Title: Evaluation of categorical matrix completion algorithms: toward improved active learning for drug discovery. + Citation-Doi: https://doi.org/10.1093/bioinformatics/btab322 + Citation-Journal: Bioinformatics + Citation-Contributors: Huangqingbo Sun, Robert F Murphy + + Citation-Title: An Artificial Intelligence Approach Based on Hybrid CNN-XGB Model to Achieve High Prediction Accuracy through Feature Extraction, Classification and Regression for Enhancing Drug Discovery in Biomedicine. + Citation-Doi: https://doi.org/10.46300/91011.2021.15.22 + Citation-Journal: International Journal of Biology and Biomedical Engineering + Citation-Contributors: Mukesh Madanan, Biju T. Sayed, Nurul Akhmal Mohd Zulkefli, Nitha C. Velayudhan + + Citation-Title: Artificial Intelligence in Medicinal Chemistry. + Citation-Doi: https://doi.org/10.1002/0471266949.bmc267 + Citation-Journal: + Citation-Contributors: Edward Griffen, Alexander Dossetter, Andrew Leach, Shane Montague + + Citation-Title: Practical Chemogenomic Modeling and Molecule Discovery Strategies Unveiled by Active Learning. + Citation-Doi: https://doi.org/10.1016/B978-0-12-801238-3.11533-8 + Citation-Journal: + Citation-Contributors: J.B. Brown + + Citation-Title: Machine learning phases and criticalities without using real data for training. + Citation-Doi: https://doi.org/10.1103/PhysRevB.102.224434 + Citation-Journal: Physical Review B + Citation-Contributors: D.-R. Tan, F.-J. Jiang + + Citation-Title: Active learning effectively identifies a minimal set of maximally informative and asymptotically performant cytotoxic structure–activity patterns in NCI-60 cell lines. + Citation-Doi: https://doi.org/10.1039/D0MD00110D + Citation-Journal: RSC Medicinal Chemistry + Citation-Contributors: Takumi Nakano, Shunichi Takeda, J.B. Brown + + Citation-Title: Active learning efficiently converges on rational limits of toxicity prediction and identifies patterns for molecule design. + Citation-Doi: https://doi.org/10.1016/j.comtox.2020.100129 + Citation-Journal: Computational Toxicology + Citation-Contributors: Ahsan Habib Polash, Takumi Nakano, Christin Rakers, Shunichi Takeda, J.B. Brown + + Citation-Title: Practical considerations for active machine learning in drug discovery. + Citation-Doi: https://doi.org/10.1016/j.ddtec.2020.06.001 + Citation-Journal: Drug Discovery Today: Technologies + Citation-Contributors: Daniel Reker + + Citation-Title: Designing compact training sets for data-driven molecular property prediction through optimal exploitation and exploration. + Citation-Doi: https://doi.org/10.1039/C9ME00078J + Citation-Journal: Molecular Systems Design & Engineering + Citation-Contributors: Bowen Li, Srinivas Rangarajan + + Citation-Title: Applicability Domain of Active Learning in Chemical Probe Identification: Convergence in Learning from Non-Specific Compounds and Decision Rule Clarification. + Citation-Doi: https://doi.org/10.3390/molecules24152716 + Citation-Journal: Molecules + Citation-Contributors: Ahsan Habib Polash, Takumi Nakano, Shunichi Takeda, J.B. Brown + + Citation-Title: Capturing and applying knowledge to guide compound optimisation. + Citation-Doi: https://doi.org/10.1016/j.drudis.2019.02.004 + Citation-Journal: Drug Discovery Today + Citation-Contributors: Matthew Segall, Tamsin Mansley, Peter Hunt, Edmund Champness + + Citation-Title: A novel graph kernel on chemical compound classification. + Citation-Doi: https://doi.org/10.1142/S0219720018500269 + Citation-Journal: Journal of Bioinformatics and Computational Biology + Citation-Contributors: Qiangrong Jiang, Jiajia Ma + + Citation-Title: Accelerating Drug Discovery Using Convolution Neural Network Based Active Learning. + Citation-Doi: https://doi.org/10.1109/TENCON.2018.8650298 + Citation-Journal: + Citation-Contributors: Pengfei Liu, Kwong-Sak Leung + + Citation-Title: An Adaptive Lightweight Security Framework Suited for IoT. + Citation-Doi: https://doi.org/10.5772/intechopen.73712 + Citation-Journal: + Citation-Contributors: Menachem Domb + + Citation-Title: Adaptive mining and model building of medicinal chemistry data with a multi-metric perspective. + Citation-Doi: https://doi.org/10.4155/fmc-2018-0188 + Citation-Journal: Future Medicinal Chemistry + Citation-Contributors: JB Brown + + Citation-Title: Chemogenomic Active Learning's Domain of Applicability on Small, Sparse qHTS Matrices: A Study Using Cytochrome P450 and Nuclear Hormone Receptor Families. + Citation-Doi: https://doi.org/10.1002/cmdc.201700677 + Citation-Journal: ChemMedChem + Citation-Contributors: Christin Rakers, Rifat Ara Najnin, Ahsan Habib Polash, Shunichi Takeda, J.B. Brown + + Citation-Title: Automating drug discovery. + Citation-Doi: https://doi.org/10.1038/nrd.2017.232 + Citation-Journal: Nature Reviews Drug Discovery + Citation-Contributors: Gisbert Schneider + + Citation-Title: Classifiers and their Metrics Quantified. + Citation-Doi: https://doi.org/10.1002/minf.201700127 + Citation-Journal: Molecular Informatics + Citation-Contributors: J. B. Brown + + Citation-Title: Active Search for Computer-aided Drug Design. + Citation-Doi: https://doi.org/10.1002/minf.201700130 + Citation-Journal: Molecular Informatics + Citation-Contributors: Dino Oglic, Steven A. Oatley, Simon J. F. Macdonald, Thomas Mcinally, Roman Garnett, Jonathan D. Hirst, Thomas Gärtner + + Citation-Title: Selection of Informative Examples in Chemogenomic Datasets. + Citation-Doi: https://doi.org/10.1007/978-1-4939-8639-2_13 + Citation-Journal: + Citation-Contributors: Daniel Reker, J. B. Brown + + Citation-Title: The value of prior knowledge in machine learning of complex network systems. + Citation-Doi: https://doi.org/10.1093/bioinformatics/btx438 + Citation-Journal: Bioinformatics + Citation-Contributors: Dana Ferranti, David Krane, David Craft + + Citation-Title: Lightweight adaptive Random-Forest for IoT rule generation and execution. + Citation-Doi: https://doi.org/10.1016/j.jisa.2017.03.001 + Citation-Journal: Journal of Information Security and Applications + Citation-Contributors: Menachem Domb, Elisheva Bonchek-Dokow, Guy Leshem + + Citation-Title: Active learning for computational chemogenomics. + Citation-Doi: https://doi.org/10.4155/fmc-2016-0197 + Citation-Journal: Future Medicinal Chemistry + Citation-Contributors: Daniel Reker, Petra Schneider, Gisbert Schneider, JB Brown + + Citation-Title: Small Random Forest Models for Effective Chemogenomic Active Learning. + Citation-Doi: https://doi.org/10.2751/jcac.18.124 + Citation-Journal: Journal of Computer Aided Chemistry + Citation-Contributors: Christin Rakers, Daniel Reker, J.B. Brown + + Citation-Title: Large-Scale Off-Target Identification Using Fast and Accurate Dual Regularized One-Class Collaborative Filtering and Its Application to Drug Repurposing. + Citation-Doi: https://doi.org/10.1371/journal.pcbi.1005135 + Citation-Journal: PLOS Computational Biology + Citation-Contributors: Hansaim Lim, Aleksandar Poleksic, Yuan Yao, Hanghang Tong, Di He, Luke Zhuang, Patrick Meng, Lei Xie \ No newline at end of file diff --git a/input/test/unittest b/input/test/unittest new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/input_old/README.md b/input_old/README.md deleted file mode 100644 index 76bd11d5d70daac13e190f4d52269eb381413c69..0000000000000000000000000000000000000000 --- a/input_old/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Projekt CiS-Projekt 2021/22 -Input-Skripts - diff --git a/input_old/__pycache__/input_fj.cpython-39.pyc b/input_old/__pycache__/input_fj.cpython-39.pyc deleted file mode 100644 index a3e6099f4ab4c56400b2698c812d4b5fc9a9a7aa..0000000000000000000000000000000000000000 Binary files a/input_old/__pycache__/input_fj.cpython-39.pyc and /dev/null differ diff --git a/input_old/example_urls b/input_old/example_urls deleted file mode 100644 index 96ac680c65edddcb495312000157edea1ab94884..0000000000000000000000000000000000000000 --- a/input_old/example_urls +++ /dev/null @@ -1,2 +0,0 @@ -https://pubs.acs.org/doi/10.1021/acs.jcim.5b00332 -https://pubs.acs.org/doi/10.1021/acs.jcim.6b00709 diff --git a/input_old/input_fj.py b/input_old/input_fj.py deleted file mode 100644 index ecc8e68fc5a84a446ae3f09dcb5ed56e8d262766..0000000000000000000000000000000000000000 --- a/input_old/input_fj.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python3 -""" -Functions for information retrieval of articles from the ACS journal JCIM - -""" - -__author__ = "Florian Jochens" -__email__ = "fj@andaco.de" -__status__ = "Production" -#__copyright__ = "" -#__credits__ = ["", "", "", ""] -#__license__ = "" -#__version__ = "" -#__maintainer__ = "" - -from bs4 import BeautifulSoup as bs -import requests as req -import sys -from pathlib import Path - -class Publication: - #_registry = [] - _citations = [] - _references = [] - - def __init__(self, title, publication_date, contributors, doi_url, - subjects = None, num_citations = None): - #self._registry.append(self) - self.title = title - self.publication_date = publication_date - self.contributors = contributors - self.doi_url = doi_url - self.subjects = subjects - self.num_citations = num_citations - #self._citations = [] - #self._references = [] - -class Citation: - def __init__(self, title, journal, contributors, doi_url): - self.title = title - self.journal = journal - self.contributors = contributors - self.doi_url = doi_url - -class References: - def __init__(self, title, journal, contributors, doi_url): - self.title = title - self.journal = journal - self.contributors = contributors - self.doi_url = doi_url - -def get_article_info(soup): - header = soup.find('div', class_ = 'article_header-left pull-left') - article_title = header.find('span', class_ = 'hlFld-Title').text - publication_date = header.find('span', class_ = 'pub-date-value').text - for link in header.find('div', class_ = 'article_header-doiurl'): - doi_url = link.get('href') - subs = header.find('div', class_ = 'article_header-taxonomy') - subjects = [] - for sub in subs.find_all('a'): - subjects.append(sub.get('title')) - cons = header.find('ul', class_ = 'loa') - contributors = [] - for con in cons.find_all('span', class_ = 'hlFld-ContribAuthor'): - contributors.append(con.text) - numc = header.find('div', class_ = 'articleMetrics_count') - if not numc.a: - num_citations = 0 - else: - num_citations = numc.a.text - - pub = Publication(article_title, publication_date, contributors, doi_url, - subjects, num_citations) - return pub - -def get_download_url(): - export = soup.find('div', class_ = 'cit-download-dropdown_content') - url = 'https://pubs.acs.org' - for link in export.find_all('a'): - if link.get('title') == 'Citation and references': - url += link.get('href') - print(url) - return url - -def download(url): # Download citation and references file - if url.find('='): - filename = url.rsplit('=', 1)[1] - path = Path(('./files/' + filename)) - if path.is_file(): - print("File already exists") - else: - print("File does not exist") - -def get_citation_info(pub, num_citations, soup): - pub._citations = [] - details = soup.find('ol', class_ = 'cited-content_cbyCitation') - titles = [] - for title in details.find_all('span', - class_ = 'cited-content_cbyCitation_article-title'): - titles.append(title.text.replace('.', '')) - journal_names = [] - for name in details.find_all('span', - class_ = 'cited-content_cbyCitation_journal-name'): - journal_names.append(name.text) - doi_urls = [] - for url in details.find_all('a'): - doi_urls.append(url.get('href')) - contributors = [] - for contrib in details.find_all('span', - class_ = 'cited-content_cbyCitation_article-contributors'): - contributors.append(contrib.text) - for i in range(0, int(num_citations)): - pub._citations.append(Citation(titles[i], journal_names[i], - contributors[i], doi_urls[i])) -def print_pub_info(pub): - print(f'''Article title: {pub.title} -Publication date: {pub.publication_date} -DOI-URL: {pub.doi_url} - -Subjects:''') - print(*(pub.subjects), sep = ", ") - print('\nContributors:') - print(*(pub.contributors), sep = ", ") - - if int(pub.num_citations) > 0: - if int(pub.num_citations) == 1: - print(f'\nThis publication is cited by the following publication:\n') - else: - print(f'\nThis publication is cited by the following {pub.num_citations} publications:\n') - for citation in pub._citations: - print(f''' - Title: {citation.title} - Journal: {citation.journal} - Contributors: {citation.contributors} - DOI-URL: {citation.doi_url} - ''') - else: - print('\nThis publication is not cited by any other publication.') - -def input(url): - html_text = req.get(url).text - soup = bs(html_text, 'html.parser') - - pub = get_article_info(soup) - if int(pub.num_citations) > 0: - get_citation_info(pub, int(pub.num_citations), soup) - return pub - -#if len(sys.argv) != 2: -# sys.stderr.write('Usage: {} <url>\n'.format(sys.argv[0])) -# exit(1) -#url = sys.argv[1] -#pub = input(url) -#print_pub_info(pub) diff --git a/input_old/pub.py b/input_old/pub.py deleted file mode 100644 index 13b90e804cd485813b731385b319b3077a017dd2..0000000000000000000000000000000000000000 --- a/input_old/pub.py +++ /dev/null @@ -1,32 +0,0 @@ -class Publication: - #_registry = [] - #_citations = [] - #_references = [] - - def __init__(self, title, publication_date, contributors, doi_url, - subjects, num_citations): - #self._registry.append(self) - self.title = title - self.publication_date = publication_date - self.contributors = contributors - self.doi_url = doi_url - self.subjects = subjects - self.num_citations = num_citations - self.num_references = num_references - self._citations = [] - self._references = [] - -class Citation: - def __init__(self, title, journal, contributors, doi_url): - self.title = title - self.journal = journal - self.contributors = contributors - self.doi_url = doi_url - -class References: - def __init__(self, title, journal, contributors, doi_url): - self.title = title - self.journal = journal - self.contributors = contributors - self.doi_url = doi_url - diff --git a/input_old/test.py b/input_old/test.py deleted file mode 100755 index dc623ca182691e9e06a6713a4d3d5dcf0bbf23c2..0000000000000000000000000000000000000000 --- a/input_old/test.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -from input_fj import input, print_pub_info -import sys - -if len(sys.argv) != 3: - sys.stderr.write('Usage: {} <url> <url>\n'.format(sys.argv[0])) - exit(1) -url = sys.argv[1] -url2 = sys.argv[2] -pub = input(url) -print_pub_info(pub) -pub2 = input(url2) -print_pub_info(pub2) - diff --git a/input_old/x b/input_old/x deleted file mode 100644 index c8ade9d56a520a3ac57e5eadce8b81bb3e63c0dd..0000000000000000000000000000000000000000 --- a/input_old/x +++ /dev/null @@ -1,234 +0,0 @@ -Article title: Feasibility of Active Machine Learning for Multiclass Compound Classification -Publication date: January 7, 2016 -DOI-URL: https://doi.org/10.1021/acs.jcim.5b00332 - -Subjects: -Algorithms, Molecules, Drug discovery, Screening assays, Receptors - -Contributors: -Tobias Lang, Florian Flachsenberg, Ulrike von Luxburg, Matthias Rarey - -This publication is cited by the following 30 publications: - - - Title: Concepts of Artificial Intelligence for Computer-Assisted Drug Discovery - Journal: Chemical Reviews - Contributors: Xin Yang, Yifei Wang, Ryan Byrne, Gisbert Schneider, Shengyong Yang. - DOI-URL: https://doi.org/10.1021/acs.chemrev.8b00728 - - - Title: De Novo Molecule Design by Translating from Reduced Graphs to SMILES - Journal: Journal of Chemical Information and Modeling - Contributors: Peter Pogány, Navot Arad, Sam Genway, Stephen D. Pickett. - DOI-URL: https://doi.org/10.1021/acs.jcim.8b00626 - - - Title: Designing Algorithms To Aid Discovery by Chemical Robots - Journal: ACS Central Science - Contributors: Alon B. Henson, Piotr S. Gromski, Leroy Cronin. - DOI-URL: https://doi.org/10.1021/acscentsci.8b00176 - - - Title: Modeling Kinase Inhibition Using Highly Confident Data Sets - Journal: Journal of Chemical Information and Modeling - Contributors: Sorin Avram, Alina Bora, Liliana Halip, Ramona Curpăn. - DOI-URL: https://doi.org/10.1021/acs.jcim.7b00729 - - - Title: Predictive Models for Fast and Effective Profiling of Kinase Inhibitors - Journal: Journal of Chemical Information and Modeling - Contributors: Alina Bora, Sorin Avram, Ionel Ciucanu, Marius Raica, and Stefana Avram . - DOI-URL: https://doi.org/10.1021/acs.jcim.5b00646 - - - Title: Evaluation of categorical matrix completion algorithms: toward improved active learning for drug discovery - Journal: Bioinformatics - Contributors: Huangqingbo Sun, Robert F Murphy, . - DOI-URL: https://doi.org/10.1093/bioinformatics/btab322 - - - Title: An Artificial Intelligence Approach Based on Hybrid CNN-XGB Model to Achieve High Prediction Accuracy through Feature Extraction, Classification and Regression for Enhancing Drug Discovery in Biomedicine - Journal: International Journal of Biology and Biomedical Engineering - Contributors: Mukesh Madanan, Biju T. Sayed, Nurul Akhmal Mohd Zulkefli, Nitha C. Velayudhan. - DOI-URL: https://doi.org/10.46300/91011.2021.15.22 - - - Title: Artificial Intelligence in Medicinal Chemistry - Journal: - Contributors: Edward Griffen, Alexander Dossetter, Andrew Leach, Shane Montague. - DOI-URL: https://doi.org/10.1002/0471266949.bmc267 - - - Title: Practical Chemogenomic Modeling and Molecule Discovery Strategies Unveiled by Active Learning - Journal: - Contributors: J.B. Brown. - DOI-URL: https://doi.org/10.1016/B978-0-12-801238-3.11533-8 - - - Title: Machine learning phases and criticalities without using real data for training - Journal: Physical Review B - Contributors: D.-R. Tan, F.-J. Jiang. - DOI-URL: https://doi.org/10.1103/PhysRevB.102.224434 - - - Title: Active learning effectively identifies a minimal set of maximally informative and asymptotically performant cytotoxic structure–activity patterns in NCI-60 cell lines - Journal: RSC Medicinal Chemistry - Contributors: Takumi Nakano, Shunichi Takeda, J.B. Brown. - DOI-URL: https://doi.org/10.1039/D0MD00110D - - - Title: Active learning efficiently converges on rational limits of toxicity prediction and identifies patterns for molecule design - Journal: Computational Toxicology - Contributors: Ahsan Habib Polash, Takumi Nakano, Christin Rakers, Shunichi Takeda, J.B. Brown. - DOI-URL: https://doi.org/10.1016/j.comtox.2020.100129 - - - Title: Practical considerations for active machine learning in drug discovery - Journal: Drug Discovery Today: Technologies - Contributors: Daniel Reker. - DOI-URL: https://doi.org/10.1016/j.ddtec.2020.06.001 - - - Title: Designing compact training sets for data-driven molecular property prediction through optimal exploitation and exploration - Journal: Molecular Systems Design & Engineering - Contributors: Bowen Li, Srinivas Rangarajan. - DOI-URL: https://doi.org/10.1039/C9ME00078J - - - Title: Applicability Domain of Active Learning in Chemical Probe Identification: Convergence in Learning from Non-Specific Compounds and Decision Rule Clarification - Journal: Molecules - Contributors: Ahsan Habib Polash, Takumi Nakano, Shunichi Takeda, J.B. Brown. - DOI-URL: https://doi.org/10.3390/molecules24152716 - - - Title: Capturing and applying knowledge to guide compound optimisation - Journal: Drug Discovery Today - Contributors: Matthew Segall, Tamsin Mansley, Peter Hunt, Edmund Champness. - DOI-URL: https://doi.org/10.1016/j.drudis.2019.02.004 - - - Title: A novel graph kernel on chemical compound classification - Journal: Journal of Bioinformatics and Computational Biology - Contributors: Qiangrong Jiang, Jiajia Ma. - DOI-URL: https://doi.org/10.1142/S0219720018500269 - - - Title: Accelerating Drug Discovery Using Convolution Neural Network Based Active Learning - Journal: - Contributors: Pengfei Liu, Kwong-Sak Leung. - DOI-URL: https://doi.org/10.1109/TENCON.2018.8650298 - - - Title: An Adaptive Lightweight Security Framework Suited for IoT - Journal: - Contributors: Menachem Domb. - DOI-URL: https://doi.org/10.5772/intechopen.73712 - - - Title: Adaptive mining and model building of medicinal chemistry data with a multi-metric perspective - Journal: Future Medicinal Chemistry - Contributors: JB Brown. - DOI-URL: https://doi.org/10.4155/fmc-2018-0188 - - - Title: Chemogenomic Active Learning's Domain of Applicability on Small, Sparse qHTS Matrices: A Study Using Cytochrome P450 and Nuclear Hormone Receptor Families - Journal: ChemMedChem - Contributors: Christin Rakers, Rifat Ara Najnin, Ahsan Habib Polash, Shunichi Takeda, J.B. Brown. - DOI-URL: https://doi.org/10.1002/cmdc.201700677 - - - Title: Automating drug discovery - Journal: Nature Reviews Drug Discovery - Contributors: Gisbert Schneider. - DOI-URL: https://doi.org/10.1038/nrd.2017.232 - - - Title: Classifiers and their Metrics Quantified - Journal: Molecular Informatics - Contributors: J. B. Brown. - DOI-URL: https://doi.org/10.1002/minf.201700127 - - - Title: Active Search for Computer-aided Drug Design - Journal: Molecular Informatics - Contributors: Dino Oglic, Steven A. Oatley, Simon J. F. Macdonald, Thomas Mcinally, Roman Garnett, Jonathan D. Hirst, Thomas Gärtner. - DOI-URL: https://doi.org/10.1002/minf.201700130 - - - Title: Selection of Informative Examples in Chemogenomic Datasets - Journal: - Contributors: Daniel Reker, J. B. Brown. - DOI-URL: https://doi.org/10.1007/978-1-4939-8639-2_13 - - - Title: The value of prior knowledge in machine learning of complex network systems - Journal: Bioinformatics - Contributors: Dana Ferranti, David Krane, David Craft, . - DOI-URL: https://doi.org/10.1093/bioinformatics/btx438 - - - Title: Lightweight adaptive Random-Forest for IoT rule generation and execution - Journal: Journal of Information Security and Applications - Contributors: Menachem Domb, Elisheva Bonchek-Dokow, Guy Leshem. - DOI-URL: https://doi.org/10.1016/j.jisa.2017.03.001 - - - Title: Active learning for computational chemogenomics - Journal: Future Medicinal Chemistry - Contributors: Daniel Reker, Petra Schneider, Gisbert Schneider, JB Brown. - DOI-URL: https://doi.org/10.4155/fmc-2016-0197 - - - Title: Small Random Forest Models for Effective Chemogenomic Active Learning - Journal: Journal of Computer Aided Chemistry - Contributors: Christin Rakers, Daniel Reker, J.B. Brown. - DOI-URL: https://doi.org/10.2751/jcac.18.124 - - - Title: Large-Scale Off-Target Identification Using Fast and Accurate Dual Regularized One-Class Collaborative Filtering and Its Application to Drug Repurposing - Journal: PLOS Computational Biology - Contributors: Hansaim Lim, Aleksandar Poleksic, Yuan Yao, Hanghang Tong, Di He, Luke Zhuang, Patrick Meng, Lei Xie, . - DOI-URL: https://doi.org/10.1371/journal.pcbi.1005135 - -Article title: Matched Molecular Series: Measuring SAR Similarity -Publication date: May 1, 2017 -DOI-URL: https://doi.org/10.1021/acs.jcim.6b00709 - -Subjects: -Substituents, Mathematical methods, Structure activity relationship, Biological databases - -Contributors: -Emanuel S. R. Ehmki, Christian Kramer - -This publication is cited by the following 5 publications: - - - Title: Matched Molecular Series Analysis for ADME Property Prediction - Journal: Journal of Chemical Information and Modeling - Contributors: Mahendra Awale, Sereina Riniker, Christian Kramer. - DOI-URL: https://doi.org/10.1021/acs.jcim.0c00269 - - - Title: Approaches using AI in medicinal chemistry - Journal: - Contributors: Christian Tyrchan, Eva Nittinger, Dea Gogishvili, Atanas Patronov, Thierry Kogej. - DOI-URL: https://doi.org/10.1016/B978-0-12-822249-2.00002-5 - - - Title: Bioactivity Prediction Based on Matched Molecular Pair and Matched Molecular Series Methods - Journal: Current Pharmaceutical Design - Contributors: Xiaoyu Ding, Chen Cui, Dingyan Wang, Jihui Zhao, Mingyue Zheng, Xiaomin Luo, Hualiang Jiang, Kaixian Chen. - DOI-URL: https://doi.org/10.2174/1381612826666200427111309 - - - Title: BRADSHAW: a system for automated molecular design - Journal: Journal of Computer-Aided Molecular Design - Contributors: Darren V. S. Green, Stephen Pickett, Chris Luscombe, Stefan Senger, David Marcus, Jamel Meslamani, David Brett, Adam Powell, Jonathan Masson. - DOI-URL: https://doi.org/10.1007/s10822-019-00234-8 - - - Title: The use of matched molecular series networks for cross target structure activity relationship translation and potency prediction - Journal: MedChemComm - Contributors: Christopher E. Keefer, George Chang. - DOI-URL: https://doi.org/10.1039/C7MD00465F - diff --git a/output/graph/cn2.js b/output/graph/cn2.js deleted file mode 100644 index dce918d24e11ba191318915544fd9c8179eb9414..0000000000000000000000000000000000000000 --- a/output/graph/cn2.js +++ /dev/null @@ -1,600 +0,0 @@ -/** -* creates a new zoom behavior -*/ -var zoom = d3.zoom().on("zoom", handle_zoom); - -/** -* creates svg object and associated attributes -* applies the zoom behavior to svg -*/ -var svg = d3.select("svg.graph") - .call(zoom), -width = svg.attr("width"), -height = svg.attr("height"), -perc; - -/** -* scale functions that return y coordinate/color of node depending on group -*/ -var color = d3.scaleOrdinal() - .domain(["Citedby", "Input", "Reference"]) - .range([' #01d7c0', ' #8b90fe ', ' #a15eb2 ']), -y_scale = d3.scaleOrdinal() - .domain(["Citedby", "Input", "Reference"]) - .range([0, 200, 400]), -to_remove; - -/** -* creates node object and (default) radius -*/ -var node, -r = 10; - -/** -* creates link object -*/ -var link; - -/** -* creates a background with a click functionality -*/ -var rect = svg.append("rect") - .attr("x", 0) - .attr("y", 0) - .attr("height", height) - .attr("width", width) - .style("fill", 'white') - .on('click', click_rect); - -/** -* creates svg object (legend) and associated attributes -* transform -* mehr kommentare -*/ -var svg_legend = d3.select("svg.legendsvg"), -legend_position = [65,95,125], -arrow_legend_position = [0,25], -arrow_group_names = ["citation","self-citation"], -group_names = ["cited by","input","reference"], -line_type = d3.scaleOrdinal() - .domain(["line","dotted"]) - .range([("8,0"),("8,8")]), -text_info = '', -text_abstract = ''; - -var legend = svg_legend.selectAll(".legend") - .data(legend_position) - .enter() - .append("g") - .attr("class","legend") - .attr("transform", function(d,i) {return "translate(0," + d + ")"; }); - -legend.append("text") - .attr("x", 80) - .attr("y", 0) - .attr("dy", ".35em") - .style("text-anchor", "start") - .text(function(d,i) {return group_names[i]}); - -legend.append("circle") - .attr("r", r) - .attr("cx",30-r) - .style("fill", color); - -var legend_arrow = svg_legend.selectAll(".legendarr") - .data(arrow_legend_position) - .enter() - .append("g") - .attr("class","legendarr") - .attr("transform", function(d) { return "translate(0," + d + ")"; }); - -legend_arrow.append("line") - .attr("x1", 10) - .attr("x2", 50) - .attr("y1", 10) - .attr("y2", 10) - .style("stroke-dasharray",line_type) - .style("stroke", '#999') - .style("stroke-width", "1px") - .style('pointer-events', 'none') - .attr('marker-end',update_marker('#999',this)); - -legend_arrow.append("text") - .attr("x", 80) - .attr("y", 10) - .attr("dy", ".35em") - .style("text-anchor", "start") - .text(function(d,i){return arrow_group_names[i]}); - -/** -* creates a new simulation -* updates the positions of the links and nodes when the - state of the layout has changed (simulation has advanced by a tick) -*/ - -var simulation = d3.forceSimulation() - .force("link", d3.forceLink().id(function(d) {return d.doi;}).distance(50).strength(function(d) { - if (d.group == "Input") {return 0;} - else {return 5;} - })) - .force("collide", d3.forceCollide(function(d) { - if (d.group == "Input") {return 70;} - else {return 75;} - }).strength(1)) - .force("charge", d3.forceManyBody().strength(0.001)) - .force("center", d3.forceCenter(width/2, height/2+20)) - .alpha(0.004) - .on("end", zoom_to); - -/** -* creates group element -*/ -var g = svg.append("g") - .attr("class", "everything") - -/** -* creates xAxis element -*/ -var xAxis = d3.axisBottom() - .tickFormat(function(d) {return d;}) - .ticks(10);; - -/** -* draw xAxis -*/ -var gX = svg.append("g") - .attr("class", "axis axis--x") - .attr("transform", "translate(0,25)") - gX.append("text") - .attr("y", 0) - .attr("x", 80) - .attr("text-anchor", "end") - .attr("stroke", "black") - .text("year"); - -/** -* loads JSON data and calls the update function -*/ -d3.json("json_text.json").then(function(graph) { - update(graph.links, graph.nodes); -}) - -var intervalId=window.setInterval(function(){ - d3.json("json_text.json").then(function(graph) { - newjson_string=JSON.stringify(graph) - var newjson = CryptoJS.MD5(newjson_string).toString(); - oldjson=localStorage.getItem("oldjson") - if(newjson !== oldjson){ - localStorage.setItem("oldjson", newjson); - window.location.reload() - } - }) -},5000); - -/** -* calls update functions for links and nodes -* adds the nodes, links and tick functionality to the simulation -* @param {object} nodes - nodes -* @param {object} links - links -*/ -function update(links, nodes) { - updateXAxis(nodes); - update_links(links); - update_nodes(nodes); - - simulation - .nodes(nodes) - .on("tick", handle_tick); - simulation.force("link") - .links(links); - - link.attr('marker-end', function(d) {return update_marker("#999", d.target);}) - .style("stroke-dasharray",function(d){return self_citation(d.source,d.target)? ("8,8"): ("1,0")}); -} - -/** -* initializes and shows xAxis -* @param {object} nodes - nodes -*/ -function updateXAxis(nodes) { - years = []; - for (i = 0; i < nodes.length; i++) { - years.push(parseInt((nodes[i]["year"]).split(" ")[2])); - } - - xscale = d3.scaleLinear() - .domain([d3.min(years)-1, d3.max(years)+1]) - .range([50, width-50]) - - xAxis.scale(xscale); - gX.call(xAxis); -} - -/** -* initializes and shows links (edges) -* @param {object} links - links -*/ -function update_links(links) { - link = g.append("g") - .selectAll(".link") - .data(links) - .enter() - .append("line") - .style("stroke-width", "1px") - .style("stroke", "#999") - .attr("class", "link"); -} - -/** -* initializes and shows nodes with circles, texts and a click functionality -* creates a new drag behavior and applies it to the circles -* @param {object} nodes - nodes -*/ -function update_nodes(nodes) { - node = g.selectAll(".node") - .data(nodes) - .enter() - .append("g") - .attr("class", "node") - .call(d3.drag() - .on("start", start_drag) - .on("drag", dragged) - ); - - node.append("circle") - .attr("class", "circle") - .attr("r", function(d) {return 1.5*r+d.citations*0.05}) - .style("fill", function(d){ return color(d.group)}) - .on('click', click_node); - - node.append("text") - .attr("class", "text") - .style("font-size", "15px") - .style('pointer-events', 'auto') - .text(function (d) {const first_author=d.author[0].split(" ") - return first_author[first_author.length-1];}) - .on('click', click_node); -} - -/** -* creates arrowhead and returns its url -* @param {string} color - color of arrowhead -* @param {string} target - target node -*/ -function update_marker(color, target) { - var radius = 1.5*r+target.citations*0.05; - svg.append('defs').append('marker') - .attr('id',color.replace("#", "")+radius) - .attr('viewBox','-0 -5 10 10') - .attr('refX',radius+9.5) - .attr('refY',0) - .attr('orient','auto') - .attr('markerWidth',10) - .attr('markerHeight',15) - .attr('xoverflow','visible') - .append('svg:path') - .attr('d', 'M 0,-5 L 10 ,0 L 0,5') - .attr('fill', color) - .style('stroke','none'); - return "url(" + color + radius + ")"; -}; - -/** -* sets color of circle and its links to black and removes the previous highlights -* displays overview info of node in textbox -* @param {object} node - node -*/ -function click_node(node) { - d3.select(this.parentNode).raise(); - fix_nodes(node); - if(to_remove){ - d3.select(to_remove).selectAll(".circle").style("stroke","none") - } - to_remove = this.parentNode; - d3.select(this.parentNode).selectAll(".circle").style("stroke","black") - mark_link(node) - textbox_content(node) - reset_button_highlight() - highlight_button("overview") -} - -/** -* removes the highlights of the circles and their links -*/ -function click_rect() { - fix_nodes(node); - d3.selectAll(".circle").style("stroke", "none") - d3.selectAll(".link") - .style("stroke", "#999") - .attr('marker-end', function(d) {return update_marker('#999', d.target);}) - text_abstract=''; - text_info=''; - reset_button_highlight() - document.getElementById('textbox').innerHTML = "Click node"; -} - -/** -* returns true if journals have a common author (self-citation) -* @param {object} source - node -* @param {object} target - node -*/ -function self_citation(source,target) { - return source.author.some(item=>target.author.includes(item)) -} - -/** -* sets color of link (line and arrowhead) to black if it is directly connected to node -* and to grey otherwise -* @param {object} node - node -*/ -function mark_link(node) { - d3.selectAll(".link") - .style("stroke", function(o) { - return is_link_for_node(node, o) ? "black" : "#DEDEDE";}) - .attr('marker-end', function(o) { - return is_link_for_node(node, o) ? update_marker('#000000', o.target) : update_marker("#DEDEDE", o.target);}) -} - -/** -* returns true if link is directly connected to node and false if it is not -* @param {object} node - node -* @param {object} link - link -*/ -function is_link_for_node(node, link) { - return link.source.index == node.index || link.target.index == node.index; -} - -/** -* saves text for overview and abstract of node -* outputs node info to textbox -* @param {object} node - node -*/ -function textbox_content(node) { - text_info = "Title:" + '</br>' + node.name + - '</br>' +'</br>'+"Author:"+ '</br>' +node.author+'</br>'+'</br>'+"Date:"+'</br>' - +node.year+'</br>'+'</br>'+"Journal:"+'</br>'+node.journal+'</br>'+'</br>'+"doi:" - +'</br>'+'<a href="'+node.doi+ '">'+node.doi+'</a>'+'</br>'+'</br>'+"Citations:" - +'</br>'+node.citations; - text_abstract = node.abstract; - document.getElementById('textbox').innerHTML = text_info; -} - -/** -* sets color of btn to dark gray -* @param {object} btn - button -*/ -function highlight_button(btn) { - reset_button_highlight(); - document.getElementById(btn).style.background = "#CACACA"; -} - -/** -* sets color of all buttons to default light gray -*/ -function reset_button_highlight() { - document.getElementById("overview").style.background = ''; - document.getElementById("abstract").style.background = ''; -} - -/** -* displays abstract in textbox if a is true, overview text otherwise -* @param {bool} a- bool -*/ -function display_abstract(a) { - if (text_abstract == '' && text_info == '') { - document.getElementById('textbox').innerHTML="Click node"; - } - else { - if (a == true) { - document.getElementById('textbox').innerHTML = text_abstract; - } - else { - document.getElementById('textbox').innerHTML = text_info; - } - } -} - -/** -* updates the positions of the links and nodes -*/ -function handle_tick() { - link.attr("x1", function (d) {return xscale(parseInt((d.source.year).split(" ")[2]));}) - .attr("y1", function (d) {return d.source.y;}) - .attr("x2", function (d) {return xscale(parseInt((d.target.year).split(" ")[2]));}) - .attr("y2", function (d) {return d.target.y;}); - node.attr("transform", function (d) {return "translate(" + xscale(parseInt((d.year).split(" ")[2])) + ", " + d.y + ")";}); -} - -/** -* initializes the dragging of the node -* @param {object} node - node -*/ -function start_drag(node) { - d3.select(this).raise(); - if (!d3.event.active) - simulation.alphaTarget(0.3).restart() - //node.fx = node.x; - node.fy = node.y; - fix_nodes(node); -} - -/** -* applies the dragging to the node -* @param {object} node - node -*/ -function dragged(node) { - //node.fx = d3.event.x; - node.fy = d3.event.y; - fix_nodes(node); -} - -/** -* fix positions of all nodes except for the current node -* @param {object} this_node - node -*/ -function fix_nodes(this_node) { - node.each(function(d) { - if (this_node != d) { - d.fx = d.x; - d.fy = d.y; - } - }); -} - -/** -* applies the transformation (zooming or dragging) to the g element -*/ -function handle_zoom() { - d3.select('g').attr("transform", d3.event.transform); - var new_xScale = d3.event.transform.rescaleX(xscale) - gX.call(xAxis.scale(new_xScale)); -} - -/** -* transforms svg so that the zoom is adapted to the size of the graph -*/ -function zoom_to() { - node_bounds = d3.selectAll("svg.graph").node().getBBox(); - svg_bounds = d3.select("rect").node().getBBox(); - - perc_x = width/(node_bounds.width+100); - perc_y = height/(node_bounds.height+100); - perc = d3.min([perc_x, perc_y]) - - d3.select('svg') - .call(zoom.scaleBy, perc); -} - -/** -* transforms svg so that the zoom and drag is reset -*/ -function reset_view() { - d3.select('svg') - .call(zoom.scaleTo, 1) - d3.select('svg') - .call(zoom.translateTo, 0.5 * width, 0.5 * height); - d3.select('svg') - .call(zoom.scaleBy, perc); -} - -/** -* save svg as png -*/ -function save_svg(){ - var svgString = get_svg_string(svg.node()); - svg_string_to_image(svgString, 2*width, 2*height, 'png', save); // passes Blob and filesize String to the callback - - function save( dataBlob, filesize ){ - saveAs(dataBlob, 'D3 vis exported to PNG.png'); // FileSaver.js function - } -}; - -/** -* generate svgString -* @param {object} svgNode - node -*/ -function get_svg_string(svgNode) { - svgNode.setAttribute('xlink', 'http://www.w3.org/1999/xlink'); - var cssStyleText = get_css_styles(svgNode); - append_css(cssStyleText, svgNode); - - var serializer = new XMLSerializer(); - var svgString = serializer.serializeToString(svgNode); - svgString = svgString.replace(/(\w+)?:?xlink=/g, 'xmlns:xlink='); // Fix root xlink without namespace - svgString = svgString.replace(/NS\d+:href/g, 'xlink:href'); // Safari NS namespace fix - - return svgString; - - function get_css_styles(parentElement) { - var selectorTextArr = []; - - // Add Parent element Id and Classes to the list - selectorTextArr.push('#' + parentElement.id); - for (var c = 0; c < parentElement.classList.length; c++) - if (!contains('.'+parentElement.classList[c], selectorTextArr)) - selectorTextArr.push('.'+parentElement.classList[c]); - - // Add Children element Ids and Classes to the list - var nodes = parentElement.getElementsByTagName("*"); - for (var i = 0; i < nodes.length; i++) { - var id = nodes[i].id; - if (!contains('#'+id, selectorTextArr)) - selectorTextArr.push('#' + id); - - var classes = nodes[i].classList; - for (var c = 0; c < classes.length; c++) - if (!contains('.'+classes[c], selectorTextArr)) - selectorTextArr.push('.'+classes[c]); - } - - // Extract CSS Rules - var extractedCSSText = ""; - for (var i = 0; i < document.styleSheets.length; i++) { - var s = document.styleSheets[i]; - - try { - if(!s.cssRules) continue; - } catch(e) { - if(e.name !== 'SecurityError') throw e; // for Firefox - continue; - } - - var cssRules = s.cssRules; - for (var r = 0; r < cssRules.length; r++) { - if (contains(cssRules[r].selectorText, selectorTextArr)) - extractedCSSText += cssRules[r].cssText; - } - } - - - return extractedCSSText; - - function contains(str,arr) { - return arr.indexOf(str) === -1 ? false : true; - } - - } - - function append_css(cssText, element) { - var styleElement = document.createElement("style"); - styleElement.setAttribute("type","text/css"); - styleElement.innerHTML = cssText; - var refNode = element.hasChildNodes() ? element.children[0] : null; - element.insertBefore(styleElement, refNode); - } -} - -/** -* convert svgString to image and export it -* @param {object} svgString - svgString -* @param {object} width - width of image -* @param {object} height - height of image -* @param {object} format - format to save image in -* @param {object} callback - callback function -*/ -function svg_string_to_image( svgString, width, height, format, callback ) { - var format = format ? format : 'png'; - - var imgsrc = 'data:image/svg+xml;base64,'+ btoa(unescape(encodeURIComponent(svgString))); // Convert SVG string to data URL - - var canvas = document.createElement("canvas"); - var context = canvas.getContext("2d"); - - canvas.width = width; - canvas.height = height; - - var image = new Image(); - image.onload = function() { - context.clearRect(0, 0, width, height); - context.drawImage(image, 0, 0, width, height); - - canvas.toBlob(function(blob) { - var filesize = Math.round(blob.length/1024) + ' KB'; - if (callback) callback(blob, filesize); - }); - - }; - - image.src = imgsrc; -} - diff --git a/output/graph/index.html b/output/graph/index.html deleted file mode 100644 index 374abe283271574e67bd8d73e3691ef35b9e782d..0000000000000000000000000000000000000000 --- a/output/graph/index.html +++ /dev/null @@ -1,172 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - - <!-- style specifications for button and div elements --> - <style type="text/css"> - button { - width: 100px; - height:20px; - display: flex; - justify-content: center; - position: absolute; - left: 455px; - top: 575px; - transition-duration: 0.4s; - border-radius:3px; - border:1px solid #909090; - } - - button.display{ - width: 120px; - top: 0px; - margin-left: 100px; - } - - .button:hover { - background-color: #CACACA; - } - - button.resetZoom { - margin-left: 110px; - } - - button.save { - margin-left: 220px; - } - - button.abstract { - width:146px; - position:absolute; - top: 181px; - left: 1114px; - border-radius:0; - border:1px solid #909090; - } - - button.overview { - width:147px; - position:absolute; - display:inline-block; - top: 181px; - left: 968px; - border-radius:0; - border:1px solid #909090; - } - - div.legendbox { - width:270px; - height:170px; - padding: 10px; - /*border: 1px solid #999;*/ - position: absolute; - top: 10px; - left: 968px; - display: inline-block; - margin: 0; - } - - div.textbox { - width:270px; - min-height:200px; - max-height:370px; - padding: 10px; - border: 1px solid #999; - position: absolute; - top: 200px; - left: 968px; - display: inline-block; - overflow-y: scroll; - margin: 0; - } - </style> -</head> - -<body> - <button id="change_graph" class="display" onclick="display()">display timeline</button> - - <!-- graph --> - <svg class="graph" width="960" height="560"></svg> - <p id="oldjson"></p> - - <!-- legend --> - <div class="legendbox"><svg class="legendsvg"></svg></div> - - <!-- textbox --> - <div class="textbox" id="textbox">Click node</div> - <button id="overview" class="overview" onclick='display_abstract(false), highlight_button("overview")'>Overview</button> - <button id="abstract" class="abstract" onclick='display_abstract(true), highlight_button("abstract")'>Abstract</button> - - <!-- buttons --> - <button onclick="location.reload()">Reload Graph</button> - <button class="resetZoom" onclick="reset_view()">Reset View</button> - <button class="save" onclick="save_svg()">Save</button> - - <!-- D3 (version 5) --> - <script src="https://d3js.org/d3.v5.min.js"></script> - - <!-- scripts to save svg element as png --> - <script src="https://cdn.rawgit.com/eligrey/canvas-toBlob.js/f1a01896135ab378aa5c0118eadd81da55e698d8/canvas-toBlob.js"></script> - <script src="https://cdn.rawgit.com/eligrey/FileSaver.js/e9d941381475b5df8b7d7691013401e171014e89/FileSaver.min.js"></script> - - <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/core.min.js"></script> - <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/md5.js"></script> - - <script type="text/javascript" > - if(window.location.hash=='#default'){ - document.getElementById("change_graph").innerHTML = 'display timeline'; - load_default(); - - } - else if(window.location.hash=='#time'){ - document.getElementById("change_graph").innerHTML = 'display default'; - load_time(); - - } - else if(window.location.hash==''){ - window.location.hash = 'default'; - document.getElementById("change_graph").innerHTML = 'display timeline'; - load_default(); - } - function display(){ - if(window.location.hash=='#time'){ - display_default(); - } - else if(window.location.hash=='#default'){ - display_time(); - } - } - function display_default(){ - window.location.hash = 'default'; - window.location.reload(); - } - function display_time(){ - window.location.hash = 'time'; - window.location.reload(); - - } - function load_default(){ - var htmlHeader = document.getElementsByTagName("head")[0]; - var myScript = document.createElement('script'); - myScript.type = 'text/javascript'; - myScript.src = 'cn.js'; - myScript.id='abc'; - htmlHeader.appendChild(myScript); - } - function load_time(){ - var htmlHeader = document.getElementsByTagName("head")[0]; - var myScript = document.createElement('script'); - myScript.type = 'text/javascript'; - myScript.src = 'cn2.js'; - myScript.id='abc'; - htmlHeader.appendChild(myScript); - - } - </script> - - <!-- javascript for force-directed graph - <script type="text/javascript" id="cn" src="cn.js"></script> --> - -</body> -</html> \ No newline at end of file diff --git a/output/graph/json_text.json b/output/graph/json_text.json deleted file mode 100644 index eb3c1d3d7ab6d4d770686f9170bfae697b7d2ca7..0000000000000000000000000000000000000000 --- a/output/graph/json_text.json +++ /dev/null @@ -1,819 +0,0 @@ -{ - "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": "May 24, 2019", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.9b00249", - "group": "input", - "citations": 5 - }, - { - "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": "July 7, 2021", - "journal": "Chem. Rev.", - "doi": "https://doi.org/10.1021/acs.chemrev.1c00107", - "group": "height", - "citations": 1 - }, - { - "name": "Disconnected Maximum Common Substructures under Constraints", - "author": [ - "Robert Schmidt", - "Florian Krull", - "Anna Lina Heinzke", - "Matthias Rarey" - ], - "year": "December 16, 2020", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.0c00741", - "group": "height", - "citations": 0 - }, - { - "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": "November 3, 2020", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/acs.jmedchem.0c01332", - "group": "height", - "citations": 8 - }, - { - "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": "May 23, 2019", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.9b00250", - "group": "height", - "citations": 12 - }, - { - "name": "AutoDock Vina 1.2.0: New Docking Methods, Expanded Force Field, and Python Bindings", - "author": [ - "Jerome Eberhardt", - "Diogo Santos-Martins", - "Andreas F. Tillack", - "Stefano Forli" - ], - "year": "July 19, 2021", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.1c00203", - "group": "input", - "citations": 1 - }, - { - "name": "Accelerating AutoDock4 with GPUs and Gradient-Based Local Search", - "author": [ - "Diogo Santos-Martins", - "Leonardo Solis-Vasquez", - "Andreas F Tillack", - "Michel F Sanner", - "Andreas Koch", - "Stefano Forli" - ], - "year": "January 6, 2021", - "journal": "Journal of Chemical Theory and Computation", - "doi": "https://doi.org/10.1021/acs.jctc.0c01006", - "group": "depth", - "citations": 14 - }, - { - "name": "Docking Flexible Cyclic Peptides with AutoDock CrankPep", - "author": [ - "Yuqi Zhang", - "Michel F. Sanner" - ], - "year": "September 11, 2019", - "journal": "Journal of Chemical Theory and Computation", - "doi": "https://doi.org/10.1021/acs.jctc.9b00557", - "group": "depth", - "citations": 9 - }, - { - "name": "Lessons Learned in Empirical Scoring with smina from the CSAR 2011 Benchmarking Exercise", - "author": [ - "David Ryan Koes", - "Matthew P. Baumgartner", - "Carlos J. Camacho" - ], - "year": "February 4, 2013", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci300604z", - "group": "depth", - "citations": 100 - }, - { - "name": "Vina-Carb: Improving Glycosidic Angles during Carbohydrate Docking", - "author": [ - "Anita K. Nivedha", - "David F. Thieker", - "Spandana Makeneni", - "Huimin Hu", - "Robert J. Woods" - ], - "year": "January 8, 2016", - "journal": "Journal of Chemical Theory and Computation", - "doi": "https://doi.org/10.1021/acs.jctc.5b00834", - "group": "depth", - "citations": 48 - }, - { - "name": "Lennard-Jones Potential and Dummy Atom Settings to Overcome the AUTODOCK Limitation in Treating Flexible Ring Systems", - "author": [ - "Stefano Forli", - "Maurizio Botta" - ], - "year": "June 22, 2007", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci700036j", - "group": "depth", - "citations": 32 - }, - { - "name": "AutoDock4Zn: An Improved AutoDock Force Field for Small-Molecule Docking to Zinc Metalloproteins", - "author": [ - "Diogo Santos-Martins", - "Stefano Forli", - "Maria Jo\u00e3o Ramos", - "Arthur J. Olson" - ], - "year": "June 15, 2014", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci500209e", - "group": "depth", - "citations": 100 - }, - { - "name": "A Force Field with Discrete Displaceable Waters and Desolvation Entropy for Hydrated Ligand Docking", - "author": [ - "Stefano Forli", - "Arthur J. Olson" - ], - "year": "December 9, 2011", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/jm2005145", - "group": "depth", - "citations": 100 - }, - { - "name": "Consensus Docking: Improving the Reliability of Docking in a Virtual Screening Context", - "author": [ - "Douglas R. Houston", - "Malcolm D. Walkinshaw" - ], - "year": "January 27, 2013", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci300399w", - "group": "depth", - "citations": 100 - }, - { - "name": "Inhomogeneous Fluid Approach to Solvation Thermodynamics. 1. Theory", - "author": [ - "Themis Lazaridis" - ], - "year": "April 14, 1998", - "journal": "Journal of Physical Chemistry B", - "doi": "https://doi.org/10.1021/jp9723574", - "group": "depth", - "citations": 100 - }, - { - "name": "Inhomogeneous Fluid Approach to Solvation Thermodynamics. 2. Applications to Simple Fluids", - "author": [ - "Themis Lazaridis" - ], - "year": "April 14, 1998", - "journal": "Journal of Physical Chemistry B", - "doi": "https://doi.org/10.1021/jp972358w", - "group": "depth", - "citations": 100 - }, - { - "name": "ZINC20\u2014A Free Ultralarge-Scale Chemical Database for Ligand Discovery", - "author": [ - "John J. Irwin", - "Khanh G. Tang", - "Jennifer Young", - "Chinzorig Dandarchuluun", - "Benjamin R. Wong", - "Munkhzul Khurelbaatar", - "Yurii S. Moroz", - "John Mayfield", - "Roger A. Sayle" - ], - "year": "October 29, 2020", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.0c00675", - "group": "depth", - "citations": 25 - }, - { - "name": "Structural Biology-Inspired Discovery of Novel KRAS\u2013PDE\u03b4 Inhibitors", - "author": [ - "Yan Jiang", - "Chunlin Zhuang", - "Long Chen", - "Junjie Lu", - "Guoqiang Dong", - "Zhenyuan Miao", - "Wannian Zhang", - "Jian Li", - "Chunquan Sheng" - ], - "year": "September 20, 2017", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/acs.jmedchem.7b01243", - "group": "depth", - "citations": 12 - }, - { - "name": "Directory of Useful Decoys, Enhanced (DUD-E): Better Ligands and Decoys for Better Benchmarking", - "author": [ - "Michael M. Mysinger", - "Michael Carchia", - "John. J. Irwin", - "Brian K. Shoichet" - ], - "year": "June 20, 2012", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/jm300687e", - "group": "depth", - "citations": 100 - }, - { - "name": "Evaluation of AutoDock and AutoDock Vina on the CASF-2013 Benchmark", - "author": [ - "Thomas Gaillard" - ], - "year": "July 10, 2018", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.8b00312", - "group": "depth", - "citations": 74 - }, - { - "name": "Autodock Vina Adopts More Accurate Binding Poses but Autodock4 Forms Better Binding Affinity", - "author": [ - "Nguyen Thanh Nguyen", - "Trung Hai Nguyen", - "T. Ngoc Han Pham", - "Nguyen Truong Huy", - "Mai Van Bay", - "Minh Quan Pham", - "Pham Cam Nam", - "Van V. Vu", - "Son Tung Ngo" - ], - "year": "December 30, 2019", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.9b00778", - "group": "depth", - "citations": 65 - }, - { - "name": "Glide:\u2009 A New Approach for Rapid, Accurate Docking and Scoring. 1. Method and Assessment of Docking Accuracy", - "author": [ - "Richard A. Friesner", - "Jay L. Banks", - "Robert B. Murphy", - "Thomas A. Halgren", - "Jasna J. Klicic", - "Daniel T. Mainz", - "Matthew P. Repasky", - "Eric H. Knoll", - "Mee Shelley", - "Jason K. Perry", - "David E. Shaw", - "Perry Francis", - "Peter S. Shenkin" - ], - "year": "February 27, 2004", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/jm0306430", - "group": "depth", - "citations": 97 - }, - { - "name": "Surflex:\u2009 Fully Automatic Flexible Molecular Docking Using a Molecular Similarity-Based Search Engine", - "author": [ - "Ajay N. Jain" - ], - "year": "January 21, 2003", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/jm020406h", - "group": "depth", - "citations": 100 - }, - { - "name": "ID-Score: A New Empirical Scoring Function Based on a Comprehensive Set of Descriptors Related to Protein\u2013Ligand Interactions", - "author": [ - "Guo-Bo Li", - "Ling-Ling Yang", - "Wen-Jing Wang", - "Lin-Li Li", - "Sheng-Yong Yang" - ], - "year": "February 9, 2013", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci300493w", - "group": "depth", - "citations": 99 - }, - { - "name": "A Knowledge-Based Energy Function for Protein\u2212Ligand, Protein\u2212Protein, and Protein\u2212DNA Complexes", - "author": [ - "Chi Zhang", - "Song Liu", - "Qianqian Zhu", - "Yaoqi Zhou" - ], - "year": "February 16, 2005", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/jm049314d", - "group": "depth", - "citations": 100 - }, - { - "name": "Novel Anti-Hepatitis B Virus Activity of Euphorbia schimperi and Its Quercetin and Kaempferol Derivatives", - "author": [ - "Mohammad K. Parvez", - "Sarfaraz Ahmed", - "Mohammed S. Al-Dosari", - "Mazin A. S. Abdelwahid", - "Ahmed H. Arbab", - "Adnan J. Al-Rehaily", - "Mai M. Al-Oqail" - ], - "year": "October 21, 2021", - "journal": "ACS Omega", - "doi": "https://doi.org/10.1021/acsomega.1c04320", - "group": "height", - "citations": 0 - }, - { - "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": "July 16, 2021", - "journal": "ACS Med. Chem. Lett.", - "doi": "https://doi.org/10.1021/acsmedchemlett.1c00251", - "group": "height", - "citations": 0 - }, - { - "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": "May 13, 2021", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/acs.jmedchem.1c00416", - "group": "height", - "citations": 0 - }, - { - "name": "Topological Characterization and Graph Entropies of Tessellations of Kekulene Structures: Existence of Isentropic Structures and Applications to Thermochemistry, Nuclear Magnetic Resonance, and Electron Spin Resonance", - "author": [ - "S. Ruth Julie Kavitha", - "Jessie Abraham", - "Micheal Arockiaraj", - "Joseph Jency", - "Krishnan Balasubramanian" - ], - "year": "September 1, 2021", - "journal": "J. Phys. Chem. A", - "doi": "https://doi.org/10.1021/acs.jpca.1c06264", - "group": "height", - "citations": 0 - }, - { - "name": "Automatic Identification of Lansoprazole Degradants under Stress Conditions by LC-HRMS with MassChemSite and WebChembase", - "author": [ - "Stefano Bonciarelli", - "Jenny Desantis", - "Laura Goracci", - "Lydia Siragusa", - "Ismael Zamora", - "Elisabeth Ortega-Carrasco" - ], - "year": "June 1, 2021", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.1c00226", - "group": "height", - "citations": 0 - }, - { - "name": "Computational Approaches to Identify Structural Alerts and Their Applications in Environmental Toxicology and Drug Discovery", - "author": [ - "Hongbin Yang", - "Chaofeng Lou", - "Weihua Li", - "Guixia Liu", - "Yun Tang" - ], - "year": "February 24, 2020", - "journal": "Chem. Res. Toxicol.", - "doi": "https://doi.org/10.1021/acs.chemrestox.0c00006", - "group": "height", - "citations": 11 - }, - { - "name": "Toward a Global Understanding of Chemical Pollution: A First Comprehensive Analysis of National and Regional Chemical Inventories", - "author": [ - "Zhanyun Wang", - "Glen W. Walker", - "Derek C. G. Muir", - "Kakuko Nagatani-Yoshida" - ], - "year": "January 22, 2020", - "journal": "Environ. Sci. Technol.", - "doi": "https://doi.org/10.1021/acs.est.9b06379", - "group": "height", - "citations": 100 - }, - { - "name": "ZINC \u2212 A Free Database of Commercially Available Compounds for Virtual Screening", - "author": [ - "John J. Irwin", - "Brian K. Shoichet" - ], - "year": "December 14, 2004", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci049714+", - "group": "depth", - "citations": 99 - }, - { - "name": "ZINC: A Free Tool to Discover Chemistry for Biology", - "author": [ - "John J. Irwin", - "Teague Sterling", - "Michael M. Mysinger", - "Erin S. Bolstad", - "Ryan G. Coleman" - ], - "year": "May 15, 2012", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci3001277", - "group": "depth", - "citations": 100 - }, - { - "name": "ZINC 15 \u2013 Ligand Discovery for Everyone", - "author": [ - "Teague Sterling", - "John J. Irwin" - ], - "year": "October 19, 2015", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/acs.jcim.5b00559", - "group": "depth", - "citations": 98 - }, - { - "name": "Application of Belief Theory to Similarity Data Fusion for Use in Analog Searching and Lead Hopping", - "author": [ - "Steven W. Muchmore", - "Derek A. Debe", - "James T. Metz", - "Scott P. Brown", - "Yvonne C. Martin", - "Philip J. Hajduk" - ], - "year": "April 17, 2008", - "journal": "Journal of Chemical Information and Modeling", - "doi": "https://doi.org/10.1021/ci7004498", - "group": "depth", - "citations": 100 - }, - { - "name": "Do Structurally Similar Molecules Have Similar Biological Activity?", - "author": [ - "Yvonne C. Martin", - "James L. Kofron", - "Linda M. Traphagen" - ], - "year": "August 13, 2002", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/jm020155c", - "group": "depth", - "citations": 100 - }, - { - "name": "The Properties of Known Drugs. 1. Molecular Frameworks", - "author": [ - "Guy W. Bemis", - "Mark A. Murcko" - ], - "year": "July 19, 1996", - "journal": "Journal of Medicinal Chemistry", - "doi": "https://doi.org/10.1021/jm9602928", - "group": "depth", - "citations": 100 - }, - { - "name": "Molecular Shape Diversity of Combinatorial Libraries:\u2009 A Prerequisite for Broad Bioactivity\u2020", - "author": [ - "Wolfgang H. B. Sauer", - "Matthias K. Schwarz" - ], - "year": "March 14, 2003", - "journal": "J. Chem. Inf. Comput. Sci.", - "doi": "https://doi.org/10.1021/ci025599w", - "group": "depth", - "citations": 99 - } - ], - "links": [ - { - "source": "https://doi.org/10.1021/acs.chemrev.1c00107", - "target": "https://doi.org/10.1021/acs.jcim.9b00249" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00741", - "target": "https://doi.org/10.1021/acs.jcim.9b00249" - }, - { - "source": "https://doi.org/10.1021/acs.jmedchem.0c01332", - "target": "https://doi.org/10.1021/acs.jcim.9b00249" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.9b00250", - "target": "https://doi.org/10.1021/acs.jcim.9b00249" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/acs.jctc.0c01006" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/acs.jctc.9b00557" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/ci300604z" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/acs.jctc.5b00834" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/ci700036j" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/ci500209e" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/jm2005145" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/ci300399w" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/jp9723574" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/jp972358w" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/acs.jcim.0c00675" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/acs.jmedchem.7b01243" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/jm300687e" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/acs.jcim.8b00312" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/acs.jcim.9b00778" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/jm0306430" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/jm020406h" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/ci300493w" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00203", - "target": "https://doi.org/10.1021/jm049314d" - }, - { - "source": "https://doi.org/10.1021/acsomega.1c04320", - "target": "https://doi.org/10.1021/acs.jcim.1c00203" - }, - { - "source": "https://doi.org/10.1021/acsmedchemlett.1c00251", - "target": "https://doi.org/10.1021/acs.jmedchem.0c01332" - }, - { - "source": "https://doi.org/10.1021/acs.jmedchem.1c00416", - "target": "https://doi.org/10.1021/acs.jmedchem.0c01332" - }, - { - "source": "https://doi.org/10.1021/acs.jpca.1c06264", - "target": "https://doi.org/10.1021/acs.chemrev.1c00107" - }, - { - "source": "https://doi.org/10.1021/acs.chemrev.1c00107", - "target": "https://doi.org/10.1021/acs.jcim.9b00250" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.1c00226", - "target": "https://doi.org/10.1021/acs.jcim.9b00250" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00741", - "target": "https://doi.org/10.1021/acs.jcim.9b00250" - }, - { - "source": "https://doi.org/10.1021/acs.jmedchem.0c01332", - "target": "https://doi.org/10.1021/acs.jcim.9b00250" - }, - { - "source": "https://doi.org/10.1021/acs.chemrestox.0c00006", - "target": "https://doi.org/10.1021/acs.jcim.9b00250" - }, - { - "source": "https://doi.org/10.1021/acs.est.9b06379", - "target": "https://doi.org/10.1021/acs.jcim.9b00250" - }, - { - "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.0c00675", - "target": "https://doi.org/10.1021/ci049714+" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00675", - "target": "https://doi.org/10.1021/ci3001277" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00675", - "target": "https://doi.org/10.1021/acs.jcim.5b00559" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00675", - "target": "https://doi.org/10.1021/ci7004498" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00675", - "target": "https://doi.org/10.1021/jm020155c" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00675", - "target": "https://doi.org/10.1021/jm9602928" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00675", - "target": "https://doi.org/10.1021/ci025599w" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.5b00559", - "target": "https://doi.org/10.1021/ci049714+" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.5b00559", - "target": "https://doi.org/10.1021/ci3001277" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.5b00559", - "target": "https://doi.org/10.1021/jm300687e" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.8b00312", - "target": "https://doi.org/10.1021/ci300604z" - }, - { - "source": "https://doi.org/10.1021/acs.jctc.0c01006", - "target": "https://doi.org/10.1021/ci700036j" - }, - { - "source": "https://doi.org/10.1021/acs.jctc.9b00557", - "target": "https://doi.org/10.1021/ci700036j" - }, - { - "source": "https://doi.org/10.1021/ci500209e", - "target": "https://doi.org/10.1021/ci700036j" - }, - { - "source": "https://doi.org/10.1021/acs.jctc.0c01006", - "target": "https://doi.org/10.1021/ci500209e" - }, - { - "source": "https://doi.org/10.1021/acs.jctc.0c01006", - "target": "https://doi.org/10.1021/jm2005145" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.8b00312", - "target": "https://doi.org/10.1021/jm2005145" - }, - { - "source": "https://doi.org/10.1021/ci500209e", - "target": "https://doi.org/10.1021/jm2005145" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.0c00741", - "target": "https://doi.org/10.1021/jm300687e" - }, - { - "source": "https://doi.org/10.1021/acs.jcim.9b00778", - "target": "https://doi.org/10.1021/acs.jcim.8b00312" - }, - { - "source": "https://doi.org/10.1021/acs.jctc.0c01006", - "target": "https://doi.org/10.1021/acs.jcim.9b00778" - }, - { - "source": "https://doi.org/10.1021/acs.jctc.0c01006", - "target": "https://doi.org/10.1021/ci049714+" - }, - { - "source": "https://doi.org/10.1021/ci7004498", - "target": "https://doi.org/10.1021/jm020155c" - }, - { - "source": "https://doi.org/10.1021/acsmedchemlett.1c00251", - "target": "https://doi.org/10.1021/ci025599w" - }, - { - "source": "https://doi.org/10.1021/acs.jmedchem.0c01332", - "target": "https://doi.org/10.1021/ci025599w" - } - ] -} \ No newline at end of file diff --git a/requirements b/requirements new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/start_script.py b/start_script.py deleted file mode 100644 index 9e674cfb87b30c403c641119bc4cc344e2bc6acc..0000000000000000000000000000000000000000 --- a/start_script.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys -import gc -from pathlib import Path -from verarbeitung.process_main import Processing -#from verarbeitung.dev_files.print_graph_test import try_known_publications, try_delete_nodes - - -doi_list = [] -#doi_list.append('https://pubs.acs.org/doi/10.1021/acs.jcim.9b00249') -#doi_list.append('https://doi.org/10.1021/acs.jcim.9b00249') -#doi_list.append('https://pubs.acs.org/doi/10.1021/acs.jcim.1c00203') -doi_list.append('https://doi.org/10.1021/acs.jmedchem.0c01332') -doi_list.append('https://pubs.acs.org/doi/10.1021/acs.jcim.6b00709') -error_list = Processing(doi_list, 2, 2, 'test.json') -print(error_list) - -del doi_list -del error_list -gc.collect() diff --git a/ui_programm_fragmente/input_to_checklist.py b/ui_programm_fragmente/input_to_checklist.py deleted file mode 100644 index 3c00ed4c23c7acf914c02af576fec41d8ba2efc7..0000000000000000000000000000000000000000 --- a/ui_programm_fragmente/input_to_checklist.py +++ /dev/null @@ -1,160 +0,0 @@ -import dash -from dash import dcc -from dash import html -from dash import callback_context -from dash.dependencies import Input, Output, State -from dash.exceptions import PreventUpdate -from input.interface import InputInterface -import input.publication - -app = dash.Dash(__name__) - -additional_options = ['Update Automatically'] - -app.layout = html.Div([ - # Layer 0: For the Header and Help Function(s) - html.Div([ - html.Button(id='show-info',children='Show Info',n_clicks=0), - html.Div(id='info-box') - ]), - # Layer 1: For all mandatory Inputs - html.Div([ - "Input: ", - dcc.Input(id='input-string', value='', type='text',debounce=True), - dcc.Input(id='forward-depth',value='1',type='number',min='1',max='10'), - dcc.Input(id='backward-depth',value='1',type='number',min='1',max='10') - ]), - # Layer 2: For the checklist, Remove-/Start-Buttons and input-error-message - html.Div([ - dcc.Checklist(id='input-checklist',options=[],labelStyle = dict(display='block'),value=[]), - html.Div(id='input-err',style={'color':'red'}), - html.Button(id='clear-all-button',children='Clear All'), - html.Button(id='clear-selected-button',children='Clear Selected'), - html.Button(id='start-button',children='Generate Graph') - ]), - # Layer 3: For additional Options (e.g. Topological Sort) - html.Div([ - html.H4('Additional Options'), - dcc.Checklist(id='additional-options', - options=[{'label':k,'value':k} for k in additional_options], - value=[]) - ]), - # Layer 4: For the Graph - html.Div([ - html.Div(id='test-output') - ]) -]) - -''' -Most important callback function. Updates the checklist that holds all inputs. -input-string is required as Output to clear the input box after each input -''' -@app.callback( - Output('input-checklist','options'), - Output('input-checklist','value'), - Output('input-string','value'), - Output('input-err','children'), - Input('input-string','value'), - Input('clear-all-button','n_clicks'), - Input('clear-selected-button','n_clicks'), - State('input-checklist','options'), - State('input-checklist','value') -) -def update_input_checklist(input_value,btn1,btn2,all_inputs,selected_inputs): - ''' - :param input_value: given by dcc.Input - :type input_value: string - :param btn1: signals pressing of clear-all-button - :param btn2: signals pressing of clear-selected-button - :param all_inputs: all labels and values from the checklist, - regardless if they have been checked or not - :type all_inputs: list of dictionaries with 2 entries each - :param selected_inputs: values of all checked elements - :type selected_inputs: list of strings - ''' - changed_id = [p['prop_id'] for p in callback_context.triggered][0] - # if clear-all-button was pressed: - if 'clear-all-button' in changed_id: - return list(),list(),'','' - # if clear-selected-button was pressed: - if 'clear-selected-button' in changed_id: - all_inputs = [i for i in all_inputs if i['value'] not in selected_inputs] - return all_inputs,list(),'','' - # when the programm is first started: - if input_value == '': - app.layout['input-checklist'].options.clear() - return list(),list(),'','' - # when a new element is added via dcc.Input - if 'input-string' in changed_id: - options = all_inputs - currValues = [x['value'] for x in options] - if input_value not in currValues: - try: - i = InputInterface() - pub = i.get_pub_light(input_value) - except Exception as err: - return options,selected_inputs,'','{}'.format(err) - rep_str = pub.contributors[0] + ',' + pub.journal + ',' + pub.publication_date - options.append({'label':rep_str, 'value':input_value}) - return options,selected_inputs,'','' - -''' -This callback shows and hides the (first) help-box -''' -@app.callback( - Output('info-box','children'), - Input('show-info','n_clicks') -) -def show_hide_info_box(n_clicks): - if n_clicks % 2 == 0: - return '' - else: - return 'Hier koennte Ihre Werbung stehen' - -''' -Basic structure for a callback that generates an output -''' -@app.callback( - Output('test-output','children'), - Input('start-button','n_clicks'), - Input('input-checklist','options'), - Input('input-checklist','value'), - Input('forward-depth','value'), - Input('backward-depth','value'), - State('additional-options','value') -) -def generate_output(n_clicks,all_inputs,selected_inputs, - forward_depth,backward_depth,additional_options): - ''' - :param n_clicks: how often has Generate Graph been clicked - :type n_clicks: int - :param all_inputs: all labels and values from the checklist, - regardless if they have been checked or not - :type all_inputs: list of dictionaries with 2 entries each - :param selected_inputs: values of all checked elements - :type selected_inputs: list of strings - :param forward_depth: forward recursion depth - :type forward_depth: unsigned int - :param backward_depth: backward recursion depth - :type backward_depth: unsigned int - :param additional_options: value of all selected additional options - :type additional_options: list of strings - ''' - changed_id = [p['prop_id'] for p in callback_context.triggered][0] - if n_clicks is None: - raise PreventUpdate - elif 'Update Automatically' in additional_options \ - or 'start-button' in changed_id: - s = '' - for i in range(len(all_inputs)): - x = all_inputs[i]['value'] - if x in selected_inputs: - s += x*(abs(int(forward_depth)-int(backward_depth))) - else: - s += x*(int(forward_depth)+int(backward_depth)) - return s - else: - raise PreventUpdate - -if __name__ == '__main__': - app.run_server(debug=True) diff --git a/ui_programm_fragmente/upload_to_checklist.py b/ui_programm_fragmente/upload_to_checklist.py deleted file mode 100644 index 9a094f213901a808ad924f4b1ffa87fb87f2f75d..0000000000000000000000000000000000000000 --- a/ui_programm_fragmente/upload_to_checklist.py +++ /dev/null @@ -1,78 +0,0 @@ -import dash -from dash import dcc -from dash import html -from dash.dependencies import Input, Output, State -import base64 -import re - -app = dash.Dash(__name__) - -list_of_inputs = dict() - -app.layout = html.Div([ - html.H4("Add all lines in a file to a list"), - html.Div([ - dcc.Upload( - id="upload-data", - children=html.Div( - ["Drag and drop or click to select a file to upload."] - ), - - style={ - "width": "30%", - "height": "60px", - "lineHeight": "60px", - "borderWidth": "1px", - "borderStyle": "dashed", - "borderRadius": "5px", - "textAlign": "center", - "margin": "10px", - }), - - ]), - dcc.Checklist(id='input-checklist',options=list(),labelStyle = dict(display='block'),value=[]), - -]) - -@app.callback( - Output('input-checklist','options'), - Input('upload-data','filename'), - Input('upload-data','contents'), - State('input-checklist','options') -) -def update_input_list(uploaded_filenames,uploaded_file_contents,all_inputs): - if uploaded_file_contents is not None: - - - string = uploaded_file_contents - - #cutting the first part of the String away to decode - found = base64.b64decode(re.search(',(.+?)$', string).group(1)) - print(found.decode('utf-8')) - - uploaded_file_contents = found.decode('utf-8') - - - list_of_inputs = (uploaded_file_contents.split()) - #das hier sollte es untereinander anzeigen, bekomme ich allerdings nicht auf die Seite... - #return (*list_of_inputs, sep="\n") - - options = all_inputs - if not options: - options = list() - CurrValues = [x['value'] for x in options] - - - # würde auch funktionieren - # return (found.decode('utf-8')) - for i in list_of_inputs: - if i not in CurrValues: - options.append({'label':i, 'value':i}) - - - return options - -if __name__ == '__main__': - app.run_server(debug=True) - - diff --git a/verarbeitung/construct_new_graph/add_citations_rec.py b/verarbeitung/construct_new_graph/add_citations_rec.py index 95afa3553e9b0927196bcb94d792b5b5be82e83d..dee665cbbdfb139e0ddc44654784cf1236a82be9 100644 --- a/verarbeitung/construct_new_graph/add_citations_rec.py +++ b/verarbeitung/construct_new_graph/add_citations_rec.py @@ -46,7 +46,7 @@ def get_cit_type_list(pub, cit_type): :param cit_type: variable to differenciate citation and reference call :type cit_type: String - function to create nodes and edges and call create_graph_structure_citations + function to return citation or reference list for given pub ''' if cit_type == "Citation": return(pub.citations) @@ -164,12 +164,16 @@ def process_citations_rec(citations_pub_obj_list, search_depth, search_depth_max ''' # adds next level to nodes/edges + + new_citation_pub_obj_save_list = [] for pub in citations_pub_obj_list: - new_citation_pub_obj_list = create_graph_structure_citations(pub, search_depth, search_depth_max, cit_type, test_var) + new_citation_pub_obj_list = create_graph_structure_citations(pub, search_depth, search_depth_max, cit_type, test_var) + if len(new_citation_pub_obj_list) > 0: + new_citation_pub_obj_save_list += new_citation_pub_obj_list # If the maximum depth has not yet been reached, calls function recursivly with increased depth - if (search_depth < search_depth_max): - process_citations_rec(new_citation_pub_obj_list, search_depth+1, search_depth_max, cit_type, test_var) + if (search_depth < search_depth_max): + process_citations_rec(new_citation_pub_obj_save_list, search_depth+1, search_depth_max, cit_type, test_var) def add_citations(input_nodes, input_edges, citations_pub_obj_list, search_depth, search_depth_max, cit_type, test_var): diff --git a/verarbeitung/construct_new_graph/export_to_json.py b/verarbeitung/construct_new_graph/export_to_json.py index fd21dc1728fa4f5af19573cebe2a160c1a69c30b..d093f63f43cfe2b3c81e2c87ad3b15b195ef934c 100644 --- a/verarbeitung/construct_new_graph/export_to_json.py +++ b/verarbeitung/construct_new_graph/export_to_json.py @@ -31,6 +31,7 @@ def format_nodes(nodes): new_dict["author"] = node.contributors new_dict["year"] = node.publication_date new_dict["journal"] = node.journal + new_dict["abstract"] = node.abstract if (node.group == 0): new_dict["group"] = "Input" elif (node.group > 0): @@ -60,7 +61,7 @@ def format_edges(edges): return list_of_edge_dicts -def output_to_json(nodes, edges, json_file = 'json_text.json', test_var = False): +def output_to_json(nodes, edges, search_depth, search_height, json_file = 'json_text.json', test_var = False): ''' :param nodes: list of publications to export to json :type nodes: List[Publication] @@ -78,6 +79,7 @@ def output_to_json(nodes, edges, json_file = 'json_text.json', test_var = False) list_of_edge_dicts = format_edges(edges) dict_of_all["nodes"] = list_of_node_dicts dict_of_all["links"] = list_of_edge_dicts + dict_of_all["depth_height"] = [search_depth, search_height] if (test_var): if json_file != 'json_text.json': with open(json_file,'w') as outfile: diff --git a/verarbeitung/construct_new_graph/initialize_graph.py b/verarbeitung/construct_new_graph/initialize_graph.py index 1368f6ea92e4b030b9a37fdbd7fb5ff2573968b2..4615d5eb67914b8dd81e050d998bb1c61fd8ac33 100644 --- a/verarbeitung/construct_new_graph/initialize_graph.py +++ b/verarbeitung/construct_new_graph/initialize_graph.py @@ -85,6 +85,7 @@ def initialize_nodes_list(doi_input_list, search_depth_max, search_height_max, t for node in nodes: #iterates over every node in the set of nodes if (pub.doi_url == node.doi_url): #determines that a node with this doi already is in the set not_in_nodes = False #false --> node will not be created + node.group = 0 break if (not_in_nodes): #there is no node with this doi in the set nodes.append(pub) #appends Publication Object @@ -106,10 +107,24 @@ def initialize_nodes_list(doi_input_list, search_depth_max, search_height_max, t -def complete_inner_edges(): +def complete_inner_edges(update_var = False, input_nodes = [], input_edges = []): ''' + :param update_var: variable to check if call is from update_graph with known nodes and edges or fresh construction + :type update_var: boolean + + :param input_nodes: list of publications from update_graph + :type input_nodes: List[Publication] + + :param input_edges: list of links from update_graph + :type input_edges: List[List[String,String]] + completes inner edges between nodes of group height and depth ''' + if update_var: + global nodes, edges + + nodes = input_nodes + edges = input_edges for node in nodes: if (node.group < 0): @@ -138,14 +153,14 @@ def init_graph_construction(doi_input_list, search_depth, search_height, test_va :param test_var: variable to differenciate between test and url call :type test_var: boolean - :param test_var: variable to check if call is from update_graph with known nodes and edges or fresh construction - :type test_var: boolean + :param update_var: variable to check if call is from update_graph with known nodes and edges or fresh construction + :type update_var: boolean :param input_nodes: list of publications from update_graph :type input_nodes: List[Publication] - :param input_nodes: list of links from update_graph - :type input_nodes: List[List[String,String]] + :param input_edges: list of links from update_graph + :type input_edges: List[List[String,String]] main function to start graph generation ''' diff --git a/verarbeitung/json_text.json b/verarbeitung/json_text.json index 183e7647e90c750badbd216f3ec62d9935c79e0c..f77fc38c5d062f2c4eb808b2180e4256c493681b 100644 --- a/verarbeitung/json_text.json +++ b/verarbeitung/json_text.json @@ -1 +1 @@ -{"nodes": [{"doi": "https://doi.org/10.1021/acs.jcim.9b00249", "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": "May 24, 2019", "journal": "Journal of Chemical Information and Modeling", "group": "Input", "depth": 0, "citations": 5}, {"doi": "https://doi.org/10.1021/acs.chemrev.1c00107", "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": "July 7, 2021", "journal": "Chem. Rev.", "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "https://doi.org/10.1021/acs.jcim.0c00741", "name": "Disconnected Maximum Common Substructures under Constraints", "author": ["Robert Schmidt", "Florian Krull", "Anna Lina Heinzke", "Matthias Rarey"], "year": "December 16, 2020", "journal": "Journal of Chemical Information and Modeling", "group": "Citedby", "depth": 1, "citations": 0}, {"doi": "https://doi.org/10.1021/acs.jmedchem.0c01332", "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": "November 3, 2020", "journal": "Journal of Medicinal Chemistry", "group": "Citedby", "depth": 1, "citations": 8}, {"doi": "https://doi.org/10.1021/acs.jcim.9b00250", "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": "May 23, 2019", "journal": "Journal of Chemical Information and Modeling", "group": "Citedby", "depth": 1, "citations": 12}], "links": [{"source": "https://doi.org/10.1021/acs.chemrev.1c00107", "target": "https://doi.org/10.1021/acs.jcim.9b00249"}, {"source": "https://doi.org/10.1021/acs.jcim.0c00741", "target": "https://doi.org/10.1021/acs.jcim.9b00249"}, {"source": "https://doi.org/10.1021/acs.jmedchem.0c01332", "target": "https://doi.org/10.1021/acs.jcim.9b00249"}, {"source": "https://doi.org/10.1021/acs.jcim.9b00250", "target": "https://doi.org/10.1021/acs.jcim.9b00249"}, {"source": "https://doi.org/10.1021/acs.chemrev.1c00107", "target": "https://doi.org/10.1021/acs.jcim.9b00250"}, {"source": "https://doi.org/10.1021/acs.jcim.0c00741", "target": "https://doi.org/10.1021/acs.jcim.9b00250"}, {"source": "https://doi.org/10.1021/acs.jmedchem.0c01332", "target": "https://doi.org/10.1021/acs.jcim.9b00250"}, {"source": "https://doi.org/10.1021/acs.jcim.9b00249", "target": "https://doi.org/10.1021/acs.jcim.9b00250"}]} \ No newline at end of file +{"nodes": [{"doi": "doi_lg_1_i", "name": "title_lg_1_i", "author": ["contributor_lg_1_i"], "year": "date_lg_1_i", "journal": "journal_lg_1_i", "abstract": null, "group": "Input", "depth": 0, "citations": 2}, {"doi": "doi_lg_1_d11", "name": "title_lg_1_d11", "author": ["contributor_lg_1_d11"], "year": "date_lg_1_d11", "journal": "journal_lg_1_d11", "abstract": null, "group": "Reference", "depth": -1, "citations": 1}, {"doi": "doi_lg_1_d12", "name": "title_lg_1_d12", "author": ["contributor_lg_1_d12"], "year": "date_lg_1_d12", "journal": "journal_lg_1_d12", "abstract": null, "group": "Reference", "depth": -1, "citations": 2}, {"doi": "doi_lg_1_h11", "name": "title_lg_1_h11", "author": ["contributor_lg_1_h11"], "year": "date_lg_1_h11", "journal": "journal_lg_1_h11", "abstract": null, "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h12", "name": "title_lg_1_h12", "author": ["contributor_lg_1_h12"], "year": "date_lg_1_h12", "journal": "journal_lg_1_h12", "abstract": null, "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h21", "name": "title_lg_1_h21", "author": ["contributor_lg_1_h21"], "year": "date_lg_1_h21", "journal": "journal_lg_1_h21", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h22", "name": "title_lg_1_h22", "author": ["contributor_lg_1_h22"], "year": "date_lg_1_h22", "journal": "journal_lg_1_h22", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h23", "name": "title_lg_1_h23", "author": ["contributor_lg_1_h23"], "year": "date_lg_1_h23", "journal": "journal_lg_1_h23", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_d21", "name": "title_lg_1_d21", "author": ["contributor_lg_1_d21"], "year": "date_lg_1_d21", "journal": "journal_lg_1_d21", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d22", "name": "title_lg_1_d22", "author": ["contributor_lg_1_d22"], "year": "date_lg_1_d22", "journal": "journal_lg_1_d22", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d23", "name": "title_lg_1_d23", "author": ["contributor_lg_1_d23"], "year": "date_lg_1_d23", "journal": "journal_lg_1_d23", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}], "links": [{"source": "doi_lg_1_i", "target": "doi_lg_1_d11"}, {"source": "doi_lg_1_i", "target": "doi_lg_1_d12"}, {"source": "doi_lg_1_h11", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h21", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_h23", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d12", "target": "doi_lg_1_d23"}, {"source": "doi_lg_1_d21", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d22", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_d12"}], "depth_height": ["new_height.json", true]} \ No newline at end of file diff --git a/verarbeitung/new_height.json b/verarbeitung/new_height.json index f96362a05cea7ad954fa28bfc22074e15e9fa1cd..0cc59401969ce8a984fee556a67099167f2144a6 100644 --- a/verarbeitung/new_height.json +++ b/verarbeitung/new_height.json @@ -1 +1 @@ -{"nodes": [{"doi": "doi_lg_1_i", "name": "title_lg_1_i", "author": ["contributor_lg_1_i"], "year": "date_lg_1_i", "journal": "journal_lg_1_i", "group": "Input", "depth": 0, "citations": 2}, {"doi": "doi_lg_1_d11", "name": "title_lg_1_d11", "author": ["contributor_lg_1_d11"], "year": "date_lg_1_d11", "journal": "journal_lg_1_d11", "group": "Reference", "depth": -1, "citations": 1}, {"doi": "doi_lg_1_d12", "name": "title_lg_1_d12", "author": ["contributor_lg_1_d12"], "year": "date_lg_1_d12", "journal": "journal_lg_1_d12", "group": "Reference", "depth": -1, "citations": 2}, {"doi": "doi_lg_1_h11", "name": "title_lg_1_h11", "author": ["contributor_lg_1_h11"], "year": "date_lg_1_h11", "journal": "journal_lg_1_h11", "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h12", "name": "title_lg_1_h12", "author": ["contributor_lg_1_h12"], "year": "date_lg_1_h12", "journal": "journal_lg_1_h12", "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h21", "name": "title_lg_1_h21", "author": ["contributor_lg_1_h21"], "year": "date_lg_1_h21", "journal": "journal_lg_1_h21", "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h22", "name": "title_lg_1_h22", "author": ["contributor_lg_1_h22"], "year": "date_lg_1_h22", "journal": "journal_lg_1_h22", "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h23", "name": "title_lg_1_h23", "author": ["contributor_lg_1_h23"], "year": "date_lg_1_h23", "journal": "journal_lg_1_h23", "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_d21", "name": "title_lg_1_d21", "author": ["contributor_lg_1_d21"], "year": "date_lg_1_d21", "journal": "journal_lg_1_d21", "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d22", "name": "title_lg_1_d22", "author": ["contributor_lg_1_d22"], "year": "date_lg_1_d22", "journal": "journal_lg_1_d22", "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d23", "name": "title_lg_1_d23", "author": ["contributor_lg_1_d23"], "year": "date_lg_1_d23", "journal": "journal_lg_1_d23", "group": "Reference", "depth": -2, "citations": 2}], "links": [{"source": "doi_lg_1_i", "target": "doi_lg_1_d11"}, {"source": "doi_lg_1_i", "target": "doi_lg_1_d12"}, {"source": "doi_lg_1_h11", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h21", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_h23", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d21", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d22", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_d12", "target": "doi_lg_1_d23"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_d12"}]} \ No newline at end of file +{"nodes": [{"doi": "doi_lg_1_i", "name": "title_lg_1_i", "author": ["contributor_lg_1_i"], "year": "date_lg_1_i", "journal": "journal_lg_1_i", "abstract": null, "group": "Input", "depth": 0, "citations": 2}, {"doi": "doi_lg_1_d11", "name": "title_lg_1_d11", "author": ["contributor_lg_1_d11"], "year": "date_lg_1_d11", "journal": "journal_lg_1_d11", "abstract": null, "group": "Reference", "depth": -1, "citations": 1}, {"doi": "doi_lg_1_d12", "name": "title_lg_1_d12", "author": ["contributor_lg_1_d12"], "year": "date_lg_1_d12", "journal": "journal_lg_1_d12", "abstract": null, "group": "Reference", "depth": -1, "citations": 2}, {"doi": "doi_lg_1_h11", "name": "title_lg_1_h11", "author": ["contributor_lg_1_h11"], "year": "date_lg_1_h11", "journal": "journal_lg_1_h11", "abstract": null, "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h12", "name": "title_lg_1_h12", "author": ["contributor_lg_1_h12"], "year": "date_lg_1_h12", "journal": "journal_lg_1_h12", "abstract": null, "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h21", "name": "title_lg_1_h21", "author": ["contributor_lg_1_h21"], "year": "date_lg_1_h21", "journal": "journal_lg_1_h21", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h22", "name": "title_lg_1_h22", "author": ["contributor_lg_1_h22"], "year": "date_lg_1_h22", "journal": "journal_lg_1_h22", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h23", "name": "title_lg_1_h23", "author": ["contributor_lg_1_h23"], "year": "date_lg_1_h23", "journal": "journal_lg_1_h23", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_d21", "name": "title_lg_1_d21", "author": ["contributor_lg_1_d21"], "year": "date_lg_1_d21", "journal": "journal_lg_1_d21", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d22", "name": "title_lg_1_d22", "author": ["contributor_lg_1_d22"], "year": "date_lg_1_d22", "journal": "journal_lg_1_d22", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d23", "name": "title_lg_1_d23", "author": ["contributor_lg_1_d23"], "year": "date_lg_1_d23", "journal": "journal_lg_1_d23", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}], "links": [{"source": "doi_lg_1_i", "target": "doi_lg_1_d11"}, {"source": "doi_lg_1_i", "target": "doi_lg_1_d12"}, {"source": "doi_lg_1_h11", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h21", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_h23", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d12", "target": "doi_lg_1_d23"}, {"source": "doi_lg_1_d21", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d22", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_d12"}], "depth_height": [2, 2]} \ No newline at end of file diff --git a/verarbeitung/process_main.py b/verarbeitung/process_main.py index 78df2dbf3f0a3c4f84a27620a523048d9e57de27..581c4260c6603efdb4fa6d800b086872f90a09f5 100644 --- a/verarbeitung/process_main.py +++ b/verarbeitung/process_main.py @@ -50,7 +50,7 @@ def Processing(url_list, search_depth, search_height, json_file = 'json_text.jso nodes, edges, error_doi_list = init_graph_construction(url_list, search_depth, search_height) # exports graph to given json file name - output_to_json(nodes, edges, json_file) + output_to_json(nodes, edges, search_depth, search_height, json_file) return error_doi_list \ No newline at end of file diff --git a/verarbeitung/start_script.py b/verarbeitung/start_script.py new file mode 100644 index 0000000000000000000000000000000000000000..92295eefbd363053762a3d6df99d028af44151b1 --- /dev/null +++ b/verarbeitung/start_script.py @@ -0,0 +1,24 @@ +import sys +import gc +from pathlib import Path +from verarbeitung.process_main import Processing +#from verarbeitung.dev_files.print_graph_test import try_known_publications, try_delete_nodes + + +doi_list = [] +doi_list.append('https://pubs.acs.org/doi/10.1021/acs.jcim.9b00249') +#doi_list.append('https://doi.org/10.1021/acs.jcim.9b00249') +#doi_list.append('https://pubs.acs.org/doi/10.1021/acs.jcim.1c00203') +#doi_list.append('https://doi.org/10.1021/acs.jmedchem.0c01332') +#doi_list.append('https://pubs.acs.org/doi/10.1021/acs.jcim.6b00709') +#doi_list.append('https://doi.org/10.1021/acs.chemrev.8b00728') +#doi_list.append('https://pubs.acs.org/doi/10.1021/acs.chemrestox.0c00006')# +#doi_list.append('https://doi.org/10.1021/acs.chemrev.8b00728') +#doi_list.append('https://doi.org/10.1021/acs.jpclett.1c03335 ') +doi_list.append('https://doi.org/10.1021/acs.chemrestox.5b00481') +error_list = Processing(doi_list, 2, 2, 'test481.json') +print(error_list) + +del doi_list +del error_list +gc.collect() diff --git a/verarbeitung/test/construct_graph_unittest.py b/verarbeitung/test/construct_graph_unittest.py index b73dc4cabf196068ed2f35a69ecb437512e97da7..d1887277748aa93de0ce878c6d512ea9ce5f4cd4 100644 --- a/verarbeitung/test/construct_graph_unittest.py +++ b/verarbeitung/test/construct_graph_unittest.py @@ -24,11 +24,6 @@ class ConstructionTest(unittest.TestCase): self.assertCountEqual(doi_nodes, ['doiz1', 'doiz2']) self.assertCountEqual(edges, [['doiz2', 'doiz1'], ['doiz1', 'doiz2']]) - #def testBigCycle(self): - - #def testEmptyHeight(self): - - #def testEmptyDepth(self): def testEmptyDepthHeight(self): nodes, edges, err_list = init_graph_construction(['doi1'],0,0,True,False) @@ -85,6 +80,25 @@ class ConstructionTest(unittest.TestCase): self.assertCountEqual(doi_nodes,['doi_d02','doi_d1','doi_d2']) self.assertCountEqual(edges, [['doi_d02','doi_d1'], ['doi_d1','doi_d2']]) + def test_incorrect_input_dois(self): + nodes, edges, err_list = init_graph_construction(['doi1ic', 'doi2ic'],1,1, True, False) + doi_nodes = keep_only_dois(nodes) + self.assertCountEqual(doi_nodes, []) + self.assertCountEqual(edges, []) + self.assertCountEqual(err_list, ['doi1ic', 'doi2ic']) + + nodes, edges, err_list = init_graph_construction(['doi1ic', 'doi2ic'],2,2, True, False) + doi_nodes = keep_only_dois(nodes) + self.assertCountEqual(doi_nodes, []) + self.assertCountEqual(edges, []) + self.assertCountEqual(err_list, ['doi1ic', 'doi2ic']) + + nodes, edges, err_list = init_graph_construction(['doi1', 'doi2ic'],1,1, True, False) + doi_nodes = keep_only_dois(nodes) + self.assertCountEqual(doi_nodes, ['doi1', 'doi2', 'doi3']) + self.assertCountEqual(edges, [['doi1', 'doi2'], ['doi3', 'doi1']]) + self.assertCountEqual(err_list, ['doi2ic']) + ## Ab hier die Tests für die einzelnen Funktionen ## @@ -195,9 +209,9 @@ class ConstructionTest(unittest.TestCase): pub_lg_1_d_11.group = -1 return_list_of_node_dicts = format_nodes([pub_lg_1_i, pub_lg_1_h_11, pub_lg_1_d_11]) - check_list_of_node_dicts = [ {"doi": 'doi_lg_1_i', "name": 'title_lg_1_i', "author": ['contributor_lg_1_i'], "year": 'date_lg_1_i', "journal": 'journal_lg_1_i', "group": 'Input', "depth": 0, "citations": 2}, - {"doi": 'doi_lg_1_h11', "name": 'title_lg_1_h11', "author": ['contributor_lg_1_h11'], "year": 'date_lg_1_h11', "journal": 'journal_lg_1_h11', "group": 'Citedby', "depth": 1, "citations": 2}, - {"doi": 'doi_lg_1_d11', "name": 'title_lg_1_d11', "author": ['contributor_lg_1_d11'], "year": 'date_lg_1_d11', "journal": 'journal_lg_1_d11', "group": 'Reference', "depth": -1, "citations": 1}] + check_list_of_node_dicts = [ {"doi": 'doi_lg_1_i', "name": 'title_lg_1_i', "author": ['contributor_lg_1_i'], "year": 'date_lg_1_i', "journal": 'journal_lg_1_i', "abstract": None, "group": 'Input', "depth": 0, "citations": 2}, + {"doi": 'doi_lg_1_h11', "name": 'title_lg_1_h11', "author": ['contributor_lg_1_h11'], "year": 'date_lg_1_h11', "journal": 'journal_lg_1_h11', "abstract": None, "group": 'Citedby', "depth": 1, "citations": 2}, + {"doi": 'doi_lg_1_d11', "name": 'title_lg_1_d11', "author": ['contributor_lg_1_d11'], "year": 'date_lg_1_d11', "journal": 'journal_lg_1_d11', "abstract": None, "group": 'Reference', "depth": -1, "citations": 1}] self.assertCountEqual(return_list_of_node_dicts, check_list_of_node_dicts) diff --git a/verarbeitung/test/update_graph_unittest.py b/verarbeitung/test/update_graph_unittest.py index 77746ffeb0ee3aa5375020a4cf8d5aa218520821..62504e513e70b23abffd487cfa6f48f22452e2fb 100644 --- a/verarbeitung/test/update_graph_unittest.py +++ b/verarbeitung/test/update_graph_unittest.py @@ -23,7 +23,7 @@ class UpdatingTest(unittest.TestCase): def test_deleted_input_dois(self): nodes_old_single, edges_old_single, err_list = init_graph_construction(['doi_lg_1_i'],2,2,True) nodes_old_both, edges_old_both, err_list = init_graph_construction(['doi_lg_1_i','doi_lg_2_i'],2,2,True) - output_to_json(nodes_old_both, edges_old_both, test_var=True) + output_to_json(nodes_old_both, edges_old_both, 2, 2, test_var=True) nodes_new_single, edges_new_single, err_list = update_graph(['doi_lg_1_i'], 'test_output.json', 2, 2, True) self.assertCountEqual(nodes_old_single,nodes_new_single) self.assertCountEqual(edges_old_single, edges_new_single) @@ -37,13 +37,13 @@ class UpdatingTest(unittest.TestCase): nodes_height_1, edges_height_1, err_list = init_graph_construction(['doi_lg_1_i'],2,1,True) nodes_height_2, edges_height_2, err_list = init_graph_construction(['doi_lg_1_i'],2,2,True) - output_to_json(nodes_height_2, edges_height_2, 'new_height.json', True) + output_to_json(nodes_height_2, edges_height_2, 2, 2, 'new_height.json', True) nodes_new_height_1, edges_new_height_1, err_list = update_graph(['doi_lg_1_i'], 'new_height.json', 2, 1, True) self.assertCountEqual(nodes_height_1, nodes_new_height_1) self.assertCountEqual(edges_height_1, edges_new_height_1) nodes_height_2, edges_height_2, err_list = init_graph_construction(['doi_lg_1_i'],2,2,True) - output_to_json(nodes_height_2, edges_height_2, 'new_height.json', True) + output_to_json(nodes_height_2, edges_height_2, 2, 2, 'new_height.json', True) nodes_new_height_0, edges_new_height_0, err_list = update_graph(['doi_lg_1_i'], 'new_height.json', 2, 0, True) self.assertCountEqual(nodes_height_0, nodes_new_height_0) self.assertCountEqual(edges_height_0, edges_new_height_0) @@ -51,7 +51,7 @@ class UpdatingTest(unittest.TestCase): def test_ref_to_input(self): nodes, edges, err_list = init_graph_construction(['doi_cg_i'], 2, 2, True) nodes_2, edges_2, err_list_2 = init_graph_construction(['doi_cg_d11'], 2, 2, True) - output_to_json(nodes, edges, 'ref_to_input.json') + output_to_json(nodes, edges, 2, 2, 'ref_to_input.json') new_nodes, new_edges, new_err_list = update_graph(['doi_cg_d11'], 'ref_to_input.json', 2, 2, True) self.assertCountEqual(new_nodes, nodes_2) self.assertCountEqual(new_edges, edges_2) @@ -59,12 +59,12 @@ class UpdatingTest(unittest.TestCase): nodes, edges, err_list = init_graph_construction(['doi_cg_i','doi_lg_2_i'], 2, 2, True) nodes_2, edges_2, err_list_2 = init_graph_construction(['doi_cg_d11','doi_lg_2_i'], 2, 2, True) - output_to_json(nodes, edges, 'ref_to_input.json') + output_to_json(nodes, edges, 2, 2, 'ref_to_input.json') new_nodes, new_edges, new_err_list = update_graph(['doi_cg_d11','doi_lg_2_i'], 'ref_to_input.json', 2, 2, True) self.assertCountEqual(new_nodes, nodes_2) self.assertCountEqual(new_edges, edges_2) - output_to_json(nodes_2, edges_2, 'ref_to_input.json') + output_to_json(nodes_2, edges_2, 2, 2, 'ref_to_input.json') new_nodes, new_edges, new_err_list = update_graph(['doi_cg_d11','doi_lg_2_i'], 'ref_to_input.json', 2, 2, True) self.assertCountEqual(new_nodes, nodes_2) self.assertCountEqual(new_edges, edges_2) @@ -72,7 +72,7 @@ class UpdatingTest(unittest.TestCase): nodes, edges, err_list = init_graph_construction(['doi_cg_i','doi_lg_2_i'], 2, 2, True) nodes_2, edges_2, err_list_2 = init_graph_construction(['doi_cg_i','doi_lg_2_h11','doi_lg_1_i'], 3, 3, True) - output_to_json(nodes_2, edges_2, 'ref_to_input.json') + output_to_json(nodes_2, edges_2, 2, 2, 'ref_to_input.json') new_nodes, new_edges, new_err_list = update_graph(['doi_cg_i','doi_lg_2_i'], 'ref_to_input.json', 2, 2, True) self.assertCountEqual(new_nodes, nodes) self.assertCountEqual(new_edges, edges) @@ -172,8 +172,8 @@ class UpdatingTest(unittest.TestCase): def test_input_from_json(self): nodes_old, edges_old, err_list = init_graph_construction(['doi_lg_1_i'],2,2,True) - output_to_json(nodes_old, edges_old, test_var = True) - nodes_new, edges_new = input_from_json('test_output.json') + output_to_json(nodes_old, edges_old, 2, 2, test_var = True) + nodes_new, edges_new, old_depth, old_height = input_from_json('test_output.json') self.assertCountEqual(nodes_old,nodes_new) self.assertCountEqual(edges_old, edges_new) @@ -220,7 +220,7 @@ class UpdatingTest(unittest.TestCase): pub_cg_d11 = input_test_func('doi_cg_d12') pub_cg_d11.group = -1 pubs = [pub_lg_2_i, pub_lg_2_h11, pub_lg_2_h12, pub_lg_2_d11, pub_lg_2_d12, pub_lg_2_h21, pub_lg_2_h22, pub_lg_2_d21, pub_cg_i, pub_cg_d11, pub_cg_d12, pub_cg_h11] - usable_nodes = search_ref_cit_graph_rec_test(pubs, [pub_cg_i], "Citation") + usable_nodes = search_ref_cit_graph_rec_test(pubs, [pub_cg_i], 2, "Citation") self.assertCountEqual(usable_nodes, [pub_cg_h11, pub_lg_2_h11, pub_lg_2_h21, pub_lg_2_h22]) # compare_old_and_new_node_lists.py: @@ -257,11 +257,11 @@ class UpdatingTest(unittest.TestCase): pub_lg_2_d22.group = -2 pubs = [pub_lg_2_i, pub_lg_2_h11, pub_lg_2_h12, pub_lg_2_d11, pub_lg_2_d12, pub_lg_2_h21, pub_lg_2_h22, pub_lg_2_d21, pub_lg_2_d22] - self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_h11, 2, "Citation"),[pub_lg_2_h21, pub_lg_2_h22]) - self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_h11, 1, "Citation"),[pub_lg_2_h11]) + self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_h11, 2, 2, "Citation"),[pub_lg_2_h21, pub_lg_2_h22]) + self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_h11, 2, 1, "Citation"),[pub_lg_2_h21, pub_lg_2_h22]) - self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_d11, 2, "Reference"),[pub_lg_2_d21, pub_lg_2_i]) - self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_d11, 1, "Reference"),[pub_lg_2_d11]) + self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_d11, 2, 2, "Reference"),[pub_lg_2_d21, pub_lg_2_i]) + self.assertCountEqual(find_furthermost_citations_test(pubs, [], pub_lg_2_d11, 2, 1, "Reference"),[pub_lg_2_d21, pub_lg_2_i]) def test_complete_changed_group_nodes(self): diff --git a/verarbeitung/test_output.json b/verarbeitung/test_output.json index f96362a05cea7ad954fa28bfc22074e15e9fa1cd..0cc59401969ce8a984fee556a67099167f2144a6 100644 --- a/verarbeitung/test_output.json +++ b/verarbeitung/test_output.json @@ -1 +1 @@ -{"nodes": [{"doi": "doi_lg_1_i", "name": "title_lg_1_i", "author": ["contributor_lg_1_i"], "year": "date_lg_1_i", "journal": "journal_lg_1_i", "group": "Input", "depth": 0, "citations": 2}, {"doi": "doi_lg_1_d11", "name": "title_lg_1_d11", "author": ["contributor_lg_1_d11"], "year": "date_lg_1_d11", "journal": "journal_lg_1_d11", "group": "Reference", "depth": -1, "citations": 1}, {"doi": "doi_lg_1_d12", "name": "title_lg_1_d12", "author": ["contributor_lg_1_d12"], "year": "date_lg_1_d12", "journal": "journal_lg_1_d12", "group": "Reference", "depth": -1, "citations": 2}, {"doi": "doi_lg_1_h11", "name": "title_lg_1_h11", "author": ["contributor_lg_1_h11"], "year": "date_lg_1_h11", "journal": "journal_lg_1_h11", "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h12", "name": "title_lg_1_h12", "author": ["contributor_lg_1_h12"], "year": "date_lg_1_h12", "journal": "journal_lg_1_h12", "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h21", "name": "title_lg_1_h21", "author": ["contributor_lg_1_h21"], "year": "date_lg_1_h21", "journal": "journal_lg_1_h21", "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h22", "name": "title_lg_1_h22", "author": ["contributor_lg_1_h22"], "year": "date_lg_1_h22", "journal": "journal_lg_1_h22", "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h23", "name": "title_lg_1_h23", "author": ["contributor_lg_1_h23"], "year": "date_lg_1_h23", "journal": "journal_lg_1_h23", "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_d21", "name": "title_lg_1_d21", "author": ["contributor_lg_1_d21"], "year": "date_lg_1_d21", "journal": "journal_lg_1_d21", "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d22", "name": "title_lg_1_d22", "author": ["contributor_lg_1_d22"], "year": "date_lg_1_d22", "journal": "journal_lg_1_d22", "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d23", "name": "title_lg_1_d23", "author": ["contributor_lg_1_d23"], "year": "date_lg_1_d23", "journal": "journal_lg_1_d23", "group": "Reference", "depth": -2, "citations": 2}], "links": [{"source": "doi_lg_1_i", "target": "doi_lg_1_d11"}, {"source": "doi_lg_1_i", "target": "doi_lg_1_d12"}, {"source": "doi_lg_1_h11", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h21", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_h23", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d21", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d22", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_d12", "target": "doi_lg_1_d23"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_d12"}]} \ No newline at end of file +{"nodes": [{"doi": "doi_lg_1_i", "name": "title_lg_1_i", "author": ["contributor_lg_1_i"], "year": "date_lg_1_i", "journal": "journal_lg_1_i", "abstract": null, "group": "Input", "depth": 0, "citations": 2}, {"doi": "doi_lg_1_d11", "name": "title_lg_1_d11", "author": ["contributor_lg_1_d11"], "year": "date_lg_1_d11", "journal": "journal_lg_1_d11", "abstract": null, "group": "Reference", "depth": -1, "citations": 1}, {"doi": "doi_lg_1_d12", "name": "title_lg_1_d12", "author": ["contributor_lg_1_d12"], "year": "date_lg_1_d12", "journal": "journal_lg_1_d12", "abstract": null, "group": "Reference", "depth": -1, "citations": 2}, {"doi": "doi_lg_1_h11", "name": "title_lg_1_h11", "author": ["contributor_lg_1_h11"], "year": "date_lg_1_h11", "journal": "journal_lg_1_h11", "abstract": null, "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h12", "name": "title_lg_1_h12", "author": ["contributor_lg_1_h12"], "year": "date_lg_1_h12", "journal": "journal_lg_1_h12", "abstract": null, "group": "Citedby", "depth": 1, "citations": 2}, {"doi": "doi_lg_1_h21", "name": "title_lg_1_h21", "author": ["contributor_lg_1_h21"], "year": "date_lg_1_h21", "journal": "journal_lg_1_h21", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h22", "name": "title_lg_1_h22", "author": ["contributor_lg_1_h22"], "year": "date_lg_1_h22", "journal": "journal_lg_1_h22", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_h23", "name": "title_lg_1_h23", "author": ["contributor_lg_1_h23"], "year": "date_lg_1_h23", "journal": "journal_lg_1_h23", "abstract": null, "group": "Citedby", "depth": 2, "citations": 0}, {"doi": "doi_lg_1_d21", "name": "title_lg_1_d21", "author": ["contributor_lg_1_d21"], "year": "date_lg_1_d21", "journal": "journal_lg_1_d21", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d22", "name": "title_lg_1_d22", "author": ["contributor_lg_1_d22"], "year": "date_lg_1_d22", "journal": "journal_lg_1_d22", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}, {"doi": "doi_lg_1_d23", "name": "title_lg_1_d23", "author": ["contributor_lg_1_d23"], "year": "date_lg_1_d23", "journal": "journal_lg_1_d23", "abstract": null, "group": "Reference", "depth": -2, "citations": 2}], "links": [{"source": "doi_lg_1_i", "target": "doi_lg_1_d11"}, {"source": "doi_lg_1_i", "target": "doi_lg_1_d12"}, {"source": "doi_lg_1_h11", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_i"}, {"source": "doi_lg_1_h21", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h11"}, {"source": "doi_lg_1_h22", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_h23", "target": "doi_lg_1_h12"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_d11", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d12", "target": "doi_lg_1_d23"}, {"source": "doi_lg_1_d21", "target": "doi_lg_1_d22"}, {"source": "doi_lg_1_d22", "target": "doi_lg_1_d21"}, {"source": "doi_lg_1_h12", "target": "doi_lg_1_d12"}], "depth_height": [2, 2]} \ No newline at end of file diff --git a/verarbeitung/update_graph/connect_new_input.py b/verarbeitung/update_graph/connect_new_input.py index af7363a29fa1bac6bf2fba3dbf3de0d50e64196d..7dcad9b979fa36a221ee48c5ca4ac4e8da243161 100644 --- a/verarbeitung/update_graph/connect_new_input.py +++ b/verarbeitung/update_graph/connect_new_input.py @@ -19,16 +19,19 @@ from os import error sys.path.append("../") +from input.publication import Publication +from verarbeitung.get_pub_from_input import get_pub from verarbeitung.construct_new_graph.initialize_graph import init_graph_construction from verarbeitung.construct_new_graph.add_citations_rec import add_citations, get_cit_type_list, create_global_lists_cit -def find_furthermost_citations_test(test_nodes, test_edges, changed_node, old_search_depth, cit_type): + +def find_furthermost_citations_test(test_nodes, test_edges, changed_node, old_search_depth, new_search_depth, cit_type): global nodes, edges nodes = test_nodes edges = test_edges - return(find_furthermost_citations(nodes, edges, changed_node, old_search_depth, cit_type)) + return(find_furthermost_citations(nodes, edges, changed_node, old_search_depth, new_search_depth, cit_type)) def complete_changed_group_nodes_test(test_nodes, test_edges, inserted_test_nodes, old_search_depth, old_search_height, new_search_depth, new_search_height): global nodes, edges @@ -40,7 +43,7 @@ def complete_changed_group_nodes_test(test_nodes, test_edges, inserted_test_node -def find_furthermost_citations(new_nodes, new_edges, node, old_search_depth, cit_type): +def find_furthermost_citations(new_nodes, new_edges, node, old_search_depth, new_search_depth, cit_type): ''' :param new_nodes: list of nodes which are generated seperately from main node list to avoid recursive problems :type new_nodes List[Publication] @@ -64,7 +67,7 @@ def find_furthermost_citations(new_nodes, new_edges, node, old_search_depth, cit citations_saved = [node] # group of node and old search depth/height determines how often the loop needs to be repeated - for depth in range(old_search_depth - abs(node.group)): + for depth in range(min(old_search_depth - abs(node.group), new_search_depth)): new_citations = [] for citation in citations_saved: for cit_node in nodes: @@ -85,7 +88,7 @@ def find_furthermost_citations(new_nodes, new_edges, node, old_search_depth, cit new_citations.append(new_cit_node) # change height accordingly and add link to edge - new_cit_node.group = node.group + depth + 1 + new_cit_node.group = node.group + depth if [cit_node.doi_url,cit_node.doi_url] not in new_edges: new_edges.append([new_cit_node.doi_url,cit_node.doi_url]) @@ -101,7 +104,7 @@ def find_furthermost_citations(new_nodes, new_edges, node, old_search_depth, cit new_citations.append(new_cit_node) # change height accordingly and add link to edge - new_cit_node.group = node.group - depth - 1 + new_cit_node.group = node.group + depth if [cit_node.doi_url, new_cit_node.doi_url] not in new_edges: new_edges.append([cit_node.doi_url, new_cit_node.doi_url]) @@ -147,38 +150,49 @@ def complete_changed_group_nodes(inserted_nodes, old_search_depth, old_search_he # moves known reference node to input and completes citations and references for this node if (node.group < 0) and (node.doi_url in inserted_nodes): - node.group = 0 - new_max_citations = find_furthermost_citations(new_nodes, new_edges, node, old_search_height + abs(node.group), "Citation") - add_citations(new_nodes, new_edges, new_max_citations, old_search_height, new_search_height, "Citation", test_var) - - new_nodes, new_edges, error_doi_list_ref = init_graph_construction([node.doi_url], new_search_height, 0, test_var, True, new_nodes, new_edges) - - for err_node in error_doi_list_ref: - if err_node not in error_doi_list: - error_doi_list.append(err_node) + # get pub from input + pub = get_pub(node.doi_url, test_var) + if (type(pub) != Publication): + + error_doi_list.append(node.doi_url) + continue + + # find old maximum publications and complete tree to new max depth + pub.group = node.group + old_max_references = find_furthermost_citations(new_nodes, new_edges, pub, old_search_depth, new_search_depth, "Reference") + add_citations(new_nodes, new_edges, old_max_references, min(old_search_depth - abs(node.group), new_search_depth), new_search_depth, "Reference", test_var) + + # add tree for citations + add_citations(new_nodes, new_edges, [pub], 0, new_search_height, "Citation", test_var) - old_max_references = find_furthermost_citations(new_nodes, new_edges, node, old_search_depth, "Reference") - add_citations(new_nodes, new_edges, old_max_references, old_search_depth, new_search_depth, "Reference", test_var) + pub.group = 0 + new_nodes.append(pub) handled_inserted_nodes.append(node) # moves known citation node to input and completes citations and references for this node elif (node.group > 0) and (node.doi_url in inserted_nodes): - node.group = 0 - new_max_references = find_furthermost_citations(new_nodes, new_edges, node, old_search_depth + abs(node.group), "Reference") - add_citations(new_nodes, new_edges, new_max_references, old_search_depth, new_search_depth, "Reference", test_var) - #new_nodes.append(new_max_references) - - new_nodes, new_edges, error_doi_list_ref = init_graph_construction([node.doi_url], new_search_depth, 0, test_var, True, new_nodes, new_edges) - for err_node in error_doi_list_ref: - if err_node not in error_doi_list: - error_doi_list.append(err_node) + # get pub from input + pub = get_pub(node.doi_url, test_var) + if (type(pub) != Publication): + + error_doi_list.append(node.doi_url) + continue + + # find old maximum publications and complete tree to new max depth + pub.group = node.group + old_max_citations = find_furthermost_citations(new_nodes, new_edges, pub, old_search_height, new_search_height, "Citation") + add_citations(new_nodes, new_edges, old_max_citations, min(old_search_height - abs(node.group), new_search_height), new_search_height, "Citation", test_var) + + # add tree for citations + add_citations(new_nodes, new_edges, [pub], 0, new_search_depth, "Reference", test_var) - old_max_citations = find_furthermost_citations(new_nodes, new_edges, node, old_search_height, "Citation") - add_citations(new_nodes, new_edges, old_max_citations, old_search_height, new_search_height, "Citation", test_var) + pub.group = 0 + new_nodes.append(pub) handled_inserted_nodes.append(node) + # ensure, input pubs are declared as group 0 for new_node in new_nodes: for inserted_node in inserted_nodes: if new_node.doi_url == inserted_node: @@ -227,9 +241,10 @@ def connect_old_and_new_input(input_nodes_list, input_edges_list, inserted_nodes # function call to begin recursive processing up to max depth/height for unhandled nodes - nodes, edges, error_doi_list_new = init_graph_construction(not_handled_inserted_nodes, new_search_depth, new_search_height, test_var = test_var, update_var = True, input_nodes = new_nodes, input_edges = new_edges) - for err_node in error_doi_list_new: - if err_node not in error_doi_list: - error_doi_list.append(err_node) + if len(not_handled_inserted_nodes) > 0: + new_nodes, new_edges, error_doi_list_new = init_graph_construction(not_handled_inserted_nodes, new_search_depth, new_search_height, test_var = test_var, update_var = True, input_nodes = new_nodes, input_edges = new_edges) + for err_node in error_doi_list_new: + if err_node not in error_doi_list: + error_doi_list.append(err_node) - return(nodes, edges, error_doi_list) \ No newline at end of file + return(new_nodes, new_edges, error_doi_list) \ No newline at end of file diff --git a/verarbeitung/update_graph/delete_nodes_edges.py b/verarbeitung/update_graph/delete_nodes_edges.py index 205c82e0c814a0901a47011f3ee9e826ae31a8ab..08d0dbb81434cfa2e3aa292283bde4fdbc216564 100644 --- a/verarbeitung/update_graph/delete_nodes_edges.py +++ b/verarbeitung/update_graph/delete_nodes_edges.py @@ -20,76 +20,100 @@ sys.path.append("../../") from .update_edges import back_to_valid_edges -def search_ref_cit_graph_rec_test(pubs, new_test_input, cit_var): +def search_ref_cit_graph_rec_test(pubs, new_test_input, old_max_depth, cit_var): global usable_nodes, input_obj_list usable_nodes = [] input_obj_list = pubs if cit_var == "Reference": for pub in new_test_input: - search_ref_graph_rec(pub) + search_ref_graph_rec(pub, 1, old_max_depth) elif cit_var == "Citation": for pub in new_test_input: - search_cit_graph_rec(pub) + search_cit_graph_rec(pub, 1, old_max_depth) return usable_nodes -def search_ref_graph_rec(pub): +def search_ref_graph_rec(pub, curr_depth, old_max_depth): ''' :param pub: pub go get appended to usable_nodes :type pub: Publication + + :param curr_depth: current recursion depth + :type curr_depth: int + + :param old_max_depth: old max search depth + :type old_max_depth: int function that appends nodes of group "reference" to list usable_nodes, if they are reachable from input nodes ''' + usable_doi_nodes = [] for reference in pub.references: for ref_pub in input_obj_list: if ((reference.doi_url == ref_pub.doi_url) and (ref_pub not in usable_nodes)): usable_nodes.append(ref_pub) + usable_doi_nodes.append(ref_pub.doi_url) # to find a cyclus and avoid recursion error not_in_citations = True for citation in pub.citations: - if (reference.doi_url == citation.doi_url): + if (reference.doi_url == citation.doi_url and citation.doi_url not in usable_doi_nodes): not_in_citations = False break - if (not_in_citations): - search_ref_graph_rec(ref_pub) + if not_in_citations and curr_depth < old_max_depth: + search_ref_graph_rec(ref_pub, curr_depth + 1, old_max_depth) -def search_cit_graph_rec(pub): +def search_cit_graph_rec(pub, curr_height, old_max_height): ''' - :param pub: pub go get appended to usable_nodes - :type pub: Publication + :param pub: pub go get appended to usable_nodes + :type pub: Publication + + :param curr_height: current recursion height + :type curr_height: int + + :param old_max_height: old max search height + :type old_max_height: int function that appends nodes of group "citation" to list usable_nodes, if they are reachable from input nodes ''' + + usable_doi_nodes = [] for citation in pub.citations: for cit_pub in input_obj_list: - if ((citation.doi_url == cit_pub.doi_url) and (cit_pub not in usable_nodes)): - usable_nodes.append(cit_pub) + if ((citation.doi_url == cit_pub.doi_url)): + if cit_pub not in usable_nodes: + usable_nodes.append(cit_pub) + usable_doi_nodes.append(cit_pub.doi_url) # to find a cyclus and avoid recursion error not_in_references = True for reference in pub.references: - if (citation.doi_url == reference.doi_url): + if (citation.doi_url == reference.doi_url and reference.doi_url not in usable_doi_nodes): not_in_references = False break - if (not_in_references): - search_cit_graph_rec(cit_pub) + if not_in_references and curr_height < old_max_height: + search_cit_graph_rec(cit_pub,curr_height + 1, old_max_height) -def delete_nodes_and_edges(input_list, common_nodes, old_edges_list): +def delete_nodes_and_edges(input_list, common_nodes, old_edges_list, old_depth, old_height): ''' :param input_list: list of publications to get reduced :type input_list: List[Publication] - :param common_nodes: list of input dois which are in old and new input call - :type common_nodes: List[String] + :param common_nodes: list of input dois which are in old and new input call + :type common_nodes: List[String] + + :param old_edges_list: list of links between publications from old call + :type old_edges_list: List[List[String,String]] + + :param old_depth: old max search depth + :type old_depth: int - :param old_edges_list: list of links between publications from old call - :type old_edges_list: List[List[String,String]] + :param old_height: old max search height + :type old_height: int function to start recursive node removal for references and citations and to change edge list to valid state ''' @@ -102,8 +126,8 @@ def delete_nodes_and_edges(input_list, common_nodes, old_edges_list): for pub in input_obj_list: if (common == pub.doi_url): usable_nodes.append(pub) - search_ref_graph_rec(pub) - search_cit_graph_rec(pub) + search_ref_graph_rec(pub, 1, old_depth) + search_cit_graph_rec(pub, 1, old_height) back_to_valid_edges(old_edges_list, usable_nodes) diff --git a/verarbeitung/update_graph/import_from_json.py b/verarbeitung/update_graph/import_from_json.py index 92d9b02e2c225eaf2a5cd2c3607f080ee9c231a9..72217d5da3a46e368272cc46a176bc14557320ba 100644 --- a/verarbeitung/update_graph/import_from_json.py +++ b/verarbeitung/update_graph/import_from_json.py @@ -86,6 +86,9 @@ def input_from_json(json_file): # adds references and citations to publications and creates edges add_ref_and_cit_to_pubs(input_dict) + old_depth_height = input_dict["depth_height"] + old_depth = old_depth_height[0] + old_height = old_depth_height[1] - return(list_of_nodes_py, list_of_edges_py) \ No newline at end of file + return(list_of_nodes_py, list_of_edges_py, old_depth, old_height) \ No newline at end of file diff --git a/verarbeitung/update_graph/update_depth.py b/verarbeitung/update_graph/update_depth.py index 1d99d5a06cbde524d6ea5f59fa81ed0ba09f7aeb..f843bb5263608b09188559bd9e4c5f6cc6924cc4 100644 --- a/verarbeitung/update_graph/update_depth.py +++ b/verarbeitung/update_graph/update_depth.py @@ -93,20 +93,6 @@ def reduce_max_depth(max_depth): processed_input_list.remove(pub) - -def get_old_height_depth(): - ''' - function to get old max height and max depth from previous construction call - ''' - max_height = 0 - max_depth = 0 - for pub in processed_input_list: - if (pub.group < 0): - max_depth = max(max_depth, abs(pub.group)) - if (pub.group > 0): - max_height = max(max_height, pub.group) - return(max_height, max_depth) - def get_old_max_references(old_depth, test_var): ''' :param old_depth: old maximum depth to search for citations @@ -141,7 +127,7 @@ def get_old_max_citations(old_height, test_var): old_max_citations.append(pub) return(old_max_citations) -def update_depth(obj_input_list, input_edges, new_depth, new_height, test_var): +def update_depth(obj_input_list, input_edges, new_depth, new_height, old_depth, old_height, test_var): ''' :param obj_input_list: input list of publications of type Publication from update_graph :type obj_input_list: List[Publication] @@ -165,8 +151,6 @@ def update_depth(obj_input_list, input_edges, new_depth, new_height, test_var): processed_input_list = obj_input_list valid_edges = input_edges - old_height, old_depth = get_old_height_depth() - # removes publications and links from recursion levels which aren't needed anymore or adds new ones if (old_depth > new_depth): reduce_max_depth(new_depth) @@ -187,8 +171,6 @@ def update_depth(obj_input_list, input_edges, new_depth, new_height, test_var): # adds edges between reference group and citation group of known publications - return(old_depth, old_height) - diff --git a/verarbeitung/update_graph/update_graph.py b/verarbeitung/update_graph/update_graph.py index 416be51f890443d9bf9bdb58bf3ccf63645ba37b..8143ab4a02aaa361e6fe33e8913476f7752f4e4b 100644 --- a/verarbeitung/update_graph/update_graph.py +++ b/verarbeitung/update_graph/update_graph.py @@ -16,9 +16,11 @@ __status__ = "Production" import sys + sys.path.append("../../") from input.publication import Publication +from verarbeitung.construct_new_graph.initialize_graph import complete_inner_edges from verarbeitung.get_pub_from_input import get_pub from .compare_old_and_new_node_lists import compare_old_and_new_node_lists from .delete_nodes_edges import delete_nodes_and_edges @@ -85,7 +87,7 @@ def update_graph(new_doi_input_list, json_file, search_depth, search_height, tes ''' # gets information from previous cunstruction call - old_obj_input_list , old_edges_list = input_from_json(json_file) + old_obj_input_list , old_edges_list, old_search_depth, old_search_height = input_from_json(json_file) # one global list to save the process of removing unneeded publications and one to save valid edges global processed_list, valid_edges, error_doi_list @@ -101,14 +103,17 @@ def update_graph(new_doi_input_list, json_file, search_depth, search_height, tes # retrieve which publications are already known, removed, inserted common_nodes, inserted_nodes, deleted_nodes = compare_old_and_new_node_lists(old_doi_input_list, new_doi_input_list) - old_search_depth, old_search_height = update_depth(processed_list, valid_edges, search_depth, search_height, test_var) + processed_list_copy = processed_list.copy() valid_edges_copy = valid_edges.copy() + update_depth(processed_list, valid_edges, search_depth, search_height, old_search_depth, old_search_height, test_var) + # deletes publications and edges from node_list if publications can no longer be reached if (len(deleted_nodes) > 0): - processed_list, valid_edges = delete_nodes_and_edges(processed_list, common_nodes, valid_edges) + processed_list, valid_edges = delete_nodes_and_edges(processed_list, common_nodes, valid_edges, old_search_depth, old_search_height) + if (len(inserted_nodes) > 0): inserted_pub_nodes, inserted_edges, error_doi_list_new = connect_old_and_new_input(processed_list_copy, valid_edges_copy, inserted_nodes, old_search_depth, old_search_height, search_depth, search_height, test_var) @@ -131,4 +136,6 @@ def update_graph(new_doi_input_list, json_file, search_depth, search_height, tes if inserted_edge not in valid_edges: valid_edges.append(inserted_edge) + complete_inner_edges(True, processed_list, valid_edges) + return(processed_list, valid_edges, error_doi_list)