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