diff --git a/app/Console/Commands/ImportCHEMBLNames.php b/app/Console/Commands/ImportCHEMBLNames.php index e50c6f86..f96a1b7d 100644 --- a/app/Console/Commands/ImportCHEMBLNames.php +++ b/app/Console/Commands/ImportCHEMBLNames.php @@ -75,18 +75,18 @@ public function handle() ->where('id', $row->id) ->update([ 'name' => $newName, - 'synonyms' => $synonyms + 'synonyms' => $synonyms, ]); - }else{ + } else { $newName = $row->iupac_name; - if($newName){ + if ($newName) { $synonyms = json_decode($row->synonyms) ?? []; array_unshift($synonyms, $row->name); DB::table('molecules') ->where('id', $row->id) ->update([ 'name' => $newName, - 'synonyms' => $synonyms + 'synonyms' => $synonyms, ]); } } diff --git a/app/Livewire/MoleculeDepict3d.php b/app/Livewire/MoleculeDepict3d.php index 2d196328..a4cafd91 100644 --- a/app/Livewire/MoleculeDepict3d.php +++ b/app/Livewire/MoleculeDepict3d.php @@ -18,7 +18,7 @@ class MoleculeDepict3d extends Component #[Computed] public function source() { - return env('CM_API').'depict/3D?smiles='.urlencode($this->smiles).'&height='.$this->height.'&width='.$this->width.'&CIP='.$this->CIP.'&toolkit=rdkit'; + return env('CM_API').'depict/3D?smiles='.urlencode($this->smiles).'&height='.$this->height.'&width='.$this->width.'&CIP='.$this->CIP.'&toolkit=openbabel'; } public function render() diff --git a/app/Models/Molecule.php b/app/Models/Molecule.php index 06b2e7b9..93e94130 100644 --- a/app/Models/Molecule.php +++ b/app/Models/Molecule.php @@ -178,8 +178,8 @@ public function getSchema($type = 'bioschemas') if ($this->organisms) { $organisms = $this->organisms ?? []; - $names = []; - foreach($organisms as $organism) { + $names = []; + foreach ($organisms as $organism) { $name = $organism->name; array_push($names, $name); } @@ -187,83 +187,99 @@ public function getSchema($type = 'bioschemas') } $additionalPropertysSchemas = []; - $moleculeAdditionalPropertys = array( - "annotation_level" => "Annotation level" - ); + $moleculeAdditionalPropertys = [ + 'annotation_level' => 'Annotation level', + ]; - foreach($moleculeAdditionalPropertys as $key => $value) { + foreach ($moleculeAdditionalPropertys as $key => $value) { $propertySchema = Schema::PropertyValue(); $propertySchema->name($value) - ->value($this->$key); + ->value($this->$key); array_push($additionalPropertysSchemas, $propertySchema); } - $propertyAdditionalPropertys = array( - "total_atom_count" => "Total atom count", - "aromatic_rings_count" => "Aromatic rings count", - "qed_drug_likeliness" => "QED drug likeliness", - "formal_charge" => "Formal charge", - "contains_sugar" => "Contains sugar", - "np_likeness" => "NP likeness", - "chemical_class" => "Chemical class", - "chemical_sub_class" => "Chemical sub class", - "chemical_super_class" => "Chemical super class", - ); - - foreach($propertyAdditionalPropertys as $key => $value) { + $propertyAdditionalPropertys = [ + 'total_atom_count' => 'Total atom count', + 'aromatic_rings_count' => 'Aromatic rings count', + 'qed_drug_likeliness' => 'QED drug likeliness', + 'formal_charge' => 'Formal charge', + 'contains_sugar' => 'Contains sugar', + 'np_likeness' => 'NP likeness', + 'chemical_class' => 'Chemical class', + 'chemical_sub_class' => 'Chemical sub class', + 'chemical_super_class' => 'Chemical super class', + ]; + + foreach ($propertyAdditionalPropertys as $key => $value) { $propertySchema = Schema::PropertyValue(); $propertySchema->name($value) - ->value($this->properties->$key); + ->value($this->properties->$key); array_push($additionalPropertysSchemas, $propertySchema); } if ($this->geo_locations) { $geo_locations = $this->geo_locations ?? []; - $names = []; - foreach($geo_locations as $geo_location) { + $names = []; + foreach ($geo_locations as $geo_location) { $name = $geo_location->name; array_push($names, $name); } $propertySchema = Schema::PropertyValue(); - $propertySchema->name("Geographic location") - ->value($names); + $propertySchema->name('Geographic location') + ->value($names); array_push($additionalPropertysSchemas, $propertySchema); } - + $moleculeSchema->additionalProperty($additionalPropertysSchemas); $datasetSchema = Schema::Dataset(); + $datasetSchema->name($this->name); + $datasetSchema->description('Natural product in the COCONUT database with details of source organisms, geolocations and citations.'); + $datasetSchema->license('https://creativecommons.org/licenses/by/4.0/'); + $catalogs = []; if ($this->collections) { $collections = $this->collections ?? []; - foreach($collections as $collection) { + foreach ($collections as $collection) { $dataCatalogSchema = Schema::DataCatalog(); - $dataCatalogSchema->name("Geographic location") + $dataCatalogSchema->name('Geographic location') // ->license($collection->licenses->url) - ->additionalType("collection") - ->description($collection->description) - ->identifier($collection->identifier) - ->url($collection->url) - ->name($collection->title); + ->additionalType('collection') + ->description($collection->description) + ->identifier($collection->identifier) + ->url($collection->url) + ->name($collection->title); + array_push($catalogs, $dataCatalogSchema); } - array_push($catalogs, $dataCatalogSchema); } $datasetSchema->includedInDataCatalog($catalogs) - ->about($moleculeSchema); + ->about($moleculeSchema); $citationsSchemas = []; if ($this->citations) { $citations = $this->citations ?? []; - foreach($citations as $citation) { + foreach ($citations as $citation) { $citationSchema = Schema::CreativeWork(); $citationSchema->identifier($citation->doi) - ->headline($citation->title) - ->author($citation->authors); + ->headline($citation->title) + ->author($citation->authors); array_push($citationsSchemas, $citationSchema); } } $datasetSchema->citation($citationsSchemas); + + $contactPoint = Schema::ContactPoint(); + $contactPoint->contactType('research inquiries') + ->email('info.coconut@uni-jena.de'); + + $coconut = Schema::Organization(); + $coconut->url('https://coconut.naturalproducts.net/') + ->name('COCONUT - COlleCtion of Open Natural prodUcTs') + ->contactPoint($contactPoint); + + $datasetSchema->creator($coconut); + return $datasetSchema; } } diff --git a/resources/views/molecule.blade.php b/resources/views/molecule.blade.php index 15bcdf17..0d35a238 100644 --- a/resources/views/molecule.blade.php +++ b/resources/views/molecule.blade.php @@ -2,8 +2,7 @@ @section('title', $molecule['identifier']) @section('meta') organisms) && $molecule->organisms->count() > 0) in {{ implode(', ', $molecule->organisms->take(2)->pluck('name')->toArray()) }} @endif @if ( (!isset($molecule->organisms) || $molecule->organisms->count() === 0) && isset($molecule->collections) && @@ -12,8 +11,7 @@ @elseif(isset($molecule->organisms) && $molecule->organisms->count() > 0 && isset($molecule->collections) && - $molecule->collections->count() > 0) - and found in the collection{{ $molecule->collections->count() > 1 ? 's' : '' }}: + $molecule->collections->count() > 0) and found in the collection{{ $molecule->collections->count() > 1 ? 's' : '' }}: {{ implode(', ', $molecule->collections->pluck('name')->toArray()) }} @endif">