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");
}
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());
}
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");
}
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;
}
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;
}
Aggregations