Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #303

Merged
merged 173 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
0d6acf3
feat: assign DOIs to collections
NRayya Aug 20, 2024
2571cf1
Merge branch 'development' into doi
CS76 Aug 26, 2024
d0652b3
fix: added repository
CS76 Sep 12, 2024
a0c8dd8
fix: added missing command
CS76 Sep 12, 2024
2f53219
fix: added yes flag to install commands
CS76 Sep 12, 2024
56433df
fix: AttributeError: 'NoneType' object has no attribute 'people' fix
CS76 Sep 12, 2024
f46711e
fix: added required libs
CS76 Sep 12, 2024
668d489
fix: removed python2 to resolve Package 'python2' has no installation…
CS76 Sep 12, 2024
996baa4
fix: enabled php redis
CS76 Sep 12, 2024
275330b
fix: removed rename
CS76 Sep 12, 2024
e10f109
fix: added missing media drop
CS76 Sep 12, 2024
b3afd7a
Merge branch 'feature-doi-service' into doi
CS76 Sep 12, 2024
b03eae8
fix: DOI issue fixed
CS76 Sep 12, 2024
2a5c5f5
wip: suggested changes are now stored in the reports table. SQL queri…
sriramkanakam87 Sep 18, 2024
c4df3c0
Merge pull request #257 from Steinbeck-Lab/main
CS76 Sep 23, 2024
063f0fe
Merge branch 'development' into doi
CS76 Sep 23, 2024
2da1fcf
fix: key issue fixed
sriramkanakam87 Sep 23, 2024
bef6b8d
fix: disabled logging empty values and enabled handling of existing e…
sriramkanakam87 Sep 24, 2024
b6067a5
fix: now the timestamps are auto managed for the pivot table molecule…
sriramkanakam87 Sep 24, 2024
5be9ccb
wip: suggested changes are now stored in the reports table. SQL queri…
sriramkanakam87 Sep 18, 2024
dc88750
Merge branch 'feat-report-suggestions' of https://github.com/Steinbec…
sriramkanakam87 Sep 24, 2024
058d942
feat: improved suggestions by replacing the old key value pairs with …
sriramkanakam87 Sep 26, 2024
716fe43
fix: now the time line shows synonym and cas changes properly
sriramkanakam87 Sep 26, 2024
d7dbc88
chore: commented out the slide over (wip)
sriramkanakam87 Sep 26, 2024
ff4621b
fix: minor fix related to creating citations
sriramkanakam87 Sep 26, 2024
8fef446
feat: improved the user friendliness (wip)
sriramkanakam87 Sep 29, 2024
3c97f6b
feat: added np_classifier in compound details and history ui updates
CS76 Sep 30, 2024
afa3037
fix: disabled history show by default and header to represent the event
CS76 Sep 30, 2024
24f56cb
chore: pint updates
CS76 Sep 30, 2024
6735e6d
feat: force https redirect and docker compose prod updates
CS76 Sep 30, 2024
bec1e4c
fix: horizon gate updates
CS76 Sep 30, 2024
74ab411
fix: sail network issue fix
CS76 Sep 30, 2024
1cd3680
fix: updated root folder
CS76 Sep 30, 2024
667912a
fix: nginx default config updates
CS76 Sep 30, 2024
9708ddd
fix: reverted docker compose build approach
CS76 Sep 30, 2024
36b0139
fix: sail network issue
CS76 Sep 30, 2024
3ca326c
Merge branch 'development' into dc-prod
CS76 Sep 30, 2024
411916b
fix: app name conflict issue fix
CS76 Sep 30, 2024
2b3f5f5
fix: audit fix
CS76 Sep 30, 2024
96b2dc8
feat: the report changes form is made user friendly with pre-filled f…
sriramkanakam87 Oct 1, 2024
2c1149f
feat: enabled create time pop-up modal to display overall changes bei…
sriramkanakam87 Oct 1, 2024
8f8113d
feat: altered the edit and view pages to load the new structure of th…
sriramkanakam87 Oct 1, 2024
bc36e7d
feat: new helper functions and fixes to the old ones to accommodate r…
sriramkanakam87 Oct 1, 2024
cceba8e
feat: now timeline can handle citations
sriramkanakam87 Oct 1, 2024
ae4bd28
chore: removed dd statements.
sriramkanakam87 Oct 1, 2024
dbf6c0d
fix: typo
Kohulan Oct 2, 2024
87363b3
fix: conditional checks were refined to work with the data structures…
sriramkanakam87 Oct 2, 2024
54bc73f
fix: to capture audits from citations
sriramkanakam87 Oct 2, 2024
c71fbc2
fix: additional checks
sriramkanakam87 Oct 2, 2024
ceba3a9
fix: key issue fixed
sriramkanakam87 Sep 23, 2024
f858ec0
fix: disabled logging empty values and enabled handling of existing e…
sriramkanakam87 Sep 24, 2024
6396ce9
fix: now the timestamps are auto managed for the pivot table molecule…
sriramkanakam87 Sep 24, 2024
cb40e70
wip: suggested changes are now stored in the reports table. SQL queri…
sriramkanakam87 Sep 18, 2024
367e9ca
wip: suggested changes are now stored in the reports table. SQL queri…
sriramkanakam87 Sep 18, 2024
49b918d
feat: improved suggestions by replacing the old key value pairs with …
sriramkanakam87 Sep 26, 2024
5a669cc
fix: now the time line shows synonym and cas changes properly
sriramkanakam87 Sep 26, 2024
51510be
chore: commented out the slide over (wip)
sriramkanakam87 Sep 26, 2024
b75caa4
fix: minor fix related to creating citations
sriramkanakam87 Sep 26, 2024
1475c47
feat: improved the user friendliness (wip)
sriramkanakam87 Sep 29, 2024
f650aee
feat: the report changes form is made user friendly with pre-filled f…
sriramkanakam87 Oct 1, 2024
97a11db
feat: enabled create time pop-up modal to display overall changes bei…
sriramkanakam87 Oct 1, 2024
0f2acbe
feat: altered the edit and view pages to load the new structure of th…
sriramkanakam87 Oct 1, 2024
ed645af
feat: new helper functions and fixes to the old ones to accommodate r…
sriramkanakam87 Oct 1, 2024
6c1c1aa
feat: now timeline can handle citations
sriramkanakam87 Oct 1, 2024
0eb2497
chore: removed dd statements.
sriramkanakam87 Oct 1, 2024
b28d1fa
Merge branch 'feat-report-suggestions' of https://github.com/Steinbec…
sriramkanakam87 Oct 2, 2024
206dc4b
feat: now only the fields requested for changes are available and the…
sriramkanakam87 Oct 2, 2024
3e7733b
feat: updated october 2024 release
CS76 Oct 2, 2024
7e83f7b
fix: the disabling of non-suggested fields is restricted only to edit
sriramkanakam87 Oct 2, 2024
607535c
fix: saving the overall suggested changes so that they are available …
sriramkanakam87 Oct 2, 2024
9c2d3f3
feat: original suggestions are saved and never touched, instead a sep…
sriramkanakam87 Oct 2, 2024
31ddfb0
fix: deleted the old statement
sriramkanakam87 Oct 2, 2024
9ad6641
fix: auto flush removed for dash widgets and geo-locations' widgets g…
sriramkanakam87 Oct 7, 2024
3ce816a
chore: formatting changes
sriramkanakam87 Oct 7, 2024
a275b02
fix: the status of the molecule now sets to revoked while deactivation
sriramkanakam87 Oct 7, 2024
f56ef21
feat: observer is created on molecule model to flush the model from c…
sriramkanakam87 Oct 7, 2024
0dc5535
chore: refactored the code
sriramkanakam87 Oct 7, 2024
53847b0
fix: which items received approval is now saved when approved, no nee…
sriramkanakam87 Oct 8, 2024
0ded278
fix: redirect to view page after the report is approved
sriramkanakam87 Oct 8, 2024
5670f31
fix: save modal is only displayed if it is a change
sriramkanakam87 Oct 8, 2024
658ff2f
fix: saving doi for reporting
sriramkanakam87 Oct 8, 2024
352f25f
Merge pull request #265 from Steinbeck-Lab/fix-molecule-deactivation-…
CS76 Oct 9, 2024
3af830d
Merge pull request #266 from Steinbeck-Lab/feat-flush-molecule-cahce-…
CS76 Oct 9, 2024
9345d1d
Merge pull request #262 from Steinbeck-Lab/fix-dashwidgets-autoflush-…
CS76 Oct 9, 2024
3ebdecc
Merge pull request #260 from Steinbeck-Lab/dev-kohulan
CS76 Oct 9, 2024
fa75c27
fix: removed cache flush from the coconut cache command
CS76 Oct 9, 2024
ca3dfdf
fix: various fixes to the reporting workflow
sriramkanakam87 Oct 10, 2024
c2d3c52
feat: now IUPAC names are displayed with proper italicisation.
sriramkanakam87 Oct 10, 2024
22187a3
fix: to handle italicised display of iupac name when name is not avai…
sriramkanakam87 Oct 13, 2024
b37dde6
Merge pull request #271 from Steinbeck-Lab/feat-italic-display-of-iup…
Kohulan Oct 14, 2024
335fdc2
fix: copy buttons now have a time out of 4 seconds to reset
sriramkanakam87 Oct 14, 2024
662cd84
feat: a download option is provided for the respective mol files from…
sriramkanakam87 Oct 14, 2024
46c3a16
feat: on hover now indicates which source the file is being downloade…
sriramkanakam87 Oct 14, 2024
10711c4
feat: now the search allows for partial inchikey search
sriramkanakam87 Oct 14, 2024
be91376
Merge pull request #273 from Steinbeck-Lab/feat-download-molfile
Kohulan Oct 14, 2024
cc62abf
Merge pull request #272 from Steinbeck-Lab/fix-copy-button-timeout
Kohulan Oct 14, 2024
2e04d2b
Merge pull request #274 from Steinbeck-Lab/feat-partial-inchikey-search
Kohulan Oct 14, 2024
43b88f7
fix: references to the compounds' source links are correctly parsed a…
sriramkanakam87 Oct 15, 2024
ba506f0
Merge pull request #278 from Steinbeck-Lab/fix-collection-reference-l…
Kohulan Oct 16, 2024
3f999a4
fix: to open reporting in a new tab
sriramkanakam87 Oct 16, 2024
9d068f0
Merge pull request #279 from Steinbeck-Lab/fix-open-reporting-in-new-tab
Kohulan Oct 16, 2024
7e0fe0f
fix: the request now goes to rdkit instead of opedbabel which was thr…
sriramkanakam87 Oct 16, 2024
35d10a1
Merge pull request #281 from Steinbeck-Lab/fix-3d-depict
Kohulan Oct 16, 2024
c2c4b49
fix: cookie consent privacy and terms of use links are pointed to the…
sriramkanakam87 Nov 5, 2024
636d8d9
Merge pull request #287 from Steinbeck-Lab/fix-cookieconsent-links
Kohulan Nov 5, 2024
efab97f
fix: refactored the form into the Citations model and applied a minor…
sriramkanakam87 Nov 6, 2024
71645e5
feat: molecule citation relation can now be searched by doi as well t…
sriramkanakam87 Nov 6, 2024
0726de4
feat: now citations can be searched by doi from the report's molecule…
sriramkanakam87 Nov 6, 2024
0e3278b
feat: new column assinged_to is added to the reports table
sriramkanakam87 Nov 7, 2024
2cabe52
feat: relation to retrieve the assigned user is added to the user model
sriramkanakam87 Nov 7, 2024
6987ddf
feat: users with any roles can now assign reports for curation
sriramkanakam87 Nov 7, 2024
0c2af60
fix: only assigned users now have access to edit view of reports
sriramkanakam87 Nov 7, 2024
ed4e0d1
fix: users can not edit the submitted reports and creation time null …
sriramkanakam87 Nov 7, 2024
fe580af
feat: added foreign key on structures table linking it to molecules t…
sriramkanakam87 Nov 12, 2024
1569b81
feat: new command to import the 2d SDFs into structures table
sriramkanakam87 Nov 12, 2024
a4109d8
feat: audits on the structures table are added to the timeline
sriramkanakam87 Nov 12, 2024
8ac4729
fix: 2d download is now fetched from the db
sriramkanakam87 Nov 13, 2024
42c0274
feat: download button for 3d molecules is now available
sriramkanakam87 Nov 13, 2024
82fa0b9
fix: links in the footer are now working
sriramkanakam87 Nov 13, 2024
bf48f25
fix: conditional hidden issue fix
CS76 Nov 13, 2024
3826800
fix: access restrictions and improved user-friendliness
sriramkanakam87 Nov 13, 2024
efca0a4
wip: 3d depiction
sriramkanakam87 Nov 14, 2024
efd4626
feat: new command to fix duplicates and missing links for the molecul…
sriramkanakam87 Nov 15, 2024
8d224dd
fix: hidden field issues are fixed
sriramkanakam87 Nov 15, 2024
be708bc
feat: new command to import a set of jsons in a folder
sriramkanakam87 Nov 18, 2024
5893c54
fix: fixed the file name issue
sriramkanakam87 Nov 19, 2024
a061a35
fix: reverted to pinging the api for now
sriramkanakam87 Nov 19, 2024
c373d45
fix: removed the toolkit as we are only using RDKit
sriramkanakam87 Nov 19, 2024
905f092
fix: the missing molecules are excluded
sriramkanakam87 Nov 20, 2024
885c2db
fix: replaced the or with and condition
sriramkanakam87 Nov 20, 2024
21838e9
feat: users with any role can now see an additional filter tab assign…
sriramkanakam87 Nov 20, 2024
ddde34b
fix: curators can only see open reports in the assigned tab
sriramkanakam87 Nov 20, 2024
1ba14ec
fix: fixes the array for the parents
sriramkanakam87 Nov 21, 2024
728fc92
Merge pull request #289 from Steinbeck-Lab/feat-report-curator-assign…
CS76 Nov 22, 2024
91461df
Merge pull request #288 from Steinbeck-Lab/fix-attach-citation-search…
CS76 Nov 22, 2024
e9947a3
chore: rearranged the look and descriptions of the download
sriramkanakam87 Nov 22, 2024
f1ada25
Merge branch 'development' into feat-report-suggestions
CS76 Nov 22, 2024
4bed61d
Merge pull request #267 from Steinbeck-Lab/feat-report-suggestions
CS76 Nov 22, 2024
b6c4d6b
fix: enabled cookie banner display on smaller screens
CS76 Nov 22, 2024
fe0b4f6
feat: enabled mol / sdf drag drop
CS76 Nov 22, 2024
905e118
Merge pull request #293 from Steinbeck-Lab/fix-cookie-banner
sriramkanakam87 Nov 22, 2024
1341264
feat: added list view
CS76 Nov 22, 2024
9aa24ba
Merge pull request #294 from Steinbeck-Lab/feat-drag-drop-mol
sriramkanakam87 Nov 22, 2024
186d23c
fix: various fixes to handle null values and to hide the report/sugge…
sriramkanakam87 Nov 23, 2024
78c57f6
Merge pull request #295 from Steinbeck-Lab/feature-results-table-view
CS76 Nov 23, 2024
fa86da0
Merge pull request #290 from Steinbeck-Lab/fix-links-terms-usage
CS76 Nov 23, 2024
aa6db10
feat: python script for uploading collection wise sdfs
sriramkanakam87 Nov 25, 2024
a77cb3d
chore: code optimisation
sriramkanakam87 Nov 25, 2024
2d66702
fix: added another argument for giving base directory
sriramkanakam87 Nov 25, 2024
1ab3f9a
fix: default base dir is the current working directory
sriramkanakam87 Nov 25, 2024
4b2d56b
feat: added SDF download link to collection details page and ui bug f…
CS76 Nov 25, 2024
d97501d
Merge pull request #296 from Steinbeck-Lab/feat-upload-collection-sdfs
CS76 Nov 25, 2024
4f661a8
fix: handles null values during approvals, fixes curator access issue…
sriramkanakam87 Nov 26, 2024
13a0997
fix: bulk activate and de-activate is fixed
sriramkanakam87 Nov 27, 2024
48b6f8a
fix: optimised the code with indexes and batches
sriramkanakam87 Nov 27, 2024
4dbede1
feat: enabled basic implementation of search
CS76 Nov 28, 2024
033903a
Merge pull request #298 from Steinbeck-Lab/fix-collection-compound-links
CS76 Nov 28, 2024
a38339b
Merge pull request #297 from Steinbeck-Lab/feat-report-suggestions
CS76 Nov 28, 2024
caf0c55
Merge pull request #291 from Steinbeck-Lab/feat-import-2D-3D-SDFs
CS76 Nov 28, 2024
00340b9
Merge pull request #300 from Steinbeck-Lab/feat-advanced-search
sriramkanakam87 Nov 28, 2024
67af50d
fix: updated citation
CS76 Nov 28, 2024
73380ae
fix: updated readme
CS76 Dec 2, 2024
a8eef52
Merge branch 'development' into doi
CS76 Dec 2, 2024
6fd1a71
fix: updated coconut collection assign doi command updated
CS76 Dec 2, 2024
d3fb756
chore: code formatting updates
CS76 Dec 2, 2024
916cc60
fix: DOI issues fix
CS76 Dec 2, 2024
a3b1b5f
fix: enabled DOI links on collection pages
CS76 Dec 2, 2024
f93caa5
feat: added all the available columns from molecules and properties t…
sriramkanakam87 Dec 2, 2024
beadcb8
fix: corrected the fillable arrays inline with production db
sriramkanakam87 Dec 2, 2024
8cb0379
Merge branch 'development' into feat-api-search-expansion
sriramkanakam87 Dec 3, 2024
5e659bb
Merge pull request #301 from Steinbeck-Lab/feat-api-search-expansion
CS76 Dec 3, 2024
5d1e1a2
chore: updated readme
sriramkanakam87 Dec 4, 2024
0f4145c
Merge pull request #302 from Steinbeck-Lab/chore-docs-update
CS76 Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,38 @@
[![RDKit badge](https://img.shields.io/badge/Powered%20by-RDKit-3838ff.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEXc3NwUFP8UPP9kZP+MjP+0tP////9ZXZotAAAAAXRSTlMAQObYZgAAAAFiS0dEBmFmuH0AAAAHdElNRQfmAwsPGi+MyC9RAAAAQElEQVQI12NgQABGQUEBMENISUkRLKBsbGwEEhIyBgJFsICLC0iIUdnExcUZwnANQWfApKCK4doRBsKtQFgKAQC5Ww1JEHSEkAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wMy0xMVQxNToyNjo0NyswMDowMDzr2J4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDMtMTFUMTU6MjY6NDcrMDA6MDBNtmAiAAAAAElFTkSuQmCC)](https://www.rdkit.org/)
![Workflow](https://GitHub.com/Steinbeck-Lab/coconut/actions/workflows/dev-build.yml/badge.svg)
[![Powered by Laravel](https://img.shields.io/badge/Powered%20by-Laravel-red.svg?style=flat&logo=Laravel)](https://laravel.com)
[![DOI](https://zenodo.org/badge/778260166.svg)](https://zenodo.org/doi/10.5281/zenodo.13283948)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13897048.svg)](https://doi.org/10.5281/zenodo.13382750)

</div>

## ![About](https://www.google.com/s2/favicons?domain=naturalproducts.net) About COCONUT
## ![About](https://www.google.com/s2/favicons?domain=coconut.naturalproducts.net) About

COCONUT is an open-access database dedicated to collecting and disseminating natural products. It aims to provide researchers, scientists, and enthusiasts with comprehensive and easily accessible data on a wide variety of natural compounds. The database includes detailed information on the chemical structures, literature references and sources of these compounds, facilitating research and discovery in natural products.
A comprehensive platform facilitating natural product research by providing data, tools, and services for deposition, curation, and reuse. It aims to provide researchers, scientists, and enthusiasts with comprehensive and easily accessible data on a wide variety of natural compounds. The database includes detailed information on the chemical structures, literature references and sources of these compounds, facilitating research and discovery in natural products.

## ![Features](https://www.google.com/s2/favicons?domain=github.com) Features

- **Extensive Database**: Contains information on thousands of natural products from diverse sources (63).
- **Chemical Structures**: Provides detailed chemical structures for each natural product, aiding research and identification.
- **Search and Filter**: Advanced search and filtering options to find compounds based on specific criteria easily.
- **Online Submission and Curation**: Allows users to contribute new data, ensuring the database remains current and comprehensive.
- **API Access**: Provides API access for seamless integration with other tools and databases.
[https://coconut.naturalproducts.net/](https://coconut.naturalproducts.net/)

## ![Calculations](https://www.google.com/s2/favicons?domain=python.org) Descriptor calculations
## ![Features](https://www.google.com/s2/favicons?domain=github.com) Features

COCONUT data curation and descriptors calculation are performed using our [microservices](https://github.com/Steinbeck-Lab/cheminformatics-python-microservice). More details can be found in our [API documentation](https://api.naturalproducts.net/docs).
- **Standardised data aggregation**: COCONUT 2.0 aggregates data from [more than 63 sources](https://coconut.naturalproducts.net/collections?q=) using ChEMBL curation pipeline with RDKit post-processing, standardizing molecular structures and metadata while preserving stereochemistry from sources.
- *Descriptor calculations*: COCONUT data curation and descriptors calculation are performed using [Cheminformatics microservice](https://docs.api.naturalproducts.net/).
- **Comprehensive download options**: The database offers downloads in CSV, SDF, and SQL dump formats, with specialized CSV files for mass spectrometry, molecular descriptors, and substructure analyses accessible [here](https://coconut.naturalproducts.net/download).
- **Search and Filtering**: Users can search by chemical structure (exact, substructure, similarity), text-based queries for names/SMILES, and filter by organism, chemical class, or literature references.
- **Online Submission and Curation**: Features community-driven data submission and curation through a web interface, allowing users to submit new structures, report issues, and request changes with full audit trail tracking.
- **API Access**: Provides a REST API compliant with OpenAPI specifications for programmatic access to chemical structures, metadata, and audit information with real-time data updates - [API documentation](https://coconut.naturalproducts.net/api-documentation).

## ![License](https://www.google.com/s2/favicons?domain=opensource.org) License

COCONUT infrastructure code is licensed under the MIT license - see the [LICENSE](https://GitHub.com/Steinbeck-Lab/coconut/blob/documentation/LICENSE). Every source on COCONUT comes with its own specific license. It is essential to review the license details for each dataset before using it.

## ![Citations](https://www.google.com/s2/favicons?domain=doi.org)Citations

### COCONUT 2.0
- Venkata Chandrasekhar, Kohulan Rajan, Sri Ram Sagar Kanakam, Nisha Sharma, Viktor Weißenborn, Jonas Schaub, Christoph Steinbeck, COCONUT 2.0: a comprehensive overhaul and curation of the collection of open natural products database, Nucleic Acids Research, 2024;, gkae1063, https://doi.org/10.1093/nar/gkae1063

### COCONUT (Legacy)
- Sorokina, M., Merseburger, P., Rajan, K. et al. (2021). COCONUT online: COlleCtion of Open Natural prodUcTs database. *Journal of Cheminformatics*, 13, 2.
https://doi.org/10.1186/s13321-020-00478-9

### COCONUT 2.0
- Nainala, V.C., Rajan, K., Kanakam, S.R.S., Sharma, N., Weißenborn, V., Schaub, J., et al. (2024). COCONUT 2.0: A comprehensive overhaul and curation of the collection of open natural products database. *ChemRxiv*.
https://doi.org/10.26434/chemrxiv-2024-fxq2s

## ![Maintained](https://www.google.com/s2/favicons?domain=uni-jena.de) Maintained by

The COCONUT database and its infrastructure are developed and maintained by the [Steinbeck group](https://cheminf.uni-jena.de) at the [Friedrich Schiller University](https://www.uni-jena.de/en/) Jena, Germany.
Expand Down
50 changes: 50 additions & 0 deletions app/Actions/Coconut/AssignDOI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace App\Actions\Coconut;

use App\Models\Collection;
use App\Models\Ticker;
use App\Services\DOI\DOIService;

class AssignDOI
{
private $doiService;

/**
* Create a new class instance.
*
* @return void
*/
public function __construct(DOIService $doiService)
{
$this->doiService = $doiService;
}

/**
* Archive the given model.
*
* @param mixed $model
* @return void
*/
public function assign($model)
{
$collection = null;
if ($model instanceof Collection) {
$collection = $model;
}
if ($collection) {
$collectionIdentifier = $collection->identifier ? $collection->identifier : null;
if ($collectionIdentifier == null) {
$collectionTicker = Ticker::whereType('collection')->first();
$collectionIdentifier = $collectionTicker->index + 1;
$collectionTicker->index = $collectionIdentifier;
$collectionTicker->save();

$collection->identifier = $collectionIdentifier;
$collection->save();
}
$collection->fresh()->generateDOI($this->doiService);
echo $collection->identifier."\r\n";
}
}
}
75 changes: 25 additions & 50 deletions app/Actions/Coconut/SearchMolecule.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function query($query, $size, $type, $sort, $tagType, $page)
$this->query = $query;
$this->size = $size;
$this->type = $type;

$this->sort = $sort;
$this->tagType = $tagType;
$this->page = $page;
Expand All @@ -61,10 +62,15 @@ public function query($query, $size, $type, $sort, $tagType, $page)
}
$queryType = strtolower($queryType);

$filterMap = $this->getFilterMap();
$filterMap = getFilterMap();

if ($queryType == 'tags') {
$results = $this->buildTagsStatement($offset);
} elseif ($queryType == 'filters') {
$statement = $this->buildStatement($queryType, $offset, $filterMap);
if ($statement) {
$results = $this->executeQuery($statement);
}
} else {
$statement = $this->buildStatement($queryType, $offset, $filterMap);
if ($statement) {
Expand All @@ -73,11 +79,9 @@ public function query($query, $size, $type, $sort, $tagType, $page)
}

return [$results, $this->collection, $this->organisms];

} catch (QueryException $exception) {

return $this->handleException($exception);

}
}

Expand All @@ -89,6 +93,7 @@ private function determineQueryType($query)
$patterns = [
'inchi' => '/^((InChI=)?[^J][0-9BCOHNSOPrIFla+\-\(\)\\\\\/,pqbtmsih]{6,})$/i',
'inchikey' => '/^([0-9A-Z\-]{27})$/i', // Modified to ensure exact length
'parttialinchikey' => '/^([A-Z]{14})$/i',
'smiles' => '/^([^J][0-9BCOHNSOPrIFla@+\-\[\]\(\)\\\\\/%=#$]{6,})$/i',
];

Expand All @@ -102,6 +107,8 @@ private function determineQueryType($query)
return 'inchi';
} elseif ($type == 'inchikey' && substr($query, 14, 1) == '-' && strlen($query) == 27) {
return 'inchikey';
} elseif ($type == 'parttialinchikey' && strlen($query) == 14) {
return 'parttialinchikey';
} elseif ($type == 'smiles') {
return 'smiles';
}
Expand All @@ -111,43 +118,6 @@ private function determineQueryType($query)
return 'text';
}

/**
* Return a mapping of filter codes to database columns.
*/
private function getFilterMap()
{
return [
'mf' => 'molecular_formula',
'mw' => 'molecular_weight',
'hac' => 'heavy_atom_count',
'tac' => 'total_atom_count',
'arc' => 'aromatic_ring_count',
'rbc' => 'rotatable_bond_count',
'mrc' => 'minimal_number_of_rings',
'fc' => 'formal_charge',
'cs' => 'contains_sugar',
'crs' => 'contains_ring_sugars',
'cls' => 'contains_linear_sugars',
'npl' => 'np_likeness_score',
'alogp' => 'alogp',
'topopsa' => 'topo_psa',
'fsp3' => 'fsp3',
'hba' => 'h_bond_acceptor_count',
'hbd' => 'h_bond_donor_count',
'ro5v' => 'rule_of_5_violations',
'lhba' => 'lipinski_h_bond_acceptor_count',
'lhbd' => 'lipinski_h_bond_donor_count',
'lro5v' => 'lipinski_rule_of_5_violations',
'ds' => 'found_in_databases',
'class' => 'chemical_class',
'subclass' => 'chemical_sub_class',
'superclass' => 'chemical_super_class',
'parent' => 'direct_parent_classification',
'org' => 'organism',
'cite' => 'ciatation',
];
}

/**
* Build the SQL statement based on the query type.
*/
Expand Down Expand Up @@ -175,6 +145,7 @@ private function buildStatement($queryType, $offset, $filterMap)
break;

case 'inchikey':
case 'parttialinchikey':
$statement = "SELECT id, COUNT(*) OVER ()
FROM molecules
WHERE standard_inchi_key LIKE '%{$this->query}%'
Expand Down Expand Up @@ -262,19 +233,23 @@ private function buildTagsStatement($offset)
private function buildFiltersStatement($filterMap)
{
$orConditions = explode('OR', $this->query);
$statement = 'SELECT molecule_id as id, COUNT(*) OVER ()
FROM properties WHERE ';

foreach ($orConditions as $index => $orCondition) {
if ($index > 0) {
$statement = 'SELECT properties.molecule_id as id, COUNT(*) OVER ()
FROM properties
INNER JOIN molecules ON properties.molecule_id = molecules.id
WHERE molecules.active = TRUE
AND NOT (molecules.is_parent = TRUE AND molecules.has_variants = TRUE)
AND ';

foreach ($orConditions as $outerIndex => $orCondition) {
if ($outerIndex > 0) {
$statement .= ' OR ';
}

$andConditions = explode(' ', trim($orCondition));
$statement .= '(';

foreach ($andConditions as $index => $andCondition) {
if ($index > 0) {
foreach ($andConditions as $innerIndex => $andCondition) {
if ($innerIndex > 0) {
$statement .= ' AND ';
}

Expand Down Expand Up @@ -326,7 +301,7 @@ private function buildDefaultStatement($offset)
WHEN \"name\"::TEXT ILIKE '%{$this->query}%' THEN 4
WHEN \"synonyms\"::TEXT ILIKE '%{$this->query}%' THEN 5
WHEN \"identifier\"::TEXT ILIKE '%{$this->query}%' THEN 6
ELSE 7
ELSE 7
END
LIMIT {$this->size} OFFSET {$offset}";
} else {
Expand All @@ -350,16 +325,16 @@ private function executeQuery($statement)

$ids_array = collect($hits)->pluck('id')->toArray();
$ids = implode(',', $ids_array);
// dd($ids);

if ($ids != '') {

$statement = "
SELECT identifier, canonical_smiles, annotation_level, name, iupac_name, organism_count, citation_count, geo_count, collection_count
FROM molecules
WHERE id = ANY (array[{$ids}])
WHERE id = ANY (array[{$ids}]) AND active = TRUE AND NOT (is_parent = TRUE AND has_variants = TRUE)
ORDER BY array_position(array[{$ids}], id);
";

if ($this->sort == 'recent') {
$statement .= ' ORDER BY created_at DESC';
}
Expand Down
4 changes: 3 additions & 1 deletion app/Console/Commands/AssignCollectionsIdentifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public function handle()

public function generateIdentifier($index)
{
return 'CNPC'.str_pad($index, 4, '0', STR_PAD_LEFT);
$prefix = (env('APP_ENV') === 'production') ? 'CNPC' : 'CNPC_DEV';

return $prefix.str_pad($index, 6, '0', STR_PAD_LEFT);
}

public function fetchLastIndex()
Expand Down
45 changes: 45 additions & 0 deletions app/Console/Commands/AssignDOIs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\Console\Commands;

use App\Actions\Coconut\AssignDOI;
use App\Models\Collection;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class AssignDOIs extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'coconut:collection-assign-doi';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Assigns dois to all unassigned public collections';

/**
* Execute the console command.
*
* @return int
*/
public function handle(AssignDOI $assigner)
{
return DB::transaction(function () use ($assigner) {
$collections = Collection::where([
['is_public', true],
['doi', null],
])->get();

foreach ($collections as $collection) {
$collectionDOI = $collection->doi ? $collection->doi : null;
$assigner->assign($collection);
}
});
}
}
18 changes: 9 additions & 9 deletions app/Console/Commands/DashWidgetsRefresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,49 +32,49 @@ public function handle()
// Cache::flush();

// Create the cache for all DashboardStats widgets
Cache::remember('stats.collections', 172800, function () {
Cache::rememberForever('stats.collections', function () {
return DB::table('collections')->selectRaw('count(*)')->get()[0]->count;
});
$this->info('Cache for collections refreshed.');

Cache::remember('stats.citations', 172800, function () {
Cache::rememberForever('stats.citations', function () {
return DB::table('citations')->selectRaw('count(*)')->get()[0]->count;
});
$this->info('Cache for citations refreshed.');

Cache::remember('stats.organisms', 172800, function () {
Cache::rememberForever('stats.organisms', function () {
return DB::table('organisms')->selectRaw('count(*)')->get()[0]->count;
});
$this->info('Cache for organisms refreshed.');

Cache::remember('stats.geo_locations', 172800, function () {
Cache::rememberForever('stats.geo_locations', function () {
return DB::table('geo_locations')->selectRaw('count(*)')->get()[0]->count;
});
$this->info('Cache for geo locations refreshed.');

Cache::remember('stats.reports', 172800, function () {
Cache::rememberForever('stats.reports', function () {
return DB::table('reports')->selectRaw('count(*)')->get()[0]->count;
});
$this->info('Cache for reports refreshed.');

// Create the cache for all DashboardStatsMid widgets

Cache::remember('stats.molecules.non_stereo', 172800, function () {
Cache::rememberForever('stats.molecules.non_stereo', function () {
return DB::table('molecules')->selectRaw('count(*)')->whereRaw('has_stereo=false and is_parent=false')->get()[0]->count;
});
$this->info('Cache for molecules non-stereo refreshed.');

Cache::remember('stats.molecules.stereo', 172800, function () {
Cache::rememberForever('stats.molecules.stereo', function () {
return DB::table('molecules')->selectRaw('count(*)')->whereRaw('has_stereo=true')->get()[0]->count;
});
$this->info('Cache for molecules stereo refreshed.');

Cache::remember('stats.molecules.parent', 172800, function () {
Cache::rememberForever('stats.molecules.parent', function () {
return DB::table('molecules')->selectRaw('count(*)')->whereRaw('has_stereo=false and is_parent=true')->get()[0]->count;
});
$this->info('Cache for molecules parent refreshed.');

Cache::remember('stats.molecules', 172800, function () {
Cache::rememberForever('stats.molecules', function () {
return DB::table('molecules')->selectRaw('count(*)')->whereRaw('active=true and NOT (is_parent=true AND has_variants=true)')->get()[0]->count;
});
$this->info('Cache for molecules refreshed.');
Expand Down
Loading
Loading