Search in sources :

Example 36 with ComponentDefinition

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

the class ModuleDefinitionOutput method getSequenceLength.

private static int getSequenceLength(SBOLDocument document, ComponentDefinition componentDef) throws Exception {
    if (componentDef.getSequences() != null && componentDef.getSequences().size() > 0) {
        Sequence sequence = componentDef.getSequences().iterator().next();
        return sequence.getElements().length();
    } else {
        int total = 0;
        for (SequenceAnnotation annotation : componentDef.getSequenceAnnotations()) {
            if (annotation.getComponent() != null) {
                Component component = annotation.getComponent();
                ComponentDefinition subComponentDef = component.getDefinition();
                total = total + getSequenceLength(document, subComponentDef);
            } else {
                throw new Exception("Can't get sequence length for an incomplete design");
            }
        }
        return total;
    }
}
Also used : SequenceAnnotation(org.sbolstandard.core2.SequenceAnnotation) Sequence(org.sbolstandard.core2.Sequence) Component(org.sbolstandard.core2.Component) FunctionalComponent(org.sbolstandard.core2.FunctionalComponent) SBOLValidationException(org.sbolstandard.core2.SBOLValidationException) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 37 with ComponentDefinition

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

the class Provenance_SpecifyBuildOperations method specifyCutOperation.

/**
 * specifies to perform a cut operation in order to linearize a vector using a restriction enzyme
 *
 * @throws Exception
 */
public static void specifyCutOperation() throws Exception {
    // instantiate a document
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix(BUILD_PREFIX);
    ComponentDefinition vector = document.createComponentDefinition("vector", VECTOR_PLASMID);
    vector.setName("vector");
    ComponentDefinition enzyme = document.createComponentDefinition("restriction_enzyme", RESTRICTION_ENZYME);
    enzyme.setName("restriction_enzyme");
    // Create the generic top level entity for the cut operation
    Activity activity = document.createActivity("cut_" + vector.getName() + "_with_" + enzyme.getName());
    activity.setName("cut(" + vector.getName() + ", " + enzyme.getName() + ")");
    // Create the qualifiedUsage annotation to describe the inputs of the cut operation
    activity.createUsage("vector", vector.getIdentity()).addRole(VECTOR_PLASMID);
    activity.createUsage("enzyme", enzyme.getIdentity()).addRole(RESTRICTION_ENZYME);
    // the result of the cut operation
    ComponentDefinition linearized_vector = document.createComponentDefinition("linearized_vector", LINEAR_DOUBLE_STRANDED_DNA);
    linearized_vector.setName("linearized_vector");
    linearized_vector.addWasGeneratedBy(activity.getIdentity());
    // serialize the document to a file
    SBOLWriter.write(document, System.out);
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Activity(org.sbolstandard.core2.Activity) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 38 with ComponentDefinition

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

the class SequenceConstraintOutput 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_K174004", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    promoter.addRole(SequenceOntology.PROMOTER);
    promoter.setName("pspac promoter");
    promoter.setDescription("LacI repressible promoter");
    ComponentDefinition constPromoter = document.createComponentDefinition("pspac", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    constPromoter.addRole(SequenceOntology.PROMOTER);
    constPromoter.setName("constitutive promoter");
    constPromoter.setDescription("pspac core promoter region");
    ComponentDefinition operator = document.createComponentDefinition("LacI_operator", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    operator.addRole(SequenceOntology.OPERATOR);
    operator.setName("LacI operator");
    operator.setDescription("LacI binding site");
    Component promoterComponent = promoter.createComponent("promoter", AccessType.PUBLIC, constPromoter.getIdentity());
    Component operatorComponent = promoter.createComponent("operator", AccessType.PUBLIC, operator.getIdentity());
    promoter.createSequenceConstraint("r1", RestrictionType.PRECEDES, promoterComponent.getIdentity(), operatorComponent.getIdentity());
    SBOLWriter.write(document, (System.out));
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Component(org.sbolstandard.core2.Component) URI(java.net.URI) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 39 with ComponentDefinition

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

the class AnnotationOutput method main.

public static void main(String[] args) throws Exception {
    String prURI = "http://partsregistry.org/";
    String prPrefix = "pr";
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix(prURI);
    document.setTypesInURIs(true);
    document.addNamespace(URI.create(prURI), prPrefix);
    ComponentDefinition promoter = document.createComponentDefinition("BBa_J23119", "", new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));
    promoter.addRole(SequenceOntology.PROMOTER);
    promoter.setName("J23119");
    promoter.setDescription("Constitutive promoter");
    promoter.createAnnotation(new QName(prURI, "group", prPrefix), "iGEM2006_Berkeley");
    promoter.createAnnotation(new QName(prURI, "experience", prPrefix), URI.create("http://parts.igem.org/cgi/partsdb/part_info.cgi?part_name=BBa_J23119"));
    Annotation sigmaFactor = new Annotation(QName(prURI, "sigmafactor", prPrefix), "//rnap/prokaryote/ecoli/sigma70");
    Annotation regulation = new Annotation(QName(prURI, "regulation", prPrefix), "//regulation/constitutive");
    promoter.createAnnotation(new QName(prURI, "information", prPrefix), new QName(prURI, "Information", prPrefix), URI.create("http://partsregistry.org/cd/BBa_J23119/information"), new ArrayList<Annotation>(Arrays.asList(sigmaFactor, regulation)));
    SBOLWriter.write(document, (System.out));
}
Also used : QName(javax.xml.namespace.QName) SBOLDocument(org.sbolstandard.core2.SBOLDocument) URI(java.net.URI) Annotation(org.sbolstandard.core2.Annotation) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 40 with ComponentDefinition

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

the class GenericTopLevelOutput method main.

public static void main(String[] args) throws Exception {
    String myAppURI = "http://www.myapp.org/";
    String myAppPrefix = "myapp";
    String prURI = "http://www.partsregistry.org/";
    SBOLDocument document = new SBOLDocument();
    document.addNamespace(URI.create(myAppURI + "/"), myAppPrefix);
    document.setDefaultURIprefix(prURI);
    document.setTypesInURIs(true);
    GenericTopLevel topLevel = document.createGenericTopLevel("datasheet1", "", new QName("http://www.myapp.org", "Datasheet", myAppPrefix));
    topLevel.setName("Datasheet 1");
    topLevel.createAnnotation(new QName(myAppURI, "characterizationData", myAppPrefix), URI.create(myAppURI + "/measurement/1"));
    topLevel.createAnnotation(new QName(myAppURI, "transcriptionRate", myAppPrefix), "1");
    ComponentDefinition promoter = document.createComponentDefinition("BBa_J23119", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    promoter.addRole(SequenceOntology.PROMOTER);
    promoter.setName("J23119");
    promoter.setDescription("Constitutive promoter");
    promoter.createAnnotation(new QName(myAppURI, "datasheet", myAppPrefix), topLevel.getIdentity());
    promoter.addWasDerivedFrom(URI.create("http://www.partsregistry.org/Part:BBa_J23119"));
    SBOLWriter.write(document, (System.out));
}
Also used : QName(javax.xml.namespace.QName) SBOLDocument(org.sbolstandard.core2.SBOLDocument) GenericTopLevel(org.sbolstandard.core2.GenericTopLevel) URI(java.net.URI) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

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