Search in sources :

Example 11 with Activity

use of org.orcid.jaxb.model.record_rc2.Activity in project libSBOLj by SynBioDex.

the class Provenance_SpecifyBuildOperations method specifyAmplifyOperation.

/**
 * specifies the amplify operation, which amplifies a linear DNA construct using
 * 5' and 3' primers
 *
 * @throws Exception
 */
public static void specifyAmplifyOperation() throws Exception {
    // instantiate a document
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix(BUILD_PREFIX);
    // the linear DNA construct
    ComponentDefinition dnaConstruct = document.createComponentDefinition("dna_construct", LINEAR_SINGLE_STRANDED_DNA);
    dnaConstruct.setName("dna_construct");
    // the 5' primer for amplification
    ComponentDefinition fivePrimer = document.createComponentDefinition("five_primer", FORWARD_PRIMER);
    fivePrimer.setName("five_primer");
    // the 3' primer for amplification
    ComponentDefinition threePrimer = document.createComponentDefinition("three_primer", REVERSE_PRIMER);
    threePrimer.setName("three_primer");
    // Create the generic top level entity for the amplify operation
    Activity amplifyOperation = document.createActivity("amplify_" + dnaConstruct.getName() + "_with_" + fivePrimer.getName() + "_and_" + threePrimer.getName());
    amplifyOperation.setName("amplify(" + dnaConstruct.getName() + ", " + fivePrimer.getName() + ", " + threePrimer.getName() + ")");
    // create the qualifiedUsage annotation to describe the inputs of the amplification operation
    // -- the amplicon
    Usage usageDNAConstruct = amplifyOperation.createUsage("dna_construct", dnaConstruct.getIdentity());
    usageDNAConstruct.addRole(URI.create("http://sbols.org/v2#source"));
    usageDNAConstruct.addRole(PCR_PRODUCT);
    // -- the forward primer
    Usage usageFwdPrimer = amplifyOperation.createUsage("forward_primer", fivePrimer.getIdentity());
    usageFwdPrimer.addRole(FORWARD_PRIMER);
    usageFwdPrimer.addRole(FORWARD_PRIMER);
    // -- the reverse primer
    Usage usageRevPrimer = amplifyOperation.createUsage("reverse_primer", threePrimer.getIdentity());
    usageRevPrimer.addRole(REVERSE_PRIMER);
    usageRevPrimer.addRole(REVERSE_PRIMER);
    // the result of the amplification operation
    ComponentDefinition amplified_construct = document.createComponentDefinition("my_amplified_dna", AMPLIFIED_CONSTRUCT);
    amplified_construct.setName("my_amplified_dna");
    amplified_construct.addWasGeneratedBy(amplifyOperation.getIdentity());
    // serialize the document to a file
    SBOLWriter.write(document, System.out);
}
Also used : Usage(org.sbolstandard.core2.Usage) SBOLDocument(org.sbolstandard.core2.SBOLDocument) Activity(org.sbolstandard.core2.Activity) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 12 with Activity

use of org.orcid.jaxb.model.record_rc2.Activity in project libSBOLj by SynBioDex.

the class Provenance_StrainDerivation 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 b168 = getCds(document, "bsubtilis168", "Bacillus subtilis 168");
    ComponentDefinition b3610 = getCds(document, "bsubtilisncimb3610", "Bacillus subtilis NCIMB 3610");
    b168.addWasDerivedFrom(b3610.getIdentity());
    // Create the agent definition to represent X-ray
    Agent agent = document.createAgent("x_ray");
    agent.setName("X-ray");
    // Create the generic top level entity for the X-ray mutagenesis activity
    Activity activity = document.createActivity("xraymutagenesis");
    activity.setName("X-ray mutagenesis");
    // Create the qualifiedUsage annotation to describe the use of the parent strain
    activity.createUsage("usage", b3610.getIdentity()).addRole(URI.create("http://sbols.org/v2#source"));
    // Create the qualifiedAssociation annotation to describe the use of the agent used in the activity
    activity.createAssociation("association", agent.getIdentity()).addRole(myAppNs.namespacedUri("mutagen"));
    b168.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 13 with Activity

use of org.orcid.jaxb.model.record_rc2.Activity 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 14 with Activity

use of org.orcid.jaxb.model.record_rc2.Activity in project ORCID-Source by ORCID.

the class Api2_0_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(ActivitiesContainer actContainerV2) {
    if (actContainerV2 != null) {
        Collection<? extends Activity> activities = actContainerV2.retrieveActivities();
        if (activities != null && !activities.isEmpty()) {
            Iterator<? extends Activity> activitiesIterator = activities.iterator();
            XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
            while (activitiesIterator.hasNext()) {
                Activity activity = activitiesIterator.next();
                if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
                    latest = activity.getLastModifiedDate().getValue();
                }
            }
            actContainerV2.setLastModifiedDate(new LastModifiedDate(latest));
        }
    }
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) Activity(org.orcid.jaxb.model.record_v2.Activity) GroupableActivity(org.orcid.jaxb.model.record_v2.GroupableActivity)

Example 15 with Activity

use of org.orcid.jaxb.model.record_rc2.Activity in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(Group groupRc2) {
    Date latestAct = null;
    Collection<? extends GroupableActivity> activities = groupRc2.getActivities();
    if (activities != null && !activities.isEmpty()) {
        Iterator<? extends GroupableActivity> activitiesIterator = activities.iterator();
        XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
        while (activitiesIterator.hasNext()) {
            GroupableActivity activity = activitiesIterator.next();
            if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
                latest = activity.getLastModifiedDate().getValue();
            }
        }
        latestAct = latest.toGregorianCalendar().getTime();
        groupRc2.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) GroupableActivity(org.orcid.jaxb.model.record_rc2.GroupableActivity) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Aggregations

Activity (org.eclipse.bpmn2.Activity)9 CallActivity (org.eclipse.bpmn2.CallActivity)9 Entry (java.util.Map.Entry)7 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)7 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)7 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)7 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)7 EventDefinition (org.eclipse.bpmn2.EventDefinition)7 FlowElement (org.eclipse.bpmn2.FlowElement)7 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)7 RootElement (org.eclipse.bpmn2.RootElement)7 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)7 TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)7 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)7 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)7 Escalation (org.eclipse.bpmn2.Escalation)6 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)6 Signal (org.eclipse.bpmn2.Signal)6 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)5 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)5