R6 Ballot (2nd Draft)

Publish-box (todo)

Moleculardefinition.shex

Clinical Genomics Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No defined compartments

Raw ShEx

ShEx statement for moleculardefinition

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <code.shex>
IMPORT <Range.shex>
IMPORT <string.shex>
IMPORT <integer.shex>
IMPORT <boolean.shex>
IMPORT <Quantity.shex>
IMPORT <markdown.shex>
IMPORT <Reference.shex>
IMPORT <Identifier.shex>
IMPORT <Attachment.shex>
IMPORT <DomainResource.shex>
IMPORT <BackboneElement.shex>
IMPORT <CodeableConcept.shex>


start=@<MolecularDefinition> AND {fhir:nodeRole [fhir:treeRoot]}

# Representation of a molecular definition
<MolecularDefinition> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:MolecularDefinition]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:identifier @<OneOrMore_Identifier>?;  # Unique ID for this particular 
                                            # resource 
    fhir:type @<code> AND
    	{fhir:v @fhirvs:sequence-type}?;  # aa | dna | rna
    fhir:location @<OneOrMore_MolecularDefinition.location>?;  # Location of this molecule
    fhir:memberState @<OneOrMore_Reference_MolecularDefinition>?;  # Member
    fhir:representation @<OneOrMore_MolecularDefinition.representation>?;  # Representation
}  

# Location in context of a feature
<MolecularDefinition.location.featureLocation> EXTENDS @<BackboneElement> CLOSED {   
    fhir:geneId @<OneOrMore_CodeableConcept>?;  # Gene Id
}  

# A Molecular Definition that is represented as an ordered series of edits on a specified starting sequence
<MolecularDefinition.representation.relative> EXTENDS @<BackboneElement> CLOSED {   
    fhir:startingMolecule @<Reference> AND {fhir:link 
    			@<MolecularDefinition> ? };  # The Molecular Sequence that serves 
                                            # as the starting sequence, on which 
                                            # edits will be applied 
    fhir:edit @<OneOrMore_MolecularDefinition.representation.relative.edit>?;  # An edit (change) made to a sequence
}  

# A Molecular Sequence that is represented as a repeated sequence motif
<MolecularDefinition.representation.repeated> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequenceMotif @<Reference> AND {fhir:link 
    			@<MolecularDefinition> ? };  # The sequence that defines the 
                                            # repeated motif 
    fhir:copyCount @<integer>;              # The number of repeats (copies) of 
                                            # the sequence motif 
}  

# Cytoband Interval
<MolecularDefinition.location.cytobandLocation.cytobandInterval> EXTENDS @<BackboneElement> CLOSED {   
    fhir:chromosome @<CodeableConcept>;     # Chromosome
    fhir:startCytoband @<MolecularDefinition.location.cytobandLocation.cytobandInterval.startCytoband>?;  # Start
    fhir:endCytoband @<MolecularDefinition.location.cytobandLocation.cytobandInterval.endCytoband>?;  # End
}  

# Start
<MolecularDefinition.location.cytobandLocation.cytobandInterval.startCytoband> EXTENDS @<BackboneElement> CLOSED {   
    fhir:arm @<code>  OR 
    			@<string>  ?;  # Arm
    fhir:region @<code>  OR 
    			@<string>  ?;  # Region
    fhir:band @<code>  OR 
    			@<string>  ?;  # Band
    fhir:subBand @<code>  OR 
    			@<string>  ?;  # Sub-band
}  

# Location of this molecule
<MolecularDefinition.location> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequenceLocation @<MolecularDefinition.location.sequenceLocation>?;  # Location of this molecule in 
                                            # context of a sequence 
    fhir:cytobandLocation @<MolecularDefinition.location.cytobandLocation>?;  # Location of this molecule in 
                                            # context of a cytoband 
    fhir:featureLocation @<OneOrMore_MolecularDefinition.location.featureLocation>?;  # Location in context of a feature
}  

# Location of this molecule in context of a cytoband
<MolecularDefinition.location.cytobandLocation> EXTENDS @<BackboneElement> CLOSED {   
    fhir:genomeAssembly @<MolecularDefinition.location.cytobandLocation.genomeAssembly>;  # Reference Genome
    fhir:cytobandInterval @<MolecularDefinition.location.cytobandLocation.cytobandInterval>;  # Cytoband Interval
}  

# End
<MolecularDefinition.location.cytobandLocation.cytobandInterval.endCytoband> EXTENDS @<BackboneElement> CLOSED {   
    fhir:arm @<code>  OR 
    			@<string>  ?;  # Arm
    fhir:region @<code>  OR 
    			@<string>  ?;  # Region
    fhir:band @<code>  OR 
    			@<string>  ?;  # Band
    fhir:subBand @<code>  OR 
    			@<string>  ?;  # SuBand
}  

# One element of a concatenated Molecular Sequence
<MolecularDefinition.representation.concatenated.sequenceElement> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<Reference> AND {fhir:link 
    			@<MolecularDefinition> ? };  # The Molecular Sequence 
                                            # corresponding to this element 
    fhir:ordinalIndex @<integer>;           # The ordinal position of this 
                                            # sequence element within the 
                                            # concatenated Molecular Sequence 
}  

# A Molecular Sequence that is represented as an ordered concatenation of two or more Molecular Sequences
<MolecularDefinition.representation.concatenated> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequenceElement @<OneOrMore_MolecularDefinition.representation.concatenated.sequenceElement>;  # One element of a concatenated 
                                            # Molecular Sequence 
}  

# Coordinate Interval for this location
<MolecularDefinition.location.sequenceLocation.coordinateInterval> EXTENDS @<BackboneElement> CLOSED {   
    fhir:numberingSystem @<CodeableConcept>?;  # Coordinate System
    fhir:start @<Quantity>  OR 
    			@<Range>  ?;  # Start
    fhir:end @<Quantity>  OR 
    			@<Range>  ?;  # End
}  

# A literal representation
<MolecularDefinition.representation.literal> EXTENDS @<BackboneElement> CLOSED {   
    fhir:encoding @<CodeableConcept>?;      # The encoding used for the 
                                            # expression of the primary sequence 
    fhir:value @<string>;                   # The primary (linear) sequence, 
                                            # expressed as a literal string 
}  

# Location of this molecule in context of a sequence
<MolecularDefinition.location.sequenceLocation> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequenceContext @<Reference> AND {fhir:link 
    			@<MolecularDefinition> ? };  # Reference sequence
    fhir:coordinateInterval @<MolecularDefinition.location.sequenceLocation.coordinateInterval>?;  # Coordinate Interval for this 
                                            # location 
    fhir:strand @<CodeableConcept>?;        # Forward or Reverse
}  

# Representation
<MolecularDefinition.representation> EXTENDS @<BackboneElement> CLOSED {   
    fhir:focus @<CodeableConcept>?;         # The focus of the representation
    fhir:code @<OneOrMore_CodeableConcept>?;  # A code of the representation
    fhir:literal @<MolecularDefinition.representation.literal>?;  # A literal representation
    fhir:resolvable @<Attachment>?;         # A resolvable representation of a 
                                            # molecule that optionally contains 
                                            # formatting in addition to the 
                                            # specification of the primary 
                                            # sequence itself 
    fhir:extracted @<MolecularDefinition.representation.extracted>?;  # A Molecular Sequence that is 
                                            # represented as an extracted 
                                            # portion of a different Molecular 
                                            # Sequence 
    fhir:repeated @<MolecularDefinition.representation.repeated>?;  # A Molecular Sequence that is 
                                            # represented as a repeated sequence 
                                            # motif 
    fhir:concatenated @<MolecularDefinition.representation.concatenated>?;  # A Molecular Sequence that is 
                                            # represented as an ordered 
                                            # concatenation of two or more 
                                            # Molecular Sequences 
    fhir:relative @<MolecularDefinition.representation.relative>?;  # A Molecular Definition that is 
                                            # represented as an ordered series 
                                            # of edits on a specified starting 
                                            # sequence 
}  

# A Molecular Sequence that is represented as an extracted portion of a different Molecular Sequence
<MolecularDefinition.representation.extracted> EXTENDS @<BackboneElement> CLOSED {   
    fhir:startingMolecule @<Reference> AND {fhir:link 
    			@<MolecularDefinition> ? };  # The Molecular Sequence that serves 
                                            # as the parent sequence, from which 
                                            # the intended sequence will be 
                                            # extracted 
    fhir:start @<integer>;                  # The start coordinate (on the 
                                            # parent sequence) of the interval 
                                            # that defines the subsequence to be 
                                            # extracted 
    fhir:end @<integer>;                    # The end coordinate (on the parent 
                                            # sequence) of the interval that 
                                            # defines the subsequence to be 
                                            # extracted 
    fhir:coordinateSystem @<CodeableConcept>;  # The coordinate system used to 
                                            # define the interval that defines 
                                            # the subsequence to be extracted. 
                                            # Coordinate systems are usually 0- 
                                            # or 1-based 
    fhir:reverseComplement @<boolean>?;     # A flag that indicates whether the 
                                            # extracted sequence should be 
                                            # reverse complemented 
}  

# An edit (change) made to a sequence
<MolecularDefinition.representation.relative.edit> EXTENDS @<BackboneElement> CLOSED {   
    fhir:editOrder @<integer>?;             # The order of this edit, relative 
                                            # to other edits on the starting 
                                            # sequence 
    fhir:coordinateSystem @<CodeableConcept>;  # The coordinate system used to 
                                            # define the edited intervals on the 
                                            # starting sequence. Coordinate 
                                            # systems are usually 0- or 1-based 
    fhir:start @<integer>;                  # The start coordinate of the 
                                            # interval that will be edited 
    fhir:end @<integer>;                    # The end coordinate of the interval 
                                            # that will be edited 
    fhir:replacementMolecule @<Reference> AND {fhir:link 
    			@<MolecularDefinition> ? };  # The sequence that defines the 
                                            # replacement sequence used in the 
                                            # edit operation 
    fhir:replacedMolecule @<Reference> AND {fhir:link 
    			@<MolecularDefinition> ? }?;  # The sequence on the 'starting' 
                                            # sequence for the edit operation, 
                                            # defined by the specified interval, 
                                            # that will be replaced during the 
                                            # edit 
}  

# Reference Genome
<MolecularDefinition.location.cytobandLocation.genomeAssembly> EXTENDS @<BackboneElement> CLOSED {   
    fhir:organism @<CodeableConcept>?;      # Species of the organism
    fhir:build @<CodeableConcept>?;         # Build number
    fhir:accession @<CodeableConcept>?;     # Accession
    fhir:description @<markdown>  OR 
    			@<string>  ?;  # Genome assemble description
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

<OneOrMore_MolecularDefinition.location> CLOSED {
    rdf:first @<MolecularDefinition.location>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MolecularDefinition.location> 
}

<OneOrMore_Reference_MolecularDefinition> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<MolecularDefinition> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_MolecularDefinition> 
}

<OneOrMore_MolecularDefinition.representation> CLOSED {
    rdf:first @<MolecularDefinition.representation>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MolecularDefinition.representation> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

<OneOrMore_MolecularDefinition.representation.relative.edit> CLOSED {
    rdf:first @<MolecularDefinition.representation.relative.edit>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MolecularDefinition.representation.relative.edit> 
}

<OneOrMore_MolecularDefinition.location.featureLocation> CLOSED {
    rdf:first @<MolecularDefinition.location.featureLocation>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MolecularDefinition.location.featureLocation> 
}

<OneOrMore_MolecularDefinition.representation.concatenated.sequenceElement> CLOSED {
    rdf:first @<MolecularDefinition.representation.concatenated.sequenceElement>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MolecularDefinition.representation.concatenated.sequenceElement> 
}

#---------------------- Value Sets ------------------------

# Type if a sequence -- DNA, RNA, or amino acid sequence.
fhirvs:sequence-type ["aa" "dna" "rna"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.