Search in sources :

Example 6 with Component

use of org.sbolstandard.core2.Component in project libSBOLj by SynBioDex.

the class GettingStartedExample method main.

public static void main(String[] args) throws IOException, SBOLValidationException, SBOLConversionException {
    String prURI = "http://partsregistry.org/";
    String prPrefix = "pr";
    String myersLabURI = "http://www.async.ece.utah.edu/";
    String myersLabPrefix = "myersLab";
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix(prURI);
    document.setTypesInURIs(true);
    document.setComplete(true);
    document.setCreateDefaults(true);
    document.addNamespace(URI.create(prURI), prPrefix);
    document.addNamespace(URI.create(myersLabURI), myersLabPrefix);
    // Creating a Top-level SBOL Data Object
    HashSet<URI> types = new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA, URI.create("http://identifiers.org/chebi/CHEBI:4705")));
    ComponentDefinition TetR_promoter = document.createComponentDefinition("BBa_R0040", types);
    ComponentDefinition LacI_repressor = document.createComponentDefinition("BBa_C0012", types);
    ComponentDefinition pIKELeftCassette = document.createComponentDefinition("pIKELeftCassette", types);
    Sequence seq_187 = document.createSequence("partseq_187", "tccctatcagtgatagagattgacatccctatcagtgatagagatactgagcac", Sequence.IUPAC_DNA);
    String element2 = "atggtgaatgtgaaaccagtaacgttatacgatgtcgcagagtatgccggtgtc" + "tcttatcagaccgtttcccgcgtggtgaaccaggccagccacgtttctgcgaaaacgcggga" + "aaaagtggaagcggcgatggcggagctgaattacattcccaaccgcgtggcacaacaactgg" + "cgggcaaacagtcgttgctgattggcgttgccacctccagtctggccctgcacgcgccgtcg" + "caaattgtcgcggcgattaaatctcgcgccgatcaactgggtgccagcgtggtggtgtcgat" + "ggtagaacgaagcggcgtcgaagcctgtaaagcggcggtgcacaatcttctcgcgcaacgcg" + "tcagtgggctgatcattaactatccgctggatgaccaggatgccattgctgtggaagctgcc" + "tgcactaatgttccggcgttatttcttgatgtctctgaccagacacccatcaacagtattat" + "tttctcccatgaagacggtacgcgactgggcgtggagcatctggtcgcattgggtcaccagc" + "aaatcgcgctgttagcgggcccattaagttctgtctcggcgcgtctgcgtctggctggctgg" + "cataaatatctcactcgcaatcaaattcagccgatagcggaacgggaaggcgactggagtgc" + "catgtccggttttcaacaaaccatgcaaatgctgaatgagggcatcgttcccactgcgatgc" + "tggttgccaacgatcagatggcgctgggcgcaatgcgcgccattaccgagtccgggctgcgc" + "gttggtgcggatatctcggtagtgggatacgacgataccgaagacagctcatgttatatccc" + "gccgttaaccaccatcaaacaggattttcgcctgctggggcaaaccagcgtggaccgcttgc" + "tgcaactctctcagggccaggcggtgaagggcaatcagctgttgcccgtctcactggtgaaa" + "agaaaaaccaccctggcgcccaatacgcaaaccgcctctccccgcgcgttggccgattcatt" + "aatgcagctggcacgacaggtttcccgactggaaagcgggcaggctgcaaacgacgaaaact" + "acgctttagtagcttaataa";
    Sequence seq_153 = document.createSequence("partseq_153", element2, Sequence.IUPAC_DNA);
    // Setting and editing optional fields
    TetR_promoter.setName("p(tetR)");
    LacI_repressor.setName("lacI");
    TetR_promoter.setDescription("TetR repressible promoter");
    LacI_repressor.setDescription("lacI repressor from E. coli (+LVA)");
    if (TetR_promoter.isSetName()) {
        TetR_promoter.unsetName();
    }
    TetR_promoter.setName("p(tetR)");
    TetR_promoter.addRole(SequenceOntology.PROMOTER);
    LacI_repressor.addRole(SequenceOntology.CDS);
    URI TetR_promoter_role2 = URI.create("http://identifiers.org/so/SO:0000613");
    TetR_promoter.addRole(TetR_promoter_role2);
    if (TetR_promoter.containsRole(TetR_promoter_role2)) {
        TetR_promoter.removeRole(TetR_promoter_role2);
    }
    TetR_promoter.clearRoles();
    if (!TetR_promoter.getRoles().isEmpty()) {
        System.out.println("TetR_promoter set is not empty");
    }
    TetR_promoter.setRoles(new HashSet<URI>(Arrays.asList(SequenceOntology.PROMOTER)));
    // Creating and editing references
    TetR_promoter.addSequence(seq_187);
    LacI_repressor.addSequence(seq_153);
    pIKELeftCassette.addSequence(seq_187);
    pIKELeftCassette.clearSequences();
    // Adding the sequence below causes an exception because it cannot be found
    // pIKELeftCassette.addSequence(URI.create("http://partsregistry.org/seq/partseq_154"));
    // Creating Annotations
    TetR_promoter.createAnnotation(new QName(prURI, "experience", prPrefix), URI.create("http://parts.igem.org/Part:BBa_R0040"));
    // Creating Generic TopLevel Object
    GenericTopLevel datasheet = document.createGenericTopLevel("datasheet", "1.0", new QName(myersLabURI, "datasheet", myersLabPrefix));
    datasheet.setName("Datasheet for Custom Parameters");
    datasheet.createAnnotation(new QName(myersLabURI, "characterizationData", myersLabPrefix), URI.create(myersLabURI + "/measurement/Part:BBa_R0040"));
    datasheet.createAnnotation(new QName(myersLabURI, "transcriptionRate", myersLabPrefix), "0.75");
    TetR_promoter.createAnnotation(new QName(myersLabURI, "datasheet", myersLabPrefix), datasheet.getIdentity());
    // Creating and editing Child Objects
    // For pIKELeftCassette, create sequence constraint that says BBa_R0040 precedes BBa_C0012.
    // Note that with CreateDefaults that components get created automatically.
    // The position of the subject Component MUST precede that of the object Component.
    pIKELeftCassette.createSequenceConstraint("pIKELeftCassette_sc", RestrictionType.PRECEDES, TetR_promoter.getDisplayId(), LacI_repressor.getDisplayId());
    if (pIKELeftCassette.getComponent("BBa_R0040") == null) {
        System.out.println("TetR_promoter component is missing");
    }
    if (pIKELeftCassette.getComponent("BBa_C0012") == null) {
        System.out.println("LacI_repressor component is missing");
    }
    // Removing the subject component below causes an exception.
    // pIKELeftCassette.removeComponent(pIKELeftCassette.getComponent("BBa_R0040"));
    // Copying objects
    ComponentDefinition TetR_promoter_copy = (ComponentDefinition) document.createCopy(TetR_promoter, "BBa_K137046");
    Sequence seq = document.createSequence("seq_K137046", "gtgctcagtatctctatcactgatagggatgtcaatctctatcactgatagggactctagtatat" + "aaacgcagaaaggcccacccgaaggtgagccagtgtgactctagtagagagcgttcaccgaca" + "aacaacagataaaacgaaaggc", Sequence.IUPAC_DNA);
    TetR_promoter_copy.addSequence(seq);
    SBOLWriter.write(document, "GettingStartedExample.rdf");
    writeThenRead(document);
}
Also used : QName(javax.xml.namespace.QName) SBOLDocument(org.sbolstandard.core2.SBOLDocument) GenericTopLevel(org.sbolstandard.core2.GenericTopLevel) Sequence(org.sbolstandard.core2.Sequence) URI(java.net.URI) HashSet(java.util.HashSet) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 7 with Component

use of org.sbolstandard.core2.Component in project libSBOLj by SynBioDex.

the class ComponentDefinitionOutput method createComponentDefinitionOutput.

public static SBOLDocument createComponentDefinitionOutput() throws SBOLValidationException {
    String prURI = "http://partsregistry.org/";
    String prPrefix = "pr";
    SBOLDocument document = new SBOLDocument();
    document.setTypesInURIs(true);
    document.addNamespace(URI.create(prURI), prPrefix);
    document.setDefaultURIprefix(prURI);
    Sequence seqpTetR = document.createSequence("BBa_R0040", "", "tccctatcagtgatagagattgacatccctatcagtgatagagatactgagcac", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
    Sequence seqRbs = document.createSequence("BBa_B0034", "", "aaagaggagaaa", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
    Sequence seqCds = document.createSequence("BBa_C0062", "", "atgcttatctgatatgactaaaatggtacattgtgaatattatttactcgcgatcatttatcctcattctatggttaaatctgatatttcaatcctagataattaccctaaaaaatggaggcaatattatgatgacgctaatttaataaaatatgatcctatagtagattattctaactccaatcattcaccaattaattggaatatatttgaaaacaatgctgtaaataaaaaatctccaaatgtaattaaagaagcgaaaacatcaggtcttatcactgggtttagtttccctattcatacggctaacaatggcttcggaatgcttagttttgcacattcagaaaaagacaactatatagatagtttatttttacatgcgtgtatgaacataccattaattgttccttctctagttgataattatcgaaaaataaatatagcaaataataaatcaaacaacgatttaaccaaaagagaaaaagaatgtttagcgtgggcatgcgaaggaaaaagctcttgggatatttcaaaaatattaggttgcagtgagcgtactgtcactttccatttaaccaatgcgcaaatgaaactcaatacaacaaaccgctgccaaagtatttctaaagcaattttaacaggagcaattgattgcccatactttaaaaattaataacactgatagtgctagtgtagatcac", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
    Sequence seqTer = document.createSequence("BBa_B0015", "", "ccaggcatcaaataaaacgaaaggctcagtcgaaagactgggcctttcgttttatctgttgtttgtcggtgaacgctctctactagagtcacactggctcaccttcgggtgggcctttctgcgtttata", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
    Sequence seqPluxR = document.createSequence("BBa_R0062", "", "acctgtaggatcgtacaggtttacgcaagaaaatggtttgttatagtcgaataaa", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
    ComponentDefinition pTetR = document.createComponentDefinition("BBa_R0040", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    pTetR.addRole(SequenceOntology.PROMOTER);
    pTetR.setName("pTetR");
    pTetR.setDescription("TetR repressible promoter");
    pTetR.addSequence(seqpTetR.getIdentity());
    ComponentDefinition rbs = document.createComponentDefinition("BBa_B0034", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    rbs.addRole(SequenceOntology.RIBOSOME_ENTRY_SITE);
    rbs.setName("BBa_B0034");
    rbs.setDescription("RBS based on Elowitz repressilator");
    rbs.addSequence(seqRbs.getIdentity());
    ComponentDefinition cds = document.createComponentDefinition("BBa_C0062", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    cds.addRole(SequenceOntology.CDS);
    cds.setName("luxR");
    cds.setDescription("luxR coding sequence");
    cds.addSequence(seqCds.getIdentity());
    ComponentDefinition ter = document.createComponentDefinition("BBa_B0015", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    ter.addRole(URI.create("http://identifiers.org/so/SO:0000141"));
    ter.setName("BBa_B0015");
    ter.setDescription("Double terminator");
    ter.addSequence(seqTer.getIdentity());
    ComponentDefinition pluxR = document.createComponentDefinition("BBa_R0062", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    // 
    pluxR.addRole(SequenceOntology.PROMOTER);
    pluxR.setName("pLuxR");
    pluxR.setDescription("LuxR inducible promoter");
    pluxR.addSequence(seqPluxR.getIdentity());
    ComponentDefinition device = document.createComponentDefinition("BBa_F2620", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
    // biological region
    device.addRole(URI.create("http://identifiers.org/so/SO:00001411"));
    device.setName("BBa_F2620");
    device.setDescription("3OC6HSL -> PoPS Receiver");
    Component comPtetR = device.createComponent("pTetR", AccessType.PUBLIC, pTetR.getIdentity());
    Component comRbs = device.createComponent("rbs", AccessType.PUBLIC, rbs.getIdentity());
    Component comCds = device.createComponent("luxR", AccessType.PUBLIC, cds.getIdentity());
    Component comTer = device.createComponent("ter", AccessType.PUBLIC, ter.getIdentity());
    Component comPluxR = device.createComponent("pLuxR", AccessType.PUBLIC, pluxR.getIdentity());
    int start = 1;
    int end = seqPluxR.getElements().length();
    SequenceAnnotation anno = device.createSequenceAnnotation("anno1", "location1", start, end, OrientationType.INLINE);
    anno.setComponent(comPtetR.getIdentity());
    start = end + 1;
    end = seqRbs.getElements().length() + end + 1;
    SequenceAnnotation anno2 = device.createSequenceAnnotation("anno2", "location2", start, end, OrientationType.INLINE);
    anno2.setComponent(comRbs.getIdentity());
    start = end + 1;
    end = seqCds.getElements().length() + end + 1;
    SequenceAnnotation anno3 = device.createSequenceAnnotation("anno3", "location3", start, end, OrientationType.INLINE);
    anno3.setComponent(comCds.getIdentity());
    start = end + 1;
    end = seqTer.getElements().length() + end + 1;
    SequenceAnnotation anno4 = device.createSequenceAnnotation("anno4", "location4", start, end, OrientationType.INLINE);
    anno4.setComponent(comTer.getIdentity());
    start = end + 1;
    end = seqPluxR.getElements().length() + end + 1;
    SequenceAnnotation anno5 = device.createSequenceAnnotation("anno5", "location5", start, end, OrientationType.INLINE);
    anno5.setComponent(comPluxR.getIdentity());
    return document;
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) SequenceAnnotation(org.sbolstandard.core2.SequenceAnnotation) Sequence(org.sbolstandard.core2.Sequence) Component(org.sbolstandard.core2.Component) URI(java.net.URI) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 8 with Component

use of org.sbolstandard.core2.Component in project libSBOLj by SynBioDex.

the class Provenance_CodonOptimization method main.

public static void main(String[] args) throws Exception {
    NamespaceBinding myAppNs = NamespaceBinding("http://myapp.com/", "myapp");
    SBOLDocument document = new SBOLDocument();
    document.addNamespace(URI.create(myAppNs.getNamespaceURI()), myAppNs.getPrefix());
    document.setDefaultURIprefix(myAppNs.getNamespaceURI());
    ComponentDefinition optimizedCds = getCds(document, "codon_optimized", "Codon optimised CDS");
    ComponentDefinition sourceCds = getCds(document, "non_codon_optimized", "Non Codon optimised CDS");
    optimizedCds.addWasDerivedFrom(sourceCds.getIdentity());
    // Create the agent definition for the codon optimization software
    Agent agent = document.createAgent("codon_optimization_software");
    agent.setName("Codon Optimization Software");
    // Create the generic top level entity for the codon optimization activity
    Activity activity = document.createActivity("codon_optimization_activity");
    activity.setName("Codon Optimization Activity");
    // Create the qualifiedUsage annotation to describe the use of the non codon optimized CDS component
    activity.createUsage("usage", sourceCds.getIdentity()).addRole(URI.create("http://sbols.org/v2#source"));
    // Create the qualifiedAssociation annotation to describe the use of the software agent used in the activity
    activity.createAssociation("association", agent.getIdentity()).addRole(myAppNs.namespacedUri("codonoptimiser"));
    optimizedCds.addWasGeneratedBy(activity.getIdentity());
    SBOLWriter.write(document, System.out);
}
Also used : Agent(org.sbolstandard.core2.Agent) SBOLDocument(org.sbolstandard.core2.SBOLDocument) Activity(org.sbolstandard.core2.Activity) NamespaceBinding(org.sbolstandard.core.datatree.Datatree.NamespaceBinding) NamespaceBinding(org.sbolstandard.core.datatree.NamespaceBinding) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 9 with Component

use of org.sbolstandard.core2.Component in project libSBOLj by SynBioDex.

the class CombinatorialDerivation method addVariableComponentNoCheck.

/**
 * Adds the given variable component to the list of variable components.
 *
 * @param variableComponent
 */
private void addVariableComponentNoCheck(VariableComponent variableComponent) throws SBOLValidationException {
    variableComponent.setSBOLDocument(this.getSBOLDocument());
    variableComponent.setCombinatorialDerivation(this);
    ComponentDefinition template = this.getTemplate();
    if (template != null) {
        if (template.getComponent(variableComponent.getVariableURI()) == null) {
            throw new SBOLValidationException("sbol-13005", this);
        }
    }
    for (URI cdURI : variableComponent.getVariantDerivationURIs()) {
        if (this.getSBOLDocument() != null && this.getSBOLDocument().isComplete()) {
            CombinatorialDerivation cd = this.getSBOLDocument().getCombinatorialDerivation(cdURI);
            if (cd != null && this.getIdentity().equals(cd.getIdentity())) {
                throw new SBOLValidationException("sbol-13015", variableComponent);
            }
        }
    }
    addChildSafely(variableComponent, variableComponents, "variableComponent");
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 10 with Component

use of org.sbolstandard.core2.Component in project libSBOLj by SynBioDex.

the class SBOLReader method parseSequenceAnnotationV1.

/**
 * @param SBOLDoc
 * @param sequenceAnnotation
 * @param precedePairs
 * @param parentURI
 * @param sa_num
 * @param instantiatedComponents
 * @return
 * @throws SBOLValidationException if either of the following conditions is satisfied:
 * <ul>
 * <li>if an SBOL validation rule violation occurred in any of the following constructors or methods:
 * 	<ul>
 * 		<li>{@link URIcompliance#createCompliantURI(String, String, String)}, </li>
 * 		<li>{@link #parseDnaComponentV1(SBOLDocument, IdentifiableDocument)}, </li>
 * 		<li>{@link Range#Range(URI, int, int)}, </li>
 * 		<li>{@link Range#setDisplayId(String)}, </li>
 * 		<li>{@link Range#setVersion(String)}, </li>
 * 		<li>{@link GenericLocation#GenericLocation(URI)}, </li>
 * 		<li>{@link SequenceAnnotation#SequenceAnnotation(URI, Set)}, </li>
 * 		<li>{@link SequenceAnnotation#setDisplayId(String)}, </li>
 * 		<li>{@link SequenceAnnotation#setVersion(String)}, </li>
 * 		<li>{@link SequenceAnnotation#setWasDerivedFrom(URI)}, </li>
 * 		<li>{@link SequenceAnnotation#setComponent(URI)}, or </li>
 * 		<li>{@link SequenceAnnotation#setAnnotations(List)}; or</li>
 * 	</ul>
 * </li>
 * <li>the following SBOL validation rule was violated: 11002.</li>
 * </ul>
 * @throws SBOLConversionException
 */
private static SequenceAnnotation parseSequenceAnnotationV1(SBOLDocument SBOLDoc, NestedDocument<QName> sequenceAnnotation, List<SBOLPair> precedePairs, String parentURI, int sa_num, Set<String> instantiatedComponents) throws SBOLValidationException, SBOLConversionException {
    Integer start = null;
    Integer end = null;
    String strand = null;
    URI componentURI = null;
    URI identity = sequenceAnnotation.getIdentity();
    String persIdentity = sequenceAnnotation.getIdentity().toString();
    List<Annotation> annotations = new ArrayList<>();
    if (URIPrefix != null) {
        persIdentity = createCompliantURI(parentURI, "annotation" + sa_num, "").toString();
        identity = createCompliantURI(parentURI, "annotation" + sa_num, version);
    }
    if (!sequenceAnnotation.getType().equals(Sbol1Terms.SequenceAnnotations.SequenceAnnotation)) {
        throw new SBOLConversionException("QName has to be" + Sbol1Terms.SequenceAnnotations.SequenceAnnotation.toString());
    }
    for (NamedProperty<QName> namedProperty : sequenceAnnotation.getProperties()) {
        if (namedProperty.getName().equals(Sbol1Terms.SequenceAnnotations.bioStart)) {
            if (!(namedProperty.getValue() instanceof Literal) || start != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof String))) {
                throw new SBOLValidationException("sbol-11102", sequenceAnnotation.getIdentity());
            }
            String temp = ((Literal<QName>) namedProperty.getValue()).getValue().toString();
            start = Integer.parseInt(temp);
        } else if (namedProperty.getName().equals(Sbol1Terms.SequenceAnnotations.bioEnd)) {
            if (!(namedProperty.getValue() instanceof Literal) || end != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof String))) {
                throw new SBOLValidationException("sbol-11103", sequenceAnnotation.getIdentity());
            }
            String temp2 = ((Literal<QName>) namedProperty.getValue()).getValue().toString();
            end = Integer.parseInt(temp2);
        } else if (namedProperty.getName().equals(Sbol1Terms.SequenceAnnotations.strand)) {
            if (!(namedProperty.getValue() instanceof Literal) || strand != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof String))) {
                throw new SBOLValidationException("sbol-11002", sequenceAnnotation.getIdentity());
            }
            strand = ((Literal<QName>) namedProperty.getValue()).getValue().toString();
        } else if (namedProperty.getName().equals(Sbol1Terms.SequenceAnnotations.subComponent)) {
            if (componentURI != null) {
                throw new SBOLValidationException("sbol-10904", sequenceAnnotation.getIdentity());
            }
            if (namedProperty.getValue() instanceof NestedDocument) {
                componentURI = parseDnaComponentV1(SBOLDoc, (NestedDocument<QName>) namedProperty.getValue()).getIdentity();
            } else {
                if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI))) {
                    throw new SBOLValidationException("sbol-10904", sequenceAnnotation.getIdentity());
                }
                componentURI = URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString());
            }
        } else if (namedProperty.getName().equals(Sbol1Terms.SequenceAnnotations.precedes)) {
            URI left = sequenceAnnotation.getIdentity();
            URI right = null;
            if (namedProperty.getValue() instanceof NestedDocument) {
                // TODO: need to check if ++sa_num here okay
                right = parseSequenceAnnotationV1(SBOLDoc, (NestedDocument<QName>) namedProperty.getValue(), precedePairs, parentURI, ++sa_num, instantiatedComponents).getIdentity();
            } else {
                if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI))) {
                    throw new SBOLValidationException("sbol-11404", sequenceAnnotation.getIdentity());
                }
                right = URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString());
            }
            SBOLPair pair = new SBOLPair(left, right);
            precedePairs.add(pair);
        } else {
            annotations.add(new Annotation(namedProperty));
        }
    }
    String componentDisplayId = URIcompliance.extractDisplayId(componentURI);
    String displayId = "annotation" + sa_num;
    if (compliant && componentDisplayId != null && !instantiatedComponents.contains(componentDisplayId)) {
        identity = createCompliantURI(parentURI, componentDisplayId + "_annotation", version);
        persIdentity = createCompliantURI(parentURI, componentDisplayId + "_annotation", "").toString();
        displayId = componentDisplayId + "_annotation";
    }
    // Note: Do not create a seqAnnotation if Location is empty
    Location location = null;
    if (// create SequenceAnnotation & Component
    start != null && end != null) {
        URI range_identity = createCompliantURI(persIdentity, "range", version);
        location = new Range(range_identity, start, end);
        if (!persIdentity.equals("")) {
            location.setPersistentIdentity(createCompliantURI(persIdentity, "range", ""));
            location.setDisplayId("range");
            location.setVersion(version);
        }
        if (strand != null) {
            if (strand.equals("+")) {
                location.setOrientation(OrientationType.INLINE);
            } else if (strand.equals("-")) {
                location.setOrientation(OrientationType.REVERSECOMPLEMENT);
            }
        }
    } else {
        URI dummyGenericLoc_id = createCompliantURI(persIdentity, "genericLocation", version);
        location = new GenericLocation(dummyGenericLoc_id);
        if (!persIdentity.equals("")) {
            location.setPersistentIdentity(createCompliantURI(persIdentity, "genericLocation", ""));
            location.setDisplayId("genericLocation");
            location.setVersion(version);
        }
        if (strand != null) {
            if (strand.equals("+")) {
                location.setOrientation(OrientationType.INLINE);
            } else if (strand.equals("-")) {
                location.setOrientation(OrientationType.REVERSECOMPLEMENT);
            }
        }
    }
    Set<Location> locations = new HashSet<>();
    locations.add(location);
    SequenceAnnotation s = new SequenceAnnotation(identity, locations);
    if (!persIdentity.equals("")) {
        s.setPersistentIdentity(URI.create(persIdentity));
        s.setDisplayId(displayId);
        s.setVersion(version);
    }
    if (identity != sequenceAnnotation.getIdentity())
        s.addWasDerivedFrom(sequenceAnnotation.getIdentity());
    if (componentURI != null)
        s.setComponent(componentURI);
    if (!annotations.isEmpty())
        s.setAnnotations(annotations);
    return s;
}
Also used : StringifyQName(org.sbolstandard.core.io.json.StringifyQName) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI) URI(java.net.URI) NestedDocument(org.sbolstandard.core.datatree.NestedDocument) Literal(org.sbolstandard.core.datatree.Literal) HashSet(java.util.HashSet)

Aggregations

URI (java.net.URI)25 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)22 HashSet (java.util.HashSet)7 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)7 ArrayList (java.util.ArrayList)6 QName (javax.xml.namespace.QName)6 Point (java.awt.Point)5 Component (org.powerbot.script.rt6.Component)5 SBOLDocument (org.sbolstandard.core2.SBOLDocument)5 Condition (org.powerbot.script.Condition)4 Literal (org.sbolstandard.core.datatree.Literal)4 NestedDocument (org.sbolstandard.core.datatree.NestedDocument)4 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)4 Component (org.sbolstandard.core2.Component)4 IdentifiableDocument (org.sbolstandard.core.datatree.IdentifiableDocument)3 FunctionalComponent (org.sbolstandard.core2.FunctionalComponent)3 Sequence (org.sbolstandard.core2.Sequence)3 SequenceAnnotation (org.sbolstandard.core2.SequenceAnnotation)3 Font (java.awt.Font)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2