Search in sources :

Example 26 with Sequence

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));
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Sequence(org.sbolstandard.core2.Sequence) URI(java.net.URI) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 27 with Sequence

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;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 28 with Sequence

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);
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 29 with Sequence

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;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 30 with Sequence

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;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Aggregations

URI (java.net.URI)21 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)15 Sequence (org.sbolstandard.core2.Sequence)9 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)8 SBOLDocument (org.sbolstandard.core2.SBOLDocument)8 QName (javax.xml.namespace.QName)6 HashSet (java.util.HashSet)5 ArrayList (java.util.ArrayList)4 SEQUENCE (org.mozilla.jss.asn1.SEQUENCE)4 BMPString (org.mozilla.jss.asn1.BMPString)3 SET (org.mozilla.jss.asn1.SET)3 Literal (org.sbolstandard.core.datatree.Literal)3 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)3 AMPassword (com.sun.identity.security.keystore.AMPassword)2 MessageDigest (java.security.MessageDigest)2 Test (org.junit.Test)2 ASN1Value (org.mozilla.jss.asn1.ASN1Value)2 OCTET_STRING (org.mozilla.jss.asn1.OCTET_STRING)2 AuthenticatedSafes (org.mozilla.jss.pkcs12.AuthenticatedSafes)2 PFX (org.mozilla.jss.pkcs12.PFX)2