Search in sources :

Example 76 with SBOLDocument

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

the class RangeTest method setUp.

@Before
public void setUp() throws Exception {
    String prURI = "http://partsregistry.org";
    doc = new SBOLDocument();
    doc.setDefaultURIprefix(prURI);
    doc.setTypesInURIs(false);
    doc.setComplete(true);
    /*create CD's for main CD and sub-components*/
    gRNA_b_gene = doc.createComponentDefinition("gRNA_b_gene", "", ComponentDefinition.DNA);
    gene_SA = gRNA_b_gene.createSequenceAnnotation("gene_SA", "cutAt50");
    /*create SequenceAnnotations*/
    gene_range = gene_SA.addRange("gene_range", 50, 99);
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Before(org.junit.Before)

Example 77 with SBOLDocument

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

the class Provenance_StrainDerivation method getCds.

private static ComponentDefinition getCds(SBOLDocument document, String id, String name) throws SBOLValidationException {
    ComponentDefinition cds = document.createComponentDefinition(id, ComponentDefinition.DNA);
    cds.addRole(SequenceOntology.CDS);
    cds.setName(name);
    return cds;
}
Also used : ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 78 with SBOLDocument

use of org.sbolstandard.core2.SBOLDocument 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 79 with SBOLDocument

use of org.sbolstandard.core2.SBOLDocument in project ice by JBEI.

the class SBOL2Formatter method format.

@Override
public void format(Sequence sequence, OutputStream outputStream) throws IOException {
    SBOLDocument doc = new SBOLDocument();
    try {
        SBOL2Visitor visitor = new SBOL2Visitor(doc);
        visitor.visit(sequence);
        doc.write(outputStream);
    } catch (SBOLValidationException | SBOLConversionException | URISyntaxException e) {
        throw new IOException(e);
    }
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) SBOLConversionException(org.sbolstandard.core2.SBOLConversionException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) SBOLValidationException(org.sbolstandard.core2.SBOLValidationException)

Example 80 with SBOLDocument

use of org.sbolstandard.core2.SBOLDocument in project ice by JBEI.

the class SBOLParser method createICEModuleDefinitionRecord.

protected void createICEModuleDefinitionRecord(SBOLDocument document, ModuleDefinition moduleDefinition) throws SBOLValidationException {
    SBOLDocument rootedDocument = document.createRecursiveCopy(moduleDefinition);
    Logger.debug("Creating ICE record for ModuleDefinition: " + moduleDefinition.getIdentity());
    String identity = moduleDefinition.getIdentity().toString();
    Long partId = identityEntryMap.get(identity);
    if (partId == null) {
        Logger.debug("Creating " + moduleDefinition.getDisplayId());
        createNewEntry(moduleDefinition, rootedDocument);
    }
    for (FunctionalComponent functionalComponent : moduleDefinition.getFunctionalComponents()) {
        ComponentDefinition componentDefinition = functionalComponent.getDefinition();
        // Note: record may not exist yet, so you might need to create it now too
        if (componentDefinition == null)
            continue;
        Long componentId = identityEntryMap.get(componentDefinition.getIdentity().toString());
        if (componentId == null) {
            SBOLDocument sbolDocument = document.createRecursiveCopy(componentDefinition);
            componentId = createNewEntry(componentDefinition, sbolDocument);
        }
        EntryLinks links = new EntryLinks(userId, componentId.toString());
        links.addLink(this.partData, LinkType.PARENT);
    }
    // Note: record may not exist yet, so you might need to create it now too
    for (Module module : moduleDefinition.getModules()) {
        if (module.getDefinition() == null)
            continue;
        Long moduleId = identityEntryMap.get(module.getDefinition().getIdentity().toString());
        if (moduleId == null) {
            SBOLDocument moduleDocument = document.createRecursiveCopy(module.getDefinition());
            moduleId = createNewEntry(module.getDefinition(), moduleDocument);
        }
        EntryLinks links = new EntryLinks(userId, moduleId.toString());
        links.addLink(this.partData, LinkType.PARENT);
        Logger.debug("    Link to ModuleDefinition: " + module.getDefinition().getIdentity());
    }
}
Also used : EntryLinks(org.jbei.ice.lib.entry.EntryLinks) Module(org.sbolstandard.core2.Module)

Aggregations

SBOLDocument (org.sbolstandard.core2.SBOLDocument)44 URI (java.net.URI)39 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)27 QName (javax.xml.namespace.QName)26 ArrayList (java.util.ArrayList)23 HashSet (java.util.HashSet)23 Literal (org.sbolstandard.core.datatree.Literal)22 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)22 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)20 Before (org.junit.Before)17 IdentifiableDocument (org.sbolstandard.core.datatree.IdentifiableDocument)17 NestedDocument (org.sbolstandard.core.datatree.NestedDocument)11 Sequence (org.sbolstandard.core2.Sequence)8 ModuleDefinition (org.sbolstandard.core2.ModuleDefinition)7 FunctionalComponent (org.sbolstandard.core2.FunctionalComponent)6 Activity (org.sbolstandard.core2.Activity)5 Component (org.sbolstandard.core2.Component)4 GenericTopLevel (org.sbolstandard.core2.GenericTopLevel)3 Interaction (org.sbolstandard.core2.Interaction)3 Module (org.sbolstandard.core2.Module)3