Search in sources :

Example 21 with Sequence

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

the class SBOLDocument method updateReferences.

// TODO: need to update persistentIdentities too
private void updateReferences(URI originalIdentity, URI newIdentity) throws SBOLValidationException {
    for (TopLevel topLevel : getTopLevels()) {
        for (URI wasDerivedFrom : topLevel.getWasDerivedFroms()) {
            if (wasDerivedFrom.equals(originalIdentity)) {
                topLevel.removeWasDerivedFrom(originalIdentity);
                topLevel.addWasDerivedFrom(newIdentity);
            }
        }
        for (URI wasGeneratedBy : topLevel.getWasGeneratedBys()) {
            if (wasGeneratedBy.equals(originalIdentity)) {
                topLevel.removeWasGeneratedBy(originalIdentity);
                topLevel.addWasGeneratedBy(newIdentity);
            }
        }
        for (URI attachmentURI : topLevel.getAttachmentURIs()) {
            if (attachmentURI.equals(originalIdentity)) {
                topLevel.removeAttachment(originalIdentity);
                topLevel.addAttachment(newIdentity);
            }
        }
    }
    for (Collection collection : getCollections()) {
        for (URI memberURI : collection.getMemberURIs()) {
            if (memberURI.equals(originalIdentity)) {
                collection.removeMember(originalIdentity);
                collection.addMember(newIdentity);
            }
        }
        updateReferences(collection, originalIdentity, newIdentity);
    }
    for (ComponentDefinition componentDefinition : getComponentDefinitions()) {
        updateReferences(componentDefinition, originalIdentity, newIdentity);
        for (Component component : componentDefinition.getComponents()) {
            if (component.getDefinitionURI().equals(originalIdentity)) {
                component.setDefinition(newIdentity);
                for (MapsTo mapsTo : component.getMapsTos()) {
                    ComponentDefinition cd = getComponentDefinition(newIdentity);
                    if (cd != null) {
                        String displayId = URIcompliance.extractDisplayId(mapsTo.getRemoteURI());
                        URI newURI = URIcompliance.createCompliantURI(cd.getPersistentIdentity().toString(), displayId, cd.getVersion());
                        mapsTo.setRemote(newURI);
                    }
                }
            }
            updateReferences(component, originalIdentity, newIdentity);
            for (MapsTo mapsTo : component.getMapsTos()) {
                updateReferences(mapsTo, originalIdentity, newIdentity);
            }
        }
        for (SequenceAnnotation sa : componentDefinition.getSequenceAnnotations()) {
            for (Location loc : sa.getLocations()) {
                updateReferences(loc, originalIdentity, newIdentity);
            }
            updateReferences(sa, originalIdentity, newIdentity);
        }
        for (SequenceConstraint sc : componentDefinition.getSequenceConstraints()) {
            updateReferences(sc, originalIdentity, newIdentity);
        }
        for (URI sequenceURI : componentDefinition.getSequenceURIs()) {
            if (sequenceURI.equals(originalIdentity)) {
                componentDefinition.removeSequence(originalIdentity);
                componentDefinition.addSequence(newIdentity);
            }
        }
    }
    for (ModuleDefinition moduleDefinition : getModuleDefinitions()) {
        updateReferences(moduleDefinition, originalIdentity, newIdentity);
        for (FunctionalComponent functionalComponent : moduleDefinition.getFunctionalComponents()) {
            if (functionalComponent.getDefinitionURI().equals(originalIdentity)) {
                functionalComponent.setDefinition(newIdentity);
                for (MapsTo mapsTo : functionalComponent.getMapsTos()) {
                    ComponentDefinition cd = getComponentDefinition(newIdentity);
                    if (cd != null) {
                        String displayId = URIcompliance.extractDisplayId(mapsTo.getRemoteURI());
                        URI newURI = URIcompliance.createCompliantURI(cd.getPersistentIdentity().toString(), displayId, cd.getVersion());
                        mapsTo.setRemote(newURI);
                    }
                }
            }
            updateReferences(functionalComponent, originalIdentity, newIdentity);
            for (MapsTo mapsTo : functionalComponent.getMapsTos()) {
                updateReferences(mapsTo, originalIdentity, newIdentity);
            }
        }
        for (Module module : moduleDefinition.getModules()) {
            if (module.getDefinitionURI().equals(originalIdentity)) {
                module.setDefinition(newIdentity);
                for (MapsTo mapsTo : module.getMapsTos()) {
                    ModuleDefinition md = getModuleDefinition(newIdentity);
                    if (md != null) {
                        String displayId = URIcompliance.extractDisplayId(mapsTo.getRemoteURI());
                        URI newURI = URIcompliance.createCompliantURI(md.getPersistentIdentity().toString(), displayId, md.getVersion());
                        mapsTo.setRemote(newURI);
                    }
                }
            }
            updateReferences(module, originalIdentity, newIdentity);
            for (MapsTo mapsTo : module.getMapsTos()) {
                updateReferences(mapsTo, originalIdentity, newIdentity);
            }
        }
        for (Interaction interaction : moduleDefinition.getInteractions()) {
            updateReferences(interaction, originalIdentity, newIdentity);
            for (Participation participation : interaction.getParticipations()) {
                updateReferences(participation, originalIdentity, newIdentity);
            }
        }
        for (URI modelURI : moduleDefinition.getModelURIs()) {
            if (modelURI.equals(originalIdentity)) {
                moduleDefinition.removeModel(originalIdentity);
                moduleDefinition.addModel(newIdentity);
            }
        }
    }
    for (Model model : getModels()) {
        updateReferences(model, originalIdentity, newIdentity);
    }
    for (Attachment attachment : getAttachments()) {
        updateReferences(attachment, originalIdentity, newIdentity);
    }
    for (Implementation implementation : getImplementations()) {
        if (implementation.isSetBuilt() && implementation.getBuiltURI().equals(originalIdentity)) {
            implementation.setBuilt(newIdentity);
        }
        updateReferences(implementation, originalIdentity, newIdentity);
    }
    for (Sequence sequence : getSequences()) {
        updateReferences(sequence, originalIdentity, newIdentity);
    }
    for (GenericTopLevel genericTopLevel : getGenericTopLevels()) {
        updateReferences(genericTopLevel, originalIdentity, newIdentity);
    }
    for (CombinatorialDerivation combinatorialDerivation : getCombinatorialDerivations()) {
        updateReferences(combinatorialDerivation, originalIdentity, newIdentity);
        if (combinatorialDerivation.getTemplateURI().equals(originalIdentity)) {
            combinatorialDerivation.setTemplate(newIdentity);
            ComponentDefinition cd = getComponentDefinition(newIdentity);
            if (cd != null) {
                for (VariableComponent variableComponent : combinatorialDerivation.getVariableComponents()) {
                    String displayId = URIcompliance.extractDisplayId(variableComponent.getVariableURI());
                    URI newURI = URIcompliance.createCompliantURI(cd.getPersistentIdentity().toString(), displayId, cd.getVersion());
                    variableComponent.setVariable(newURI);
                }
            }
        }
        for (VariableComponent variableComponent : combinatorialDerivation.getVariableComponents()) {
            updateReferences(variableComponent, originalIdentity, newIdentity);
        }
    }
    for (Activity activity : getActivities()) {
        updateReferences(activity, originalIdentity, newIdentity);
        for (Association association : activity.getAssociations()) {
            if (association.getAgentURI().equals(originalIdentity)) {
                association.setAgent(newIdentity);
            }
            if (association.isSetPlan() && association.getPlanURI().equals(originalIdentity)) {
                association.setPlan(newIdentity);
            }
            updateReferences(association, originalIdentity, newIdentity);
        }
        for (Usage usage : activity.getUsages()) {
            if (usage.getEntityURI().equals(originalIdentity)) {
                usage.setEntity(newIdentity);
            }
            updateReferences(usage, originalIdentity, newIdentity);
        }
    }
    for (Agent agent : getAgents()) {
        updateReferences(agent, originalIdentity, newIdentity);
    }
    for (Plan plan : getPlans()) {
        updateReferences(plan, originalIdentity, newIdentity);
    }
}
Also used : URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI) URI(java.net.URI)

Example 22 with Sequence

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

the class ComponentDefinition method createSequenceConstraint.

/**
 * Creates a child sequence constraint for this component definition with the given arguments,
 * and then adds to this component definition's list of sequence constraints.
 * <p>
 * Creation of a sequence constraint requires URIs of a subject component and an object component.
 * This method creates compliant URIs for them respectively. The subject component compliant URI is created with this
 * component defintion's persistent identity URI, followed by the given subject component's display ID,
 * followed by this component's version. The object component compliant URI is created similarly.
 * This method then calls {@link #createSequenceConstraint(String, RestrictionType, URI, URI)} to create
 * the sequence constraint.
 * <p>
 * This method automatically creates a subject component if all of the following conditions are satisfied:
 * <ul>
 * <li>the associated SBOLDocument, i.e., the SBOLDocument instance hosting this component definition, is not {@code null};</li>
 * <li>if default components should be automatically created when not present for the associated SBOLDocument instance,
 * i.e., {@link SBOLDocument#isCreateDefaults} returns {@code true}; and</li>
 * <li>if this component definition does not already have a component with the created compliant subject component URI.</li>
 * </ul>
 * An object component is automatically created if the similar set of conditions hold.
 *
 * @param displayId the display ID of the sequence constraint to be created
 * @param restriction the structural restriction of the subject and object components
 * @param subjectId the display ID of the subject component
 * @param objectId the display ID of the object component
 * @return the created sequence constraint
 * @throws SBOLValidationException if any of the following condition is satisfied:
 * <ul>
 * <li>if any of the following SBOL validation rules was violated:
 * 10201, 10202, 10204, 10206, 10602, 10604, 10605, 10607, 10803; or</li>
 * <li>an SBOL validation rule violation occurred in {@link #createSequenceConstraint(String, RestrictionType, URI, URI)}.</li>
 * </ul>
 */
public SequenceConstraint createSequenceConstraint(String displayId, RestrictionType restriction, String subjectId, String objectId) throws SBOLValidationException {
    URI subjectURI = URIcompliance.createCompliantURI(this.getPersistentIdentity().toString(), subjectId, this.getVersion());
    if (this.getSBOLDocument() != null && this.getSBOLDocument().isCreateDefaults() && this.getComponent(subjectURI) == null) {
        this.createComponent(subjectId, AccessType.PUBLIC, subjectId, "");
    }
    URI objectURI = URIcompliance.createCompliantURI(this.getPersistentIdentity().toString(), objectId, this.getVersion());
    if (this.getSBOLDocument() != null && this.getSBOLDocument().isCreateDefaults() && this.getComponent(objectURI) == null) {
        this.createComponent(objectId, AccessType.PUBLIC, objectId, "");
    }
    return createSequenceConstraint(displayId, restriction, subjectURI, objectURI);
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 23 with Sequence

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

the class CombinatorialDesignTest method setupDocument.

@Before
public void setupDocument() throws SBOLValidationException {
    doc.setDefaultURIprefix("http://sbols.org/CRISPR_Example/");
    doc.setComplete(true);
    doc.setCreateDefaults(true);
    String version = "1.0.0";
    // Create ComponentDefinition for cas9_generic protein
    doc.createComponentDefinition("cas9_generic", version, ComponentDefinition.PROTEIN);
    // Create ComponentDefinition for gRNA_generic RNA
    doc.createComponentDefinition("gRNA_generic", version, ComponentDefinition.RNA).addRole(SequenceOntology.SGRNA);
    // Create ComponentDefinition for cas9_gRNA_complex
    doc.createComponentDefinition("cas9_gRNA_complex", version, ComponentDefinition.COMPLEX);
    // Create ComponentDefinition for target gene
    doc.createComponentDefinition("target_gene", version, ComponentDefinition.DNA).addRole(SequenceOntology.PROMOTER);
    // Create ComponentDefinition for target protein
    doc.createComponentDefinition("target", version, ComponentDefinition.PROTEIN);
    // Create ModuleDefinition for CRISPR_Repression_Template
    ModuleDefinition CRISPR_Template = doc.createModuleDefinition("CRISPR_Template", version);
    // Complex Formation Interaction for Cas9m_BFP and gRNA
    Interaction Cas9Complex_Formation = CRISPR_Template.createInteraction("cas9_complex_formation", SystemsBiologyOntology.NON_COVALENT_BINDING);
    Cas9Complex_Formation.createParticipation("cas9_generic", "cas9_generic", SystemsBiologyOntology.REACTANT);
    Cas9Complex_Formation.createParticipation("gRNA_generic", "gRNA_generic", SystemsBiologyOntology.REACTANT);
    Cas9Complex_Formation.createParticipation("cas9_gRNA_complex", "cas9_gRNA_complex", SystemsBiologyOntology.PRODUCT);
    // Production of target from target gene
    Interaction EYFP_production = CRISPR_Template.createInteraction("target_production", SystemsBiologyOntology.GENETIC_PRODUCTION);
    EYFP_production.createParticipation("target_gene", "target_gene", SystemsBiologyOntology.PROMOTER);
    EYFP_production.createParticipation("target", "target", SystemsBiologyOntology.PRODUCT);
    // Inhibition of target by cas9m_BFP_gRNA
    Interaction target_generic_gene_inhibition = CRISPR_Template.createInteraction("target_gene_inhibition", SystemsBiologyOntology.INHIBITION);
    target_generic_gene_inhibition.createParticipation("cas9_gRNA_complex", "cas9_gRNA_complex", SystemsBiologyOntology.INHIBITOR);
    target_generic_gene_inhibition.createParticipation("target_gene", "target_gene", SystemsBiologyOntology.PROMOTER);
    // Create Sequence for CRa_U6 promoter
    String CRa_U6_seq_elements = "GGTTTACCGAGCTCTTATTGGTTTTCAAACTTCATTGACTGTGCC" + "AAGGTCGGGCAGGAAGAGGGCCTATTTCCCATGATTCCTTCATAT" + "TTGCATATACGATACAAGGCTGTTAGAGAGATAATTAGAATTAAT" + "TTGACTGTAAACACAAAGATATTAGTACAAAATACGTGACGTAGA" + "AAGTAATAATTTCTTGGGTAGTTTGCAGTTTTAAAATTATGTTTT" + "AAAATGGACTATCATATGCTTACCGTAACTTGAAATATAGAACCG" + "ATCCTCCCATTGGTATATATTATAGAACCGATCCTCCCATTGGCT" + "TGTGGAAAGGACGAAACACCGTACCTCATCAGGAACATGTGTTTA" + "AGAGCTATGCTGGAAACAGCAGAAATAGCAAGTTTAAATAAGGCT" + "AGTCCGTTATCAACTTGAAAAAGTGGCACCGAGTCGGTGCTTTTT" + "TTGGTGCGTTTTTATGCTTGTAGTATTGTATAATGTTTTT";
    doc.createSequence("CRa_U6_seq", version, CRa_U6_seq_elements, Sequence.IUPAC_DNA);
    // Create Sequence for gRNA_b coding sequence
    String gRNA_b_elements = "AAGGTCGGGCAGGAAGAGGGCCTATTTCCCATGATTCCTTCATAT" + "TTGCATATACGATACAAGGCTGTTAGAGAGATAATTAGAATTAAT" + "TTGACTGTAAACACAAAGATATTAGTACAAAATACGTGACGTAGA" + "AAGTAATAATTTCTTGGGTAGTTTGCAGTTTTAAAATTATGTTTT" + "AAAATGGACTATCATATGCTTACCGTAACTTGAAAGTATTTCGAT" + "TTCTTGGCTTTATATATCTTGTGGAAAGGACGAAACACCGTACCT" + "CATCAGGAACATGTGTTTAAGAGCTATGCTGGAAACAGCAGAAAT" + "AGCAAGTTTAAATAAGGCTAGTCCGTTATCAACTTGAAAAAGTGG" + "CACCGAGTCGGTGCTTTTTTT";
    doc.createSequence("gRNA_b_seq", version, gRNA_b_elements, Sequence.IUPAC_DNA);
    // Create Sequence for mKate
    String mKate_seq_elements = "TCTAAGGGCGAAGAGCTGATTAAGGAGAACATGCACATGAAGCTG" + "TACATGGAGGGCACCGTGAACAACCACCACTTCAAGTGCACATCC" + "GAGGGCGAAGGCAAGCCCTACGAGGGCACCCAGACCATGAGAATC" + "AAGGTGGTCGAGGGCGGCCCTCTCCCCTTCGCCTTCGACATCCTG" + "GCTACCAGCTTCATGTACGGCAGCAAAACCTTCATCAACCACACC" + "CAGGGCATCCCCGACTTCTTTAAGCAGTCCTTCCCTGAGGTAAGT" + "GGTCCTACCTCATCAGGAACATGTGTTTTAGAGCTAGAAATAGCA" + "AGTTAAAATAAGGCTAGTCCGTTATCAACTTGAAAAAGTGGCACC" + "GAGTCGGTGCTACTAACTCTCGAGTCTTCTTTTTTTTTTTCACAG" + "GGCTTCACATGGGAGAGAGTCACCACATACGAAGACGGGGGCGTG" + "CTGACCGCTACCCAGGACACCAGCCTCCAGGACGGCTGCCTCATC" + "TACAACGTCAAGATCAGAGGGGTGAACTTCCCATCCAACGGCCCT" + "GTGATGCAGAAGAAAACACTCGGCTGGGAGGCCTCCACCGAGATG" + "CTGTACCCCGCTGACGGCGGCCTGGAAGGCAGAAGCGACATGGCC" + "CTGAAGCTCGTGGGCGGGGGCCACCTGATCTGCAACTTGAAGACC" + "ACATACAGATCCAAGAAACCCGCTAAGAACCTCAAGATGCCCGGC" + "GTCTACTATGTGGACAGAAGACTGGAAAGAATCAAGGAGGCCGAC" + "AAAGAGACCTACGTCGAGCAGCACGAGGTGGCTGTGGCCAGATAC" + "TGCG";
    doc.createSequence("mKate_seq", version, mKate_seq_elements, Sequence.IUPAC_DNA);
    // Create Sequence for CRP_b promoter
    String CRP_b_seq_elements = "GCTCCGAATTTCTCGACAGATCTCATGTGATTACGCCAAGCTACG" + "GGCGGAGTACTGTCCTCCGAGCGGAGTACTGTCCTCCGAGCGGAG" + "TACTGTCCTCCGAGCGGAGTACTGTCCTCCGAGCGGAGTTCTGTC" + "CTCCGAGCGGAGACTCTAGATACCTCATCAGGAACATGTTGGAAT" + "TCTAGGCGTGTACGGTGGGAGGCCTATATAAGCAGAGCTCGTTTA" + "GTGAACCGTCAGATCGCCTCGAGTACCTCATCAGGAACATGTTGG" + "ATCCAATTCGACC";
    doc.createSequence("CRP_b_seq", version, CRP_b_seq_elements, Sequence.IUPAC_DNA);
    // Create ComponentDefinition for a Constitutive Promoter
    doc.createComponentDefinition("pConst", version, ComponentDefinition.DNA).addRole(SequenceOntology.PROMOTER);
    // Create ComponentDefinition for cas9m_BFP coding sequence
    doc.createComponentDefinition("cas9m_BFP_cds", version, ComponentDefinition.DNA).addRole(SequenceOntology.CDS);
    // Create ComponentDefinition for cas9m_BFP gene
    ComponentDefinition cas9m_BFP_gene = doc.createComponentDefinition("cas9m_BFP_gene", version, ComponentDefinition.DNA);
    cas9m_BFP_gene.addRole(SequenceOntology.PROMOTER);
    cas9m_BFP_gene.createSequenceConstraint("cas9m_BFP_gene_constraint", RestrictionType.PRECEDES, "pConst", "cas9m_BFP_cds");
    // Create ComponentDefintion for cas9m_BFP protein
    doc.createComponentDefinition("cas9m_BFP", version, ComponentDefinition.PROTEIN);
    // Create ComponentDefintion for CRa_U6 promoter
    ComponentDefinition CRa_U6 = doc.createComponentDefinition("CRa_U6", version, ComponentDefinition.DNA);
    CRa_U6.addRole(SequenceOntology.PROMOTER);
    CRa_U6.addSequence("CRa_U6_seq");
    // Create ComponentDefintion for gRNA_b coding sequence
    ComponentDefinition gRNA_b_nc = doc.createComponentDefinition("gRNA_b_nc", version, ComponentDefinition.DNA);
    gRNA_b_nc.addRole(SequenceOntology.CDS);
    gRNA_b_nc.addSequence("gRNA_b_seq");
    // Create ComponentDefinition for gRNA_b terminator
    doc.createComponentDefinition("gRNA_b_terminator", version, ComponentDefinition.DNA).addRole(SequenceOntology.TERMINATOR);
    // Create ComponentDefinition for gRNA_b gene
    ComponentDefinition gRNA_b_gene = doc.createComponentDefinition("gRNA_b_gene", version, ComponentDefinition.DNA);
    gRNA_b_gene.addRole(SequenceOntology.PROMOTER);
    gRNA_b_gene.createSequenceConstraint("gRNA_b_gene_constraint1", RestrictionType.PRECEDES, "CRa_U6", "gRNA_b_nc");
    gRNA_b_gene.createSequenceConstraint("gRNA_b_gene_constraint2", RestrictionType.PRECEDES, "gRNA_b_nc", "gRNA_b_terminator");
    // Create ComponentDefinition for gRNA_b RNA
    doc.createComponentDefinition("gRNA_b", version, ComponentDefinition.RNA).addRole(SequenceOntology.SGRNA);
    SequenceOntology so = new SequenceOntology();
    URI sgrna = so.getURIbyName("sgRNA");
    // Create ComponentDefinition for cas9m_BFP gRNA_b complex
    doc.createComponentDefinition("cas9m_BFP_gRNA_b", version, ComponentDefinition.COMPLEX);
    // Create ComponentDefinition for mKate coding sequence
    ComponentDefinition mKate_cds = doc.createComponentDefinition("mKate_cds", version, ComponentDefinition.DNA);
    mKate_cds.addRole(SequenceOntology.CDS);
    mKate_cds.addSequence("mKate_seq");
    // Create ComponentDefinition for mKate gene
    ComponentDefinition mKate_gene = doc.createComponentDefinition("mKate_gene", version, ComponentDefinition.DNA);
    mKate_gene.addRole(SequenceOntology.PROMOTER);
    mKate_gene.createSequenceConstraint("mKate_gene_constraint", RestrictionType.PRECEDES, "pConst", "mKate_cds");
    // Create ComponentDefinition for mKate protein
    doc.createComponentDefinition("mKate", version, ComponentDefinition.PROTEIN);
    // Create ComponentDefinition for Gal4VP16 coding sequence
    ComponentDefinition Gal4VP16_cds = doc.createComponentDefinition("Gal4VP16_cds", version, ComponentDefinition.DNA);
    Gal4VP16_cds.addRole(SequenceOntology.CDS);
    // Create ComponentDefintion for Gal4VP16 gene
    ComponentDefinition Gal4VP16_gene = doc.createComponentDefinition("Gal4VP16_gene", version, ComponentDefinition.DNA);
    Gal4VP16_gene.addRole(SequenceOntology.PROMOTER);
    Gal4VP16_gene.createSequenceConstraint("GAL4VP16_gene_constraint", RestrictionType.PRECEDES, "pConst", "Gal4VP16_cds");
    // Create ComponentDefintion for Gal4VP16 protein
    doc.createComponentDefinition("Gal4VP16", version, ComponentDefinition.PROTEIN);
    // Create ComponentDefinition for CRP_b promoter
    ComponentDefinition CRP_b = doc.createComponentDefinition("CRP_b", version, ComponentDefinition.DNA);
    CRP_b.addRole(SequenceOntology.PROMOTER);
    CRP_b.addSequence("CRP_b_seq");
    // Create ComponentDefintiion for EYFP coding sequence
    ComponentDefinition EYFP_cds = doc.createComponentDefinition("EYFP_cds", version, ComponentDefinition.DNA);
    EYFP_cds.addRole(SequenceOntology.CDS);
    // Create ComponentDefinition for EYFP gene
    ComponentDefinition EYFP_gene = doc.createComponentDefinition("EYFP_gene", version, ComponentDefinition.DNA);
    EYFP_gene.addRole(SequenceOntology.PROMOTER);
    EYFP_gene.createSequenceConstraint("EYFP_gene_constraint", RestrictionType.PRECEDES, "CRP_b", "EYFP_cds");
    // Create ComponentDefintiion for EYFP protein
    doc.createComponentDefinition("EYFP", version, ComponentDefinition.PROTEIN);
    // Create ModuleDefintion for CRISPR Repression
    ModuleDefinition CRPb_circuit = doc.createModuleDefinition("CRPb_characterization_circuit", version);
    // Create the FunctionalComponents for the ModuleDefinition CRISPR_Repression
    CRPb_circuit.createFunctionalComponent("cas9m_BFP", AccessType.PRIVATE, "cas9m_BFP", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("cas9m_BFP_gene", AccessType.PRIVATE, "cas9m_BFP_gene", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("gRNA_b", AccessType.PRIVATE, "gRNA_b", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("gRNA_b_gene", AccessType.PRIVATE, "gRNA_b_gene", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("mKate", AccessType.PRIVATE, "mKate", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("mKate_gene", AccessType.PRIVATE, "mKate_gene", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("Gal4VP16", AccessType.PRIVATE, "Gal4VP16", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("Gal4VP16_gene", AccessType.PRIVATE, "Gal4VP16_gene", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("EYFP", AccessType.PRIVATE, "EYFP", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("EYFP_gene", AccessType.PRIVATE, "EYFP_gene", version, DirectionType.NONE);
    CRPb_circuit.createFunctionalComponent("cas9m_BFP_gRNA_b", AccessType.PRIVATE, "cas9m_BFP_gRNA_b", version, DirectionType.NONE);
    /* Production of mKate from the mKate gene */
    Interaction mKate_production = CRPb_circuit.createInteraction("mKate_production", SystemsBiologyOntology.GENETIC_PRODUCTION);
    mKate_production.createParticipation("mKate", "mKate", SystemsBiologyOntology.PRODUCT);
    mKate_production.createParticipation("mKate_gene", "mKate_gene", SystemsBiologyOntology.PROMOTER);
    // Production of GAL4VP16 from the GAL4VP16 gene
    Interaction GAL4VP16_production = CRPb_circuit.createInteraction("Gal4VP16_production", SystemsBiologyOntology.GENETIC_PRODUCTION);
    GAL4VP16_production.createParticipation("Gal4VP16_gene", "Gal4VP16_gene", SystemsBiologyOntology.PROMOTER);
    GAL4VP16_production.createParticipation("Gal4VP16", "Gal4VP16", SystemsBiologyOntology.PRODUCT);
    // Production of cas9m_BFP from the cas9m_BFP gene
    Interaction cas9m_BFP_production = CRPb_circuit.createInteraction("cas9m_BFP_production", SystemsBiologyOntology.GENETIC_PRODUCTION);
    cas9m_BFP_production.createParticipation("cas9m_BFP_gene", "cas9m_BFP_gene", SystemsBiologyOntology.PROMOTER);
    cas9m_BFP_production.createParticipation("cas9m_BFP", "cas9m_BFP", SystemsBiologyOntology.PRODUCT);
    // Production of gRNA_b from the gRNA_b gene
    Interaction gRNA_b_production = CRPb_circuit.createInteraction("gRNA_b_production", SystemsBiologyOntology.GENETIC_PRODUCTION);
    gRNA_b_production.createParticipation("gRNA_b_gene", "gRNA_b_gene", SystemsBiologyOntology.PROMOTER);
    gRNA_b_production.createParticipation("gRNA_b", "gRNA_b", SystemsBiologyOntology.PRODUCT);
    // Activation of EYFP production by GAL4VP16
    Interaction EYFP_Activation = CRPb_circuit.createInteraction("EYFP_Activation", SystemsBiologyOntology.STIMULATION);
    EYFP_Activation.createParticipation("Gal4VP16", "Gal4VP16", SystemsBiologyOntology.STIMULATOR);
    EYFP_Activation.createParticipation("EYFP_gene", "EYFP_gene", SystemsBiologyOntology.PROMOTER);
    // Degradation of mKate
    Interaction mKate_deg = CRPb_circuit.createInteraction("mKate_deg", SystemsBiologyOntology.DEGRADATION);
    mKate_deg.createParticipation("mKate", "mKate", SystemsBiologyOntology.REACTANT);
    // Degradation of GAL4VP16
    Interaction GAL4VP16_deg = CRPb_circuit.createInteraction("Gal4VP16_deg", SystemsBiologyOntology.DEGRADATION);
    GAL4VP16_deg.createParticipation("Gal4VP16", "Gal4VP16", SystemsBiologyOntology.REACTANT);
    // Degradation of cas9m_BFP
    Interaction cas9m_BFP_deg = CRPb_circuit.createInteraction("cas9m_BFP_deg", SystemsBiologyOntology.DEGRADATION);
    cas9m_BFP_deg.createParticipation("cas9m_BFP", "cas9m_BFP", SystemsBiologyOntology.REACTANT);
    // Degradation of gRNA_b
    Interaction gRNA_b_deg = CRPb_circuit.createInteraction("gRNA_b_deg", SystemsBiologyOntology.DEGRADATION);
    gRNA_b_deg.createParticipation("gRNA_b", "gRNA_b", SystemsBiologyOntology.REACTANT);
    // Degradation of EYFP
    Interaction EYFP_deg = CRPb_circuit.createInteraction("EYFP_deg", SystemsBiologyOntology.DEGRADATION);
    EYFP_deg.createParticipation("EYFP", "EYFP", SystemsBiologyOntology.REACTANT);
    // Degradation of cas9m_BFP_gRNA_b
    Interaction cas9m_BFP_gRNA_b_deg = CRPb_circuit.createInteraction("cas9m_BFP_gRNA_b_deg", SystemsBiologyOntology.DEGRADATION);
    cas9m_BFP_gRNA_b_deg.createParticipation("cas9m_BFP_gRNA_b", "cas9m_BFP_gRNA_b", SystemsBiologyOntology.REACTANT);
    // Create Template Module
    Module Template_Module = CRPb_circuit.createModule("CRISPR_Template", "CRISPR_Template", version);
    // Add MapsTos to Template Module
    Template_Module.createMapsTo("cas9m_BFP_map", RefinementType.USELOCAL, "cas9m_BFP", "cas9_generic");
    Template_Module.createMapsTo("gRNA_b_map", RefinementType.USELOCAL, "gRNA_b", "gRNA_generic");
    Template_Module.createMapsTo("cas9m_BFP_gRNA_map", RefinementType.USELOCAL, "cas9m_BFP_gRNA_b", "cas9_gRNA_complex");
    Template_Module.createMapsTo("EYFP_map", RefinementType.USELOCAL, "EYFP", "target");
    Template_Module.createMapsTo("EYFP_gene_map", RefinementType.USELOCAL, "EYFP_gene", "target_gene");
    // Create CombinatorialDerivations
    CombinatorialDerivation Combinatorial_Derivation = doc.createCombinatorialDerivation("combDev", version, "Gal4VP16", version);
    Combinatorial_Derivation.setStrategy(StrategyType.SAMPLE);
    SBOLValidate.validateSBOL(doc, true, true, true);
    if (SBOLValidate.getNumErrors() > 0) {
        for (String error : SBOLValidate.getErrors()) {
            System.out.println(error);
        }
        fail();
    }
}
Also used : SequenceOntology(org.sbolstandard.core2.SequenceOntology) ModuleDefinition(org.sbolstandard.core2.ModuleDefinition) Interaction(org.sbolstandard.core2.Interaction) Module(org.sbolstandard.core2.Module) URI(java.net.URI) CombinatorialDerivation(org.sbolstandard.core2.CombinatorialDerivation) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition) Before(org.junit.Before)

Example 24 with Sequence

use of org.sbolstandard.core2.Sequence 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;
    }
}
Also used : SequenceAnnotation(org.sbolstandard.core2.SequenceAnnotation) Sequence(org.sbolstandard.core2.Sequence) Component(org.sbolstandard.core2.Component) FunctionalComponent(org.sbolstandard.core2.FunctionalComponent) SBOLValidationException(org.sbolstandard.core2.SBOLValidationException) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 25 with Sequence

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

the class SequenceOutput 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);
    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"));
    SBOLWriter.write(document, (System.out));
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Sequence(org.sbolstandard.core2.Sequence)

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