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);
}
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"));
}
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));
}
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++;
}
}
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;
}
}
Aggregations