Search in sources :

Example 11 with SBOLDocument

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

the class MapsToTest 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);
    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 12 with SBOLDocument

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

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

the class SequenceAnnotationTest 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);
    promoter_CD = doc.createComponentDefinition("promoter_CD", "", ComponentDefinition.DNA);
    doc.createComponentDefinition("gene_CD", "", ComponentDefinition.DNA);
    doc.createComponentDefinition("terminator_CD", "", ComponentDefinition.DNA);
    gRNA_b_gene.createComponent("promoter", AccessType.PUBLIC, "promoter_CD");
    gRNA_b_gene.createComponent("gene", AccessType.PUBLIC, "promoter_CD");
    gRNA_b_gene.createComponent("terminator", AccessType.PUBLIC, "promoter_CD");
    /*create SequenceAnnotations*/
    promoter_SA = gRNA_b_gene.createSequenceAnnotation("promoter_SA", "cutAt1");
    promoter_SA.setComponent("promoter");
    gene_SA = gRNA_b_gene.createSequenceAnnotation("gene_SA", "cutAt50");
    terminator_SA = gRNA_b_gene.createSequenceAnnotation("terminator_SA", "cutAt100");
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Before(org.junit.Before)

Example 14 with SBOLDocument

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

the class CollectionOutput method main.

/**
 * @param args
 * @throws SBOLValidationException see SBOL validation rule violation at {@link Collection#addMember(URI)}
 * @throws SBOLConversionException
 */
public static void main(String[] args) throws SBOLValidationException, SBOLConversionException {
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix("http://parts.igem.org/Promoters/Catalog");
    document.setTypesInURIs(false);
    Collection col = document.createCollection("Anderson", "");
    col.setName("Anderson promoters");
    col.setDescription("The Anderson promoter collection");
    col.addMember(URI.create("http://partsregistry.org/Part:BBa_J23119"));
    col.addMember(URI.create("http://partsregistry.org/Part:BBa_J23118"));
    SBOLWriter.write(document, (System.out));
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Collection(org.sbolstandard.core2.Collection)

Example 15 with SBOLDocument

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

the class GettingStartedExample method main.

public static void main(String[] args) throws IOException, SBOLValidationException, SBOLConversionException {
    String prURI = "http://partsregistry.org/";
    String prPrefix = "pr";
    String myersLabURI = "http://www.async.ece.utah.edu/";
    String myersLabPrefix = "myersLab";
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix(prURI);
    document.setTypesInURIs(true);
    document.setComplete(true);
    document.setCreateDefaults(true);
    document.addNamespace(URI.create(prURI), prPrefix);
    document.addNamespace(URI.create(myersLabURI), myersLabPrefix);
    // Creating a Top-level SBOL Data Object
    HashSet<URI> types = new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA, URI.create("http://identifiers.org/chebi/CHEBI:4705")));
    ComponentDefinition TetR_promoter = document.createComponentDefinition("BBa_R0040", types);
    ComponentDefinition LacI_repressor = document.createComponentDefinition("BBa_C0012", types);
    ComponentDefinition pIKELeftCassette = document.createComponentDefinition("pIKELeftCassette", types);
    Sequence seq_187 = document.createSequence("partseq_187", "tccctatcagtgatagagattgacatccctatcagtgatagagatactgagcac", Sequence.IUPAC_DNA);
    String element2 = "atggtgaatgtgaaaccagtaacgttatacgatgtcgcagagtatgccggtgtc" + "tcttatcagaccgtttcccgcgtggtgaaccaggccagccacgtttctgcgaaaacgcggga" + "aaaagtggaagcggcgatggcggagctgaattacattcccaaccgcgtggcacaacaactgg" + "cgggcaaacagtcgttgctgattggcgttgccacctccagtctggccctgcacgcgccgtcg" + "caaattgtcgcggcgattaaatctcgcgccgatcaactgggtgccagcgtggtggtgtcgat" + "ggtagaacgaagcggcgtcgaagcctgtaaagcggcggtgcacaatcttctcgcgcaacgcg" + "tcagtgggctgatcattaactatccgctggatgaccaggatgccattgctgtggaagctgcc" + "tgcactaatgttccggcgttatttcttgatgtctctgaccagacacccatcaacagtattat" + "tttctcccatgaagacggtacgcgactgggcgtggagcatctggtcgcattgggtcaccagc" + "aaatcgcgctgttagcgggcccattaagttctgtctcggcgcgtctgcgtctggctggctgg" + "cataaatatctcactcgcaatcaaattcagccgatagcggaacgggaaggcgactggagtgc" + "catgtccggttttcaacaaaccatgcaaatgctgaatgagggcatcgttcccactgcgatgc" + "tggttgccaacgatcagatggcgctgggcgcaatgcgcgccattaccgagtccgggctgcgc" + "gttggtgcggatatctcggtagtgggatacgacgataccgaagacagctcatgttatatccc" + "gccgttaaccaccatcaaacaggattttcgcctgctggggcaaaccagcgtggaccgcttgc" + "tgcaactctctcagggccaggcggtgaagggcaatcagctgttgcccgtctcactggtgaaa" + "agaaaaaccaccctggcgcccaatacgcaaaccgcctctccccgcgcgttggccgattcatt" + "aatgcagctggcacgacaggtttcccgactggaaagcgggcaggctgcaaacgacgaaaact" + "acgctttagtagcttaataa";
    Sequence seq_153 = document.createSequence("partseq_153", element2, Sequence.IUPAC_DNA);
    // Setting and editing optional fields
    TetR_promoter.setName("p(tetR)");
    LacI_repressor.setName("lacI");
    TetR_promoter.setDescription("TetR repressible promoter");
    LacI_repressor.setDescription("lacI repressor from E. coli (+LVA)");
    if (TetR_promoter.isSetName()) {
        TetR_promoter.unsetName();
    }
    TetR_promoter.setName("p(tetR)");
    TetR_promoter.addRole(SequenceOntology.PROMOTER);
    LacI_repressor.addRole(SequenceOntology.CDS);
    URI TetR_promoter_role2 = URI.create("http://identifiers.org/so/SO:0000613");
    TetR_promoter.addRole(TetR_promoter_role2);
    if (TetR_promoter.containsRole(TetR_promoter_role2)) {
        TetR_promoter.removeRole(TetR_promoter_role2);
    }
    TetR_promoter.clearRoles();
    if (!TetR_promoter.getRoles().isEmpty()) {
        System.out.println("TetR_promoter set is not empty");
    }
    TetR_promoter.setRoles(new HashSet<URI>(Arrays.asList(SequenceOntology.PROMOTER)));
    // Creating and editing references
    TetR_promoter.addSequence(seq_187);
    LacI_repressor.addSequence(seq_153);
    pIKELeftCassette.addSequence(seq_187);
    pIKELeftCassette.clearSequences();
    // Adding the sequence below causes an exception because it cannot be found
    // pIKELeftCassette.addSequence(URI.create("http://partsregistry.org/seq/partseq_154"));
    // Creating Annotations
    TetR_promoter.createAnnotation(new QName(prURI, "experience", prPrefix), URI.create("http://parts.igem.org/Part:BBa_R0040"));
    // Creating Generic TopLevel Object
    GenericTopLevel datasheet = document.createGenericTopLevel("datasheet", "1.0", new QName(myersLabURI, "datasheet", myersLabPrefix));
    datasheet.setName("Datasheet for Custom Parameters");
    datasheet.createAnnotation(new QName(myersLabURI, "characterizationData", myersLabPrefix), URI.create(myersLabURI + "/measurement/Part:BBa_R0040"));
    datasheet.createAnnotation(new QName(myersLabURI, "transcriptionRate", myersLabPrefix), "0.75");
    TetR_promoter.createAnnotation(new QName(myersLabURI, "datasheet", myersLabPrefix), datasheet.getIdentity());
    // Creating and editing Child Objects
    // For pIKELeftCassette, create sequence constraint that says BBa_R0040 precedes BBa_C0012.
    // Note that with CreateDefaults that components get created automatically.
    // The position of the subject Component MUST precede that of the object Component.
    pIKELeftCassette.createSequenceConstraint("pIKELeftCassette_sc", RestrictionType.PRECEDES, TetR_promoter.getDisplayId(), LacI_repressor.getDisplayId());
    if (pIKELeftCassette.getComponent("BBa_R0040") == null) {
        System.out.println("TetR_promoter component is missing");
    }
    if (pIKELeftCassette.getComponent("BBa_C0012") == null) {
        System.out.println("LacI_repressor component is missing");
    }
    // Removing the subject component below causes an exception.
    // pIKELeftCassette.removeComponent(pIKELeftCassette.getComponent("BBa_R0040"));
    // Copying objects
    ComponentDefinition TetR_promoter_copy = (ComponentDefinition) document.createCopy(TetR_promoter, "BBa_K137046");
    Sequence seq = document.createSequence("seq_K137046", "gtgctcagtatctctatcactgatagggatgtcaatctctatcactgatagggactctagtatat" + "aaacgcagaaaggcccacccgaaggtgagccagtgtgactctagtagagagcgttcaccgaca" + "aacaacagataaaacgaaaggc", Sequence.IUPAC_DNA);
    TetR_promoter_copy.addSequence(seq);
    SBOLWriter.write(document, "GettingStartedExample.rdf");
    writeThenRead(document);
}
Also used : QName(javax.xml.namespace.QName) SBOLDocument(org.sbolstandard.core2.SBOLDocument) GenericTopLevel(org.sbolstandard.core2.GenericTopLevel) Sequence(org.sbolstandard.core2.Sequence) URI(java.net.URI) HashSet(java.util.HashSet) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

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