Search in sources :

Example 41 with ComponentDefinition

use of org.sbolstandard.core2.ComponentDefinition in project libSBOLj by SynBioDex.

the class MapsToExample method main.

public static void main(String[] args) throws URISyntaxException, SBOLValidationException {
    SBOLDocument doc = new SBOLDocument();
    doc.setDefaultURIprefix("http://sbols.org/MapsToExample/");
    doc.setComplete(true);
    doc.setCreateDefaults(true);
    String version = "";
    ModuleDefinition md1 = doc.createModuleDefinition("md1", version);
    ComponentDefinition fc1_def = doc.createComponentDefinition("fc1_def", version, ComponentDefinition.DNA);
    ComponentDefinition fc2_def = doc.createComponentDefinition("fc2_def", version, ComponentDefinition.DNA);
    FunctionalComponent fc1 = md1.createFunctionalComponent("fc1", AccessType.PUBLIC, "fc1_def", version, DirectionType.NONE);
    FunctionalComponent fc2 = md1.createFunctionalComponent("fc2", AccessType.PUBLIC, "fc2_def", version, DirectionType.NONE);
    ComponentDefinition cd = doc.createComponentDefinition("cd", version, ComponentDefinition.DNA);
    fc1_def.createComponent("component", AccessType.PUBLIC, "cd");
    fc1.createMapsTo("mapsTo", RefinementType.USELOCAL, "fc2", "component");
    SBOLValidate.validateSBOL(doc, true, true, true);
    if (SBOLValidate.getNumErrors() > 0) {
        for (String error : SBOLValidate.getErrors()) {
            System.out.println(error);
        }
        return;
    }
}
Also used : ModuleDefinition(org.sbolstandard.core2.ModuleDefinition) SBOLDocument(org.sbolstandard.core2.SBOLDocument) FunctionalComponent(org.sbolstandard.core2.FunctionalComponent) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 42 with ComponentDefinition

use of org.sbolstandard.core2.ComponentDefinition in project libSBOLj by SynBioDex.

the class Provenance_StrainDerivation method getCds.

private static ComponentDefinition getCds(SBOLDocument document, String id, String name) throws SBOLValidationException {
    ComponentDefinition cds = document.createComponentDefinition(id, ComponentDefinition.DNA);
    cds.addRole(SequenceOntology.CDS);
    cds.setName(name);
    return cds;
}
Also used : ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 43 with ComponentDefinition

use of org.sbolstandard.core2.ComponentDefinition in project libSBOLj by SynBioDex.

the class CutExample method main.

public static void main(String[] args) throws Exception {
    String prURI = "http://partsregistry.org/";
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix(prURI);
    document.setTypesInURIs(true);
    ComponentDefinition promoter = document.createComponentDefinition("BBa_J23119", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    promoter.addRole(SequenceOntology.PROMOTER);
    promoter.addRole(URI.create("http://identifiers.org/so/SO:0000613"));
    promoter.setName("J23119 promoter");
    promoter.setDescription("Constitutive promoter");
    promoter.addWasDerivedFrom(URI.create("http://partsregistry.org/Part:BBa_J23119"));
    document.setDefaultURIprefix(prURI);
    Sequence seq = document.createSequence("BBa_J23119", "", "ttgacagctagctcagtcctaggtataatgctagc", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
    seq.addWasDerivedFrom(URI.create("http://parts.igem.org/Part:BBa_J23119:Design"));
    promoter.addSequence(seq.getIdentity());
    promoter.createSequenceAnnotation("cutat10", "cut1", 10, OrientationType.INLINE);
    promoter.createSequenceAnnotation("cutat12", "cut2", 12, OrientationType.INLINE);
    SBOLWriter.write(document, (System.out));
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Sequence(org.sbolstandard.core2.Sequence) URI(java.net.URI) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 44 with ComponentDefinition

use of org.sbolstandard.core2.ComponentDefinition in project libSBOLj by SynBioDex.

the class SequenceAnnotation method setComponent.

/**
 * Sets this sequence annotation's reference component (its identity URI) to the one matching
 * the given display ID.
 * <p>
 * This method first creates a compliant URI for the reference component. It starts with this sequence
 * annotation's parent component defintion's persistent identity URI, followed by the given display ID,
 * and ends with this sequence annotation's parent component defintion's version.
 *
 * @param displayId the given display ID for the reference component
 * @throws SBOLValidationException if either of the following conditions is satisfied:
 * <ul>
 * <li>either of the following SBOL validation rules was violated: 10204, 10206; or</li>
 * <li>if an SBOL validation rule violation occurred in any of the following constructors or methods:
 * 	<ul>
 * 		<li>{@link ComponentDefinition#createComponent(String, AccessType, String, String)}, or</li>
 * 		<li>{@link #setComponent(URI)}.</li>
 * 	</ul>
 * </li>
 * </ul>
 */
public void setComponent(String displayId) throws SBOLValidationException {
    URI componentURI = URIcompliance.createCompliantURI(componentDefinition.getPersistentIdentity().toString(), displayId, componentDefinition.getVersion());
    if (this.getSBOLDocument() != null && this.getSBOLDocument().isCreateDefaults() && componentDefinition != null && componentDefinition.getComponent(componentURI) == null) {
        componentDefinition.createComponent(displayId, AccessType.PUBLIC, displayId, "");
    }
    setComponent(componentURI);
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Aggregations

URI (java.net.URI)30 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)23 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)18 SBOLDocument (org.sbolstandard.core2.SBOLDocument)15 QName (javax.xml.namespace.QName)12 HashSet (java.util.HashSet)9 ArrayList (java.util.ArrayList)7 IdentifiableDocument (org.sbolstandard.core.datatree.IdentifiableDocument)7 Literal (org.sbolstandard.core.datatree.Literal)7 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)7 Sequence (org.sbolstandard.core2.Sequence)7 NestedDocument (org.sbolstandard.core.datatree.NestedDocument)5 Activity (org.sbolstandard.core2.Activity)5 FunctionalComponent (org.sbolstandard.core2.FunctionalComponent)5 Component (org.sbolstandard.core2.Component)4 ModuleDefinition (org.sbolstandard.core2.ModuleDefinition)4 GenericTopLevel (org.sbolstandard.core2.GenericTopLevel)3 Interaction (org.sbolstandard.core2.Interaction)3 Module (org.sbolstandard.core2.Module)3 SequenceAnnotation (org.sbolstandard.core2.SequenceAnnotation)3