Search in sources :

Example 61 with SBOLDocument

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

the class GenericTopLevelTest method setUp.

@Before
public void setUp() throws Exception {
    String prURI = "http://partsregistry.org";
    doc = new SBOLDocument();
    doc.setDefaultURIprefix(prURI);
    doc.setComplete(true);
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Before(org.junit.Before)

Example 62 with SBOLDocument

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

the class ModuleDefinitionTest method setUp.

@Before
public void setUp() throws Exception {
    doc = new SBOLDocument();
    doc.setDefaultURIprefix("http://sbols.org/CRISPR_Example/");
    doc.setComplete(true);
    doc.setCreateDefaults(true);
    doc.setComplete(true);
    /*add the main ModuleDefinition to the document*/
    geneticToggleSwitch = doc.createModuleDefinition("geneticToggleSwitch");
    /*create MD's for each of the Modules*/
    TetRInverter_MD = doc.createModuleDefinition("TetRInverter_MD");
    LacIInverter_MD = doc.createModuleDefinition("LacIInverter_MD");
    TetRInverter = geneticToggleSwitch.createModule("TetRInverter", "TetRInverter_MD");
    LacIInverter = geneticToggleSwitch.createModule("LacIInverter", "LacIInverter_MD");
    /*create CDs*/
    TetR_CD = doc.createComponentDefinition("TetR_CD", ComponentDefinition.DNA);
    LacI_CD = doc.createComponentDefinition("LacI_CD", ComponentDefinition.DNA);
    doc.createComponentDefinition("TetR_Promoter_CD", ComponentDefinition.DNA);
    doc.createComponentDefinition("TetR_Terminator_CD", ComponentDefinition.DNA);
    doc.createComponentDefinition("TetR_Gene_CD", ComponentDefinition.DNA);
    doc.createComponentDefinition("LacI_Promoter_CD", ComponentDefinition.DNA);
    doc.createComponentDefinition("LacI_Terminator_CD", ComponentDefinition.DNA);
    doc.createComponentDefinition("LacI_Gene_CD", ComponentDefinition.DNA);
    doc.createComponentDefinition("target_gene", ComponentDefinition.DNA);
    TetR_CD.createComponent("gene", AccessType.PUBLIC, "target_gene");
    /*add the corresponding components to the appropriate CD*/
    TetR_CD.createComponent("TetR_promoter", AccessType.PUBLIC, "TetR_Promoter_CD", "");
    TetR_CD.createComponent("TetR_terminator", AccessType.PUBLIC, "TetR_Terminator_CD", "");
    TetR_CD.createComponent("TetR_gene", AccessType.PUBLIC, "TetR_Gene_CD", "");
    LacI_CD.createComponent("LacI_promoter", AccessType.PUBLIC, "LacI_Promoter_CD", "");
    LacI_CD.createComponent("LacI_terminator", AccessType.PUBLIC, "LacI_Terminator_CD", "");
    LacI_CD.createComponent("LacI_gene", AccessType.PUBLIC, "LacI_Gene_CD", "");
    TetR_FC = TetRInverter_MD.createFunctionalComponent("TetR_FC", AccessType.PUBLIC, "TetR_CD", DirectionType.NONE);
    LacI_FC = LacIInverter_MD.createFunctionalComponent("LacI_FC", AccessType.PUBLIC, "LacI_CD", DirectionType.NONE);
    TetRInverter_MD.createFunctionalComponent("TetR_Promoter_FC", AccessType.PUBLIC, "TetR_Promoter_CD", DirectionType.NONE);
    TetRInverter_MD.createFunctionalComponent("TetR_Terminator_FC", AccessType.PUBLIC, "TetR_Terminator_CD", DirectionType.NONE);
    TetRInverter_MD.createFunctionalComponent("TetR_Gene_FC", AccessType.PUBLIC, "TetR_Gene_CD", DirectionType.NONE);
    /*create some Interactions*/
    TetR_promotes_LacI = geneticToggleSwitch.createInteraction("TetR_promotes_LacI", new URI("http://identifiers.org/biomodels.sbo/SBO:0000169"));
    TetR_promotes_LacI.createParticipation("TetR_simulator", "TetR_CD", new URI("http://identifiers.org/biomodels.sbo/SBO:0000459"));
    TetR_promotes_LacI.createParticipation("LacI_product", "LacI_CD", new URI("http://identifiers.org/biomodels.sbo/SBO:0000011"));
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) URI(java.net.URI) Before(org.junit.Before)

Example 63 with SBOLDocument

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

the class ModuleDefinitionTest method test_moduleDefinitionDeepCopy.

@Test
public void test_moduleDefinitionDeepCopy() throws SBOLValidationException {
    SBOLDocument doc_copy = new SBOLDocument();
    doc_copy.setDefaultURIprefix("http://sbols.org/CRISPR_Example/");
    doc_copy.setComplete(false);
    doc_copy.setCreateDefaults(true);
    doc_copy.createCopy(geneticToggleSwitch);
    ModuleDefinition TetRInverter_copy = doc_copy.getModuleDefinition("geneticToggleSwitch", "");
    assertTrue(TetRInverter_copy.getModule("TetRInverter").equals(TetRInverter));
    assertTrue(doc_copy.createRecursiveCopy(geneticToggleSwitch).equals(doc));
}
Also used : ModuleDefinition(org.sbolstandard.core2.ModuleDefinition) SBOLDocument(org.sbolstandard.core2.SBOLDocument) Test(org.junit.Test)

Example 64 with SBOLDocument

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

the class ModuleDefinitionOutput method addSubComponents.

private static void addSubComponents(SBOLDocument document, ComponentDefinition componentDef, List<ComponentDefinition> subComponents) throws Exception {
    int i = 1;
    int start = 0;
    int end = 0;
    for (ComponentDefinition subComponent : subComponents) {
        Component component = componentDef.createComponent(subComponent.getDisplayId(), AccessType.PUBLIC, subComponent.getIdentity());
        start = end + 1;
        end = start + getSequenceLength(document, subComponent);
        SequenceAnnotation annotation = componentDef.createSequenceAnnotation("anno" + i, "location" + i, start, end, OrientationType.INLINE);
        annotation.setComponent(component.getIdentity());
        i++;
    }
}
Also used : SequenceAnnotation(org.sbolstandard.core2.SequenceAnnotation) Component(org.sbolstandard.core2.Component) FunctionalComponent(org.sbolstandard.core2.FunctionalComponent) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 65 with SBOLDocument

use of org.sbolstandard.core2.SBOLDocument 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)

Aggregations

SBOLDocument (org.sbolstandard.core2.SBOLDocument)44 URI (java.net.URI)39 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)27 QName (javax.xml.namespace.QName)26 ArrayList (java.util.ArrayList)23 HashSet (java.util.HashSet)23 Literal (org.sbolstandard.core.datatree.Literal)22 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)22 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)20 Before (org.junit.Before)17 IdentifiableDocument (org.sbolstandard.core.datatree.IdentifiableDocument)17 NestedDocument (org.sbolstandard.core.datatree.NestedDocument)11 Sequence (org.sbolstandard.core2.Sequence)8 ModuleDefinition (org.sbolstandard.core2.ModuleDefinition)7 FunctionalComponent (org.sbolstandard.core2.FunctionalComponent)6 Activity (org.sbolstandard.core2.Activity)5 Component (org.sbolstandard.core2.Component)4 GenericTopLevel (org.sbolstandard.core2.GenericTopLevel)3 Interaction (org.sbolstandard.core2.Interaction)3 Module (org.sbolstandard.core2.Module)3