Examples of Compartment


Examples of org.gvt.model.biopaxl2.Compartment

        for (String selected : selectionResult)
        {
          //search among all sourceAddedCompartments
          for (int j = 0 ; j < sourceAddedCompartments.size() ; j++)
          {
            Compartment compartment = sourceAddedCompartments.get(j);

            //if corresponding compartment is found
            if (selected != null &&
              selected.equals(compartment.getName()))
            {
              //remove compartment from sourceAddedCompartments ArrayList
              sourceAddedCompartments.remove(j);

              //remove compartment name from source compartment list
              entityList.remove(selected);
            }
          }
         }
      }
    });

    //Target add button

    targetAddButton = new Button(shell, SWT.NONE);
    targetAddButton.setText("Add...");
    gridData = new GridData(GridData.END, GridData.BEGINNING, true, false);
    gridData.minimumWidth = 100;
    gridData.horizontalIndent = 5;
    targetAddButton.setLayoutData(gridData);
    targetAddButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent arg0)
      {
        //new addCompartmentDialog
        AddCompartmentDialog addCompartment =
          new AddCompartmentDialog(new Shell(), allCompartments);

        //open dialog
        boolean addPressed = addCompartment.open();

        //if add button is pressed
        if (addPressed)
        {
          //for each selected compartment
          for (Compartment compartment :
            addCompartment.getSelectedCompartments())
          {
            //check if compartment has been added before
            if (!previouslyAdded(compartment, targetAddedCompartments))
            {
              //add compartment name to target compartment list
              targetCompartmentList.add(compartment.getName());

              //add compartment to targetAddedCompartments ArrayList
              targetAddedCompartments.add(compartment);
            }
          }
        }
      }
    });

    //Target remove button

    targetRemoveButton = new Button(shell, SWT.NONE);
    targetRemoveButton.setText("Remove");
    gridData = new GridData(GridData.BEGINNING, GridData.BEGINNING,
      true, false);
    gridData.horizontalIndent = 5;
    gridData.minimumWidth = 100;
    targetRemoveButton.setLayoutData(gridData);
    targetRemoveButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent arg0)
      {
        String[] selectionResult = targetCompartmentList.getSelection();

        //for each selected string
        for (String selected : selectionResult)
        {
          //search among all targetAddedCompartments
          for (int j = 0 ; j < targetAddedCompartments.size() ; j++)
          {
            Compartment compartment = targetAddedCompartments.get(j);

            //if corresponding compartment is found
            if (selected != null &&
              selected.equals(compartment.getName()))
            {
              //remove compartment from targetAddedCompartments ArrayList
              targetAddedCompartments.remove(j);

              //remove compartment name from target compartment list
View Full Code Here

Examples of org.sbml.jsbml.Compartment

  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    doc = new SBMLDocument(3, 1);
    Model m = doc.createModel("test_model");
   
    Compartment c = m.createCompartment("default");
    c.setSpatialDimensions(3d);
   
    Species s1 = m.createSpecies("s1", "species1", c);
    Species s2 = m.createSpecies("s2", "species2", c);
    Species s3 = m.createSpecies("s3", "species3", c);
    Species s4 = m.createSpecies("s4", "species4", c);
View Full Code Here

Examples of org.sbml.jsbml.Compartment

  @SuppressWarnings("deprecation")
  @Test
  public void test_read_l1v1_branch() throws XMLStreamException, InvalidPropertiesFormatException, IOException, ClassNotFoundException {
    SBMLDocument d;
    Model m;
    Compartment c;
    KineticLaw kl;
    LocalParameter p;
    Reaction r;
    Species s;
    SpeciesReference sr;
    UnitDefinition ud;
    String filename = DATA_FOLDER + "/libsbml-test-data/l1v1-branch.xml";
    d = new SBMLReader().readSBML(filename);
    if (d == null)
      ;
    {
    }
    assertTrue(d.getLevel() == 1);
    assertTrue(d.getVersion() == 1);
    m = d.getModel();
    assertTrue(m.getName().equals("Branch"));
    assertTrue(m.getCompartmentCount() == 1);
    c = m.getCompartment(0);
    assertTrue(c.getName().equals("compartmentOne"));
    assertTrue(c.getVolume() == 1);
    ud = c.getDerivedUnitDefinition();
    assertTrue(ud.getUnitCount() == 1);

    // assertTrue(ud.getUnit(0).getKind() == Unit.Kind.LITRE); // getDerivedUnitDefinition not working properly
    assertTrue(m.getSpeciesCount() == 4);
    s = m.getSpecies(0);
View Full Code Here

Examples of org.sbml.jsbml.Compartment

   
    /*
     * Compartments
     */
    logger.debug("==== Compartments ====");
    Compartment c1 = model.createCompartment("c1");
    c1.setSize(2d);
    Compartment c2 = model.createCompartment("c2");
    try {
      c2.setId(c1.getId());
      fail();
    } catch (IllegalArgumentException exc) {
      System.err.println(exc.getLocalizedMessage());
      assertTrue(!c2.getId().equals(c1.getId()));
    }
    // remove ListOfCompartments
    ListOf<Compartment> listOfC = model.getListOfCompartments();
    model.unsetListOfCompartments();
    // add ListOfCompartments
    model.setListOfCompartments(listOfC);
    Compartment c3 = new Compartment(level, version);
    c3.setId("c3");
    model.addCompartment(c3);
    c3.setId("c4");
   
    /*
     * Species and Species References
     */
    logger.debug("==== Species ====");
View Full Code Here

Examples of org.sbml.jsbml.Compartment

public class TestCompartment {
  private Compartment C;

  @Before public void setUp() throws Exception
  {
    C = new  Compartment(2,4);
    if (C == null);
    {
    }
  }
View Full Code Here

Examples of org.sbml.jsbml.Compartment

    assertEquals( false, C.isSetOutside() );
  }

  @Test public void test_Compartment_createWith()
  {
    Compartment c = new  Compartment(2,4);
    c.setId( "A");
//    assertTrue( c.getTypeCode() == libsbml.SBML_COMPARTMENT );
    assertTrue( c.getMetaId().equals("") == true );
    assertTrue( c.getNotes() == null );
    // assertTrue( c.getAnnotation() == null );
    assertTrue( c.getName().equals("") == true );
    assertTrue( c.getSpatialDimensions() == 3d );
    assertTrue(c.getId().equals( "A"     ));
    assertTrue( c.getConstant() == true );
    assertEquals( true, c.isSetId() );
    assertEquals( false, c.isSetName() );
    c = null;
  }
View Full Code Here

Examples of org.sbml.jsbml.Compartment

  }

  @SuppressWarnings("deprecation")
@Test public void test_Compartment_initDefaults()
  {
    Compartment c = new  Compartment(2,4);
    c.setId( "A");
    c.initDefaults();
    assertTrue(c.getId().equals( "A"));
    assertTrue( c.getName().equals("") == true );
    assertTrue( c.getUnits().equals("") == true );
    assertTrue( c.getOutside().equals("") == true );
    assertTrue( c.getSpatialDimensions() == 3d );
    // assertTrue( c.getVolume() == 1.0 ); // There is no default for the volume/size in L2 !!
    assertTrue( Double.isNaN(c.getVolume()));
    assertTrue( c.getConstant() == true );
    assertEquals( true, c.isSetId() );
    assertEquals( false, c.isSetName() );
    assertEquals( false, c.isSetSize() );
    assertEquals( false, c.isSetVolume() );
    assertEquals( false, c.isSetUnits() );
    assertEquals( false, c.isSetOutside() );
    c = null;
  }
View Full Code Here

Examples of org.sbml.jsbml.Compartment

@Test public void test_read_l2v1_assignment()
  {
    SBMLReader reader = new SBMLReader();
    SBMLDocument d = null;
    Model m;
    Compartment c;
    Species s;
    Parameter gp;
    LocalParameter lp;
    AssignmentRule ar;
    Reaction r;
    SpeciesReference sr;
    KineticLaw kl;
    UnitDefinition ud;
    Reaction r1;
    ListOf<Compartment> loc;
    Compartment c1;
    ListOf<Rule> lor;
    AssignmentRule ar1;
    ListOf<Parameter> lop;
    Parameter p1;
    ListOf<Species> los;
    Species s1;
    String filename = new String( DATA_FOLDER + "/libsbml-test-data/" );
    filename += "l2v1-assignment.xml";
    try {
    d = reader.readSBML(filename);
  } catch (IOException e) {
    e.printStackTrace();
    assert(false);
  } catch (XMLStreamException e) {
    e.printStackTrace();
    assert(false);
  }

  System.out.println(" TestReadFromFile 5: reading done.");
 
  assertTrue( d.getLevel() == 2 );
    assertTrue( d.getVersion() == 1 );
    m = d.getModel();
    assertTrue( m != null );
    assertTrue( m.getCompartmentCount() == 1 );
    c = m.getCompartment(0);
    assertTrue( c != null );
    assertTrue( c.getId().equals( "cell") );
/*    ud = c.getDerivedUnitDefinition();
    assertTrue( ud.getUnitCount() == 1 );
    assertTrue( ud.getUnit(0).getKind() == Kind.LITRE );
    */
    loc = m.getListOfCompartments();
    c1 = loc.get(0);
    assertTrue( c1.equals(c) );
    c1 = loc.get("cell");
    assertTrue( c1.equals(c) );
    assertTrue( m.getSpeciesCount() == 5 );
    s = m.getSpecies(0);
    assertTrue( s != null );
    assertTrue( s.getId().equals( "X0"  ) );
    assertTrue( s.getCompartment().equals( "cell") );
View Full Code Here

Examples of org.sbml.jsbml.Compartment

   */
  @Before public void setUp() {
    doc = new SBMLDocument(2, 4);
    model = doc.createModel("model");
   
    Compartment comp = model.createCompartment("cell");
    comp.setMetaId("cell");
   
    Species s1 = model.createSpecies("S1", comp);
    s1.setMetaId("S1");
   
    Species s2 = model.createSpecies("S2", comp);
View Full Code Here

Examples of org.sbml.jsbml.Compartment

    Model model = doc.createModel("test_model");
    Parameter p1 = model.createParameter("p1");
    p1.setId("p2");
    model.removeParameter(p1);

    Compartment c = model.createCompartment("c");
    c.setSize(4.3);
    c.setSBOTerm(SBO.getPhysicalCompartment());

    Species s1 = model.createSpecies("s1", c);
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
        Qualifier.BQB_IS, "urn:miriam:kegg.compound:C12345"));
    s1.setValue(23.7);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.