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