use of org.sbolstandard.core2.Sequence 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.Sequence in project libSBOLj by SynBioDex.
the class SequenceAnnotation method addRange.
/**
* Creates a range with the given arguments and then adds it to this sequence annotation's
* list of locations.
* <p>
* This method first creates a compliant URI for the range to be created.
* It starts with this sequence annotation's persistent identity URI,
* followed by the given display ID, and ends an empty string for version.
*
* @param displayId the display ID for the range to be created
* @param start the start index for the range to be created
* @param end the end index for the range to be created
* @return the created range
* @throws SBOLValidationException if any of the following SBOL validation rules was violated:
* 10201, 10202, 10204, 10206, 11102, 11103, 11104.
*/
public Range addRange(String displayId, int start, int end) throws SBOLValidationException {
URI identity = createCompliantURI(this.getPersistentIdentity().toString(), displayId, this.getVersion());
Range range = new Range(identity, start, end);
range.setPersistentIdentity(createCompliantURI(this.getPersistentIdentity().toString(), displayId, ""));
range.setDisplayId(displayId);
range.setVersion(this.getVersion());
addLocation(range);
return range;
}
use of org.sbolstandard.core2.Sequence 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);
}
use of org.sbolstandard.core2.Sequence in project libSBOLj by SynBioDex.
the class SequenceAnnotation method addGenericLocation.
/**
* Creates a generic location with the given arguments and then adds it to this sequence annotation's
* list of locations.
* <p>
* This method first creates a compliant URI for the generic location to be created.
* It starts with this sequence annotation's persistent identity URI,
* followed by the given display ID, and ends an empty string for version.
*
* @param displayId the display ID for the generic location to be created
* @param orientation the orientation type
* @return the created generic location instance
* @throws SBOLValidationException if any of the following SBOL validation rules was violated:
* 10201, 10202, 10204, 10206.
*/
public GenericLocation addGenericLocation(String displayId, OrientationType orientation) throws SBOLValidationException {
URI identity = createCompliantURI(this.getPersistentIdentity().toString(), displayId, this.getVersion());
GenericLocation genericLocation = new GenericLocation(identity);
genericLocation.setPersistentIdentity(createCompliantURI(this.getPersistentIdentity().toString(), displayId, ""));
genericLocation.setDisplayId(displayId);
genericLocation.setVersion(this.getVersion());
genericLocation.setOrientation(orientation);
addLocation(genericLocation);
return genericLocation;
}
use of org.sbolstandard.core2.Sequence in project libSBOLj by SynBioDex.
the class SequenceAnnotation method addRange.
/**
* Creates a range with the given arguments and then adds it to this sequence annotation's
* list of locations.
* <p>
* This method first creates a compliant URI for the range to be created.
* It starts with this sequence annotation's persistent identity URI,
* followed by the given display ID, and ends an empty string for version.
*
* @param displayId the display ID for the range to be created
* @param start the start index for the range to be created
* @param end the end index for the range to be created
* @param orientation the orientation type
* @return the created range
* @throws SBOLValidationException if any of the following SBOL validation rules was violated:
* 10201, 10202, 10204, 10206, 11102, 11103, 11104.
*/
public Range addRange(String displayId, int start, int end, OrientationType orientation) throws SBOLValidationException {
URI identity = createCompliantURI(this.getPersistentIdentity().toString(), displayId, this.getVersion());
Range range = new Range(identity, start, end);
range.setPersistentIdentity(createCompliantURI(this.getPersistentIdentity().toString(), displayId, ""));
range.setDisplayId(displayId);
range.setVersion(this.getVersion());
range.setOrientation(orientation);
addLocation(range);
return range;
}
Aggregations