Search in sources :

Example 56 with SBOLDocument

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

the class ComponentTest 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);
    doc.createComponentDefinition("promoter_CD", "", ComponentDefinition.DNA);
    gene_CD = doc.createComponentDefinition("gene_CD", "", ComponentDefinition.DNA);
    doc.createComponentDefinition("terminator_CD", "", ComponentDefinition.DNA);
    /*create Components   */
    promoter = gRNA_b_gene.createComponent("promoter", AccessType.PUBLIC, "promoter_CD");
    gene = gRNA_b_gene.createComponent("gene", AccessType.PUBLIC, "gene_CD");
    gRNA_b_gene.createComponent("terminator", AccessType.PUBLIC, "terminator_CD");
    doc.createComponentDefinition("target_gene_CD", "", ComponentDefinition.DNA);
    target_gene = gRNA_b_gene.createComponent("target_gene", AccessType.PUBLIC, "target_gene_CD");
    doc.createComponentDefinition("target_protein", ComponentDefinition.DNA);
    protein = gene_CD.createComponent("protein", AccessType.PUBLIC, "target_protein");
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Before(org.junit.Before)

Example 57 with SBOLDocument

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

the class CollectionTest method setUp.

@Before
public void setUp() throws Exception {
    String prURI = "http://partsregistry.org";
    doc = new SBOLDocument();
    doc.setDefaultURIprefix(prURI);
    doc.setComplete(true);
    TetR_promoter = doc.createComponentDefinition("TetR_promoter", "", ComponentDefinition.DNA);
    gRNA_b_promoter = doc.createComponentDefinition("gRNA_b_promoter", "", ComponentDefinition.DNA);
    CRa_U6_promoter = doc.createComponentDefinition("CRa_U6", "", ComponentDefinition.DNA);
    promoters = doc.createCollection("promoters");
    promoters.addMember(TetR_promoter.getIdentity());
    promoters.addMember(gRNA_b_promoter.getIdentity());
    promoters.addMember(CRa_U6_promoter.getIdentity());
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Before(org.junit.Before)

Example 58 with SBOLDocument

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

the class FunctionalComponentTest 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);
    copy_doc = new SBOLDocument();
    copy_doc.setDefaultURIprefix(prURI);
    copy_doc.setTypesInURIs(false);
    copy_doc.setComplete(true);
    gRNA_b_gene = doc.createComponentDefinition("gRNA_b_gene", ComponentDefinition.DNA);
    target_gene = doc.createComponentDefinition("target_gene", ComponentDefinition.DNA);
    CRISPR_Template = doc.createModuleDefinition("CRISPR_Template");
    gRNA_b_gene_fc = CRISPR_Template.createFunctionalComponent("gRNA_b_gene_fc", AccessType.PUBLIC, "gRNA_b_gene", DirectionType.OUT);
    target_gene_fc = CRISPR_Template.createFunctionalComponent("target_gene_fc", AccessType.PUBLIC, "target_gene", DirectionType.NONE);
    target_protein = doc.createComponentDefinition("target_protein", ComponentDefinition.DNA);
    protein = gRNA_b_gene.createComponent("protein", AccessType.PUBLIC, "target_protein");
    tar_protein = gRNA_b_gene_fc.createMapsTo("target_protein_mapsTo", RefinementType.USELOCAL, "target_gene_fc", "protein");
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Before(org.junit.Before)

Example 59 with SBOLDocument

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

the class SynBioHubFrontend method getSBOL.

/**
 * Retrieve SBOL TopLevel object from a SynBioHub instance using its URI.
 *
 * @param topLevelUri The URI of the SBOL TopLevel
 *
 * @return A libSBOLj TopLevel instance corresponding to the TopLevel
 *
 * @throws SynBioHubException if there was an error communicating with the SynBioHub
 */
public SBOLDocument getSBOL(URI topLevelUri) throws SynBioHubException {
    if (topLevelUri == null)
        return null;
    if (!topLevelUri.toString().startsWith(uriPrefix)) {
        throw new SynBioHubException("Object URI does not start with correct URI prefix for this repository.");
    }
    String url = topLevelUri + "/sbol";
    url = url.replace(uriPrefix, backendUrl);
    SBOLDocument document = fetchFromSynBioHub(url);
    return document;
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument)

Example 60 with SBOLDocument

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

the class SynBioHubFrontend method fetchFromSynBioHub.

private SBOLDocument fetchFromSynBioHub(String url) throws SynBioHubException {
    HttpStream stream;
    try {
        stream = fetchContentAsInputStream(url);
    } catch (Exception e) {
        throw new SynBioHubException("Error connecting to SynBioHub endpoint", e);
    }
    SBOLDocument document;
    try {
        document = SBOLReader.read(stream.inputStream);
    } catch (Exception e) {
        throw new SynBioHubException("Error reading SBOL", e);
    } finally {
        stream.request.releaseConnection();
    }
    return document;
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) SBOLValidationException(org.sbolstandard.core2.SBOLValidationException)

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