Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/edmcouncil/idmp into IDMP…
Browse files Browse the repository at this point in the history
…-592
  • Loading branch information
ElisaKendall committed Sep 28, 2023
2 parents 303a7f6 + 8cbeeba commit 0593770
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/unit_tests_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ jobs:
done
- name: Combine GSRS with IDMP
run: |
sudo wget --no-verbose -m -nH -nd https://idmp-datasets.s3.eu-central-1.amazonaws.com/GSRS/gsrs-active-moiety.ttl
sudo wget --no-verbose -m -nH -nd https://idmp-datasets.s3.eu-central-1.amazonaws.com/GSRS/gsrs-dct-identifier.ttl
sudo wget --no-verbose -m -nH -nd https://idmp-datasets.s3.eu-central-1.amazonaws.com/GSRS/gsrs-skos-altLabel.ttl
source_files=(gsrs-transformed.ttl AboutIDMPDev-ReferenceIndividuals.ttl gsrs-active-moiety.ttl gsrs-dct-identifier.ttl gsrs-skos-altLabel.ttl)
source_files=(gsrs-transformed.ttl AboutIDMPDev-ReferenceIndividuals.ttl)
output_file=gsrs-final.ttl
# Loop through the source files and append their contents to the output file
for file in "${source_files[@]}"; do
Expand Down
42 changes: 22 additions & 20 deletions etc/transformation/GSRS/gsrs-public-data-substances.rqg
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,34 @@ GENERATE {
# Molecular Structure
?MolecularStructure a idmp-sub:MolecularStructure ;
idmp-sub:hasSMILESValue ?structureSmilesString ;
cmns-dsg:isDescribedBy ?MolfileURI;
cmns-dsg:isDescribedBy ?StructureMolfileURI;
.

?MolfileURI a idmp-sub:Molfile;
idmp-sub:hasStructuralRepresentationAttachment ?structureMolfile;
# Molecular Structure Molfile
?StructureMolfileURI a idmp-sub:Molfile;
idmp-sub:hasStructuralRepresentationText ?structureMolfile;
.


GENERATE{
?Substance idmp-sub:hasMoiety ?SubstanceMoiety;
?Substance idmp-sub:hasMoiety ?Moiety;
.

?SubstanceMoiety a idmp-sub:Moiety;
?Moiety a idmp-sub:Moiety;
rdfs:label ?moietyFormula;
idmp-sub:hasDefiningStructure ?MoietyMolecularStructure;
idmp-sub:hasDefiningStructure ?MoietyStructure;
idmp-sub:hasDefiningMolecularWeight ?MoietyStructureMolecularWeight ;
idmp-sub:hasDefiningMolecularFormula ?moietyFormula ;
idmp-sub:hasDefiningStereochemistry ?MoietyStereochemistry ;
.

?MoietyMolecularStructure a idmp-sub:MolecularStructure ;
?MoietyStructure a idmp-sub:MolecularStructure ;
idmp-sub:hasSMILESValue ?MoietyStructureSmilesString ;
cmns-dsg:isDescribedBy ?MoietyStructureMolfile;
cmns-dsg:isDescribedBy ?MoietyStructureMolfileURI;
.

?MoietyStructureMolfileURI a idmp-sub:Molfile;
idmp-sub:hasStructuralRepresentationText ?MoietyStructureMolfile;
.
}
# Molecular Structure Moieties
Expand All @@ -81,10 +86,9 @@ GENERATE {
?MoietyStructureMolecularWeight
?moietyStructureID

BIND(str(StrUUID()) as ?MoietyUUID)
BIND(<https://gsrs.ncats.nih.gov/api/v1/substances/{ ?RelatedSubstanceApprovalID }/{ ?MoietyUUID }> AS ?SubstanceMoiety )

BIND(<https://data.pistoiaalliance.org/idmp/gsrs/structure/{ ?MoietyUUID }> AS ?MoietyMolecularStructure )
BIND(<https://gsrs.ncats.nih.gov/api/v1/substances/{ ?approvalID }/moieties({ ?moietyStructureID })> AS ?Moiety )
BIND(<https://gsrs.ncats.nih.gov/api/v1/substances/{ ?approvalID }/moieties({ ?moietyStructureID })/structure> AS ?MoietyStructure )
BIND(<https://gsrs.ncats.nih.gov/api/v1/substances/{ ?approvalID }/moieties({ ?moietyStructureID })/structure/molfile> AS ?MoietyStructureMolfileURI )

BIND(IF(str(?MoietystructureStereochemistry) = "ABSOLUTE", idmp-sub:Stereochemistry-Absolute ,
IF(str(?MoietystructureStereochemistry) = "ACHIRAL", idmp-sub:Stereochemistry-Achiral ,
Expand Down Expand Up @@ -113,17 +117,17 @@ GENERATE {

GENERATE{
# Relationships
?Substance ?SubstancesRelationshipProperty ?RelatedSubstance;
?Substance ?SubstancesRelationshipProperty ?RelatedSubstance;
.
# Is Active Moiety Of
?RelatedSubstance ?IsActiveMoietyOfProperty ?Substance;
?RelatedSubstance ?IsActiveMoietyOfProperty ?Substance;
.
}
ITERATOR iter:JSONSurfer(?relationships,
ITERATOR iter:JSONSurfer(?relationships,
"$[*]",
"$.type",
"$.relatedSubstance.approvalID"
) AS
) AS
?Relationship
?RelationshipType
?RelatedSubstanceApprovalID
Expand Down Expand Up @@ -173,7 +177,8 @@ ITERATOR iter:JSONSurfer(<public_data.json>,
?relationships

BIND(<https://gsrs.ncats.nih.gov/api/v1/substances/{ ?approvalID }> AS ?Substance )
BIND(<https://data.pistoiaalliance.org/idmp/gsrs/structure/{ ?structureID }> AS ?MolecularStructure )
BIND(<https://gsrs.ncats.nih.gov/api/v1/substances/{ ?approvalID }/structure> AS ?MolecularStructure )
BIND(<https://gsrs.ncats.nih.gov/api/v1/substances/{ ?approvalID }/structure/molfile> AS ?StructureMolfileURI )

BIND(IF(contains(str(?structureFormula), "."), idmp-sub:hasDefiningMolecularFormulaByMoiety , ?nothing ) AS ?hasMolecularFormulaByMoietyProperty)

Expand Down Expand Up @@ -210,6 +215,3 @@ BIND(IF(str(?structureStereochemistry) = "ABSOLUTE", idmp-sub:Stereochemistry-Ab
IF(str(?structureStereochemistry) = "UNKNOWN", idmp-sub:Stereochemistry-Unknown ,
?structureStereochemistry )))))))))))))))))))))
AS ?Stereochemistry)

BIND(IF(?structureMolfile != "",<https://data.pistoiaalliance.org/idmp/gsrs/molfile/{ StrUUID() }>, ?unbound) as ?MolfileURI)

0 comments on commit 0593770

Please sign in to comment.