Package org.biopax.paxtools.model

Examples of org.biopax.paxtools.model.Model


          {
            continue;
          }

          System.out.println("Querying neighbors for " + ref);
          Model resultModel = ioHandler.getNeighbors(ref.getRef());

          main.unlock();
         
          if (resultModel != null && !resultModel.getIdMap().keySet().isEmpty())
          {
            String pname = "Neighborhood for " + ref;

            if (main.getOwlModel() != null)
            {
View Full Code Here


       *   visualize on the spot, which can be very useful in JWS deployment.  */
      else if (filename.matches("\\d*")){
        try {
          BioPAXIOHandler reader = new SimpleIOHandler();
          PathwayCommonsIOHandler pcIOHandler  = new PathwayCommonsIOHandler(reader);
          Model model = pcIOHandler.retrieveByID(filename);
          LoadBioPaxModelAction action = new LoadBioPaxModelAction(window, model);
          window.firstAction = action;
         
        } catch (IOException e) {
          e.printStackTrace();
View Full Code Here

  }


  public void LocalNeighborhood()
  {
    Model owlModel = this.main.getOwlModel();

    if (owlModel == null)
    {
      MessageDialog.openError(main.getShell(), "Error!",
        "Load or query a BioPAX model first!");
View Full Code Here

        LocalCompartment();
    }

    public void LocalCompartment()
    {
        Model owlModel = this.main.getOwlModel();

        if (owlModel == null)
        {
            MessageDialog.openError(main.getShell(), "Error!",
                "Load or query a BioPAX model first!");
View Full Code Here

      BioPAXGraph graph = (BioPAXGraph) root;

      if (graph.isMechanistic())
      {
        graph.forgetLayout();
        Model model = graph.getBiopaxModel();
        pathway p = graph.getPathway();
        model.remove(p);

        main.getAllPathwayNames().remove(p.getNAME());
      }
    }
  }
View Full Code Here

  private void queryIDs(PathwayCommonsIOHandler ioHandler, List<String> idList) throws IOException
  {
    for (String id : idList)
    {
      ioHandler.setInputIdType(PathwayCommonsIOHandler.ID_TYPE.CPATH_ID);
      Model resultModel = ioHandler.retrieveByID(id);

      if (resultModel != null && !resultModel.getIdMap().keySet().isEmpty())
      {
        if (main.getOwlModel() != null)
        {
          MergeAction merge = new MergeAction(main, resultModel);
          merge.setOpenPathways(false);
View Full Code Here

    main.setRootGraph(root);
  }

  public void run()
  {
    Model model = main.getOwlModel();

    if (model == null)
    {
      MessageDialog.openError(main.getShell(), "Error!",
        "Load or query a BioPAX model first!");
View Full Code Here

   */
  protected void createGraph(BioPAXL3Graph root)
  {
    Map<String, NodeModel> map = new HashMap<String, NodeModel>();

    Model model = root.getBiopaxModel();

//    for (xref xr : model.getObjects(xref.class))
//    {
//      UniquePrinter.print("xref ["+xr.getID()+"] = ", xr.getDB());
//    }

    if (nestCompartments) createAndNestCompartments(model, map, root);

    // Create actors

    for (PhysicalEntity pe : model.getObjects(PhysicalEntity.class))
    {
      if (pe.getStandardName() == null)
      {
        if (pe.getDisplayName() != null)
        {
          pe.setStandardName(pe.getDisplayName());
        }
        else if (!pe.getName().isEmpty())
        {
          pe.setStandardName(pe.getName().iterator().next());
        }
        else if (pe instanceof SimplePhysicalEntity)
        {
          EntityReference er = ((SimplePhysicalEntity) pe).getEntityReference();
          if (er != null)
          {
            pe.setStandardName(er.getStandardName());
            if (pe.getStandardName() == null &&
              er.getName() != null && !er.getName().isEmpty())
            {
              pe.setStandardName(er.getName().iterator().next());
            }
          }
        }
      }
      if (pe.getStandardName() == null)
      {
        pe.setStandardName("noname");
      }

      // Complex will be processed later.
      if (pe instanceof Complex) continue;

      // Create simple states (Actors)

      CompoundModel parent = extractCompartment(pe, map);
      if (parent == null) parent = root;

      if (!isUbique(pe))
      {
        if (pe.getComponentOf().isEmpty() || !pe.getParticipantOf().isEmpty())
        {
          Actor actor = new Actor(parent, pe, null);
          map.put(pe.getRDFId(), actor);
        }
      }
      else
      {
        for (Interaction inter : pe.getParticipantOf())
        {
          Actor actor = new Actor(parent, pe, inter);
          map.put(pe.getRDFId() + inter.getRDFId(), actor);
        }
      }
    }

    // Create complexes

    for (Complex cmp : model.getObjects(Complex.class))
    {
      if (cmp.getParticipantOf().isEmpty())
      {
        ChbComplex c = new ChbComplex(root, cmp);
        createComplexContent(c, cmp, cmp, map);
      }
      else
      {
        CompoundModel compart = getCompartment(cmp, map, root);

        if (compart == root)
        {
          String nm = ChbComplex.suggestCompartmentNameUsingMembers(cmp.getComponent());

          if (nm != null)
          {
            if (nestCompartments) nm = CompartmentManager.getUnifiedName(nm);
            compart = getCompartment(nm, map, root);
          }
        }

        NodeModel nd;

        if (cmp.getComponent().isEmpty())
        {
          nd = new Actor(compart, cmp, null);
        }
        else
        {
          ChbComplex c = new ChbComplex(compart, cmp);
          createComplexContent(c, cmp, cmp, map);
          nd = c;
        }

        map.put(cmp.getRDFId(), nd);
      }
    }

    // Create events

    for (Conversion conv : model.getObjects(Conversion.class))
    {
      String compName = ChbConversion.getPossibleCompartmentName(conv);

      if (compName != null && nestCompartments)
        compName = CompartmentManager.getUnifiedName(compName);

      CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);

//      if (compart == null)
//      {
//        System.out.println("");
//      }

      assert compart != null;
     
      ChbConversion forwd = null, rever = null;

      if (evidenceExists(conv, ChbConversion.LEFT_TO_RIGHT))
      {
        forwd = new ChbConversion(compart, conv, ChbConversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }
      if (evidenceExists(conv, ChbConversion.RIGHT_TO_LEFT))
      {
        rever = new ChbConversion(compart, conv, ChbConversion.RIGHT_TO_LEFT, map);
        rever.selectBestCompartment();
      }
      if (forwd == null && rever == null)
      {
        forwd = new ChbConversion(compart, conv, ChbConversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }
    }

//    for (TemplateReaction reac : model.getObjects(TemplateReaction.class))
//    {
//      String compName = ChbConversion.getPossibleCompartmentName(reac);
//
//      if (compName != null && nestCompartments)
//        compName = CompartmentManager.getUnifiedName(compName);
//
//      CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);
//
//    }

    for (Interaction inter : model.getObjects(Interaction.class))
    {
      boolean drawPPI = true;
      if (!drawPPI) break;

      if (!(inter instanceof Conversion) && !(inter instanceof Control))
View Full Code Here

    CommonStreamQuery();
  }

  public void CommonStreamQuery()
  {
    Model owlModel = this.main.getOwlModel();

    if (owlModel == null)
    {
      MessageDialog.openError(main.getShell(), "Error!",
        "Load or query a BioPAX model first!");
View Full Code Here

   */
  protected void createGraph(BioPAXL2Graph root)
  {
    Map<String, NodeModel> map = new HashMap<String, NodeModel>();
   
    Model model = root.getBiopaxModel();

//    for (xref xr : model.getObjects(xref.class))
//    {
//      UniquePrinter.print("xref ["+xr.getID()+"] = ", xr.getDB());
//    }

    if (nestCompartments) createAndNestCompartments(model, map, root);
   
    // Create actors
   
    for (physicalEntity pe : model.getObjects(physicalEntity.class))
    {
      // Complex will be processed later.
      if (pe instanceof complex) continue;

      // Create simple states (Actors)
     
      if (pe.isPHYSICAL_ENTITYof().isEmpty())
      {
        new Actor(root, pe, new ArrayList<physicalEntityParticipant>());
      }
      else
      {
        Collection<List<physicalEntityParticipant>> coll = groupParticipants(pe);
       
        for (List<physicalEntityParticipant> list : coll)
        {
          CompoundModel compart = getCompartment(list.get(0), map, root);
         
          Actor actor = new Actor(compart, pe, list);
         
          for (physicalEntityParticipant par : list)
          {
            map.put(par.getRDFId(), actor);
          }
        }
      }
    }
   
    // Create complexes

    for (complex cmp : model.getObjects(complex.class))
    {
      if (cmp.isPHYSICAL_ENTITYof().isEmpty())
      {
        Complex c = new Complex(root, cmp, new ArrayList<physicalEntityParticipant>(0));
        createComplexContent(c, cmp, new ArrayList<physicalEntityParticipant>());
      }
      else
      {
        Collection<List<physicalEntityParticipant>> coll = groupParticipants(cmp);
       
        for (List<physicalEntityParticipant> list : coll)
        {
          CompoundModel compart = getCompartment(list.get(0), map, root);

          if (compart == root)
          {
            String nm = Complex.suggestCompartmentNameUsingMembers(cmp.getCOMPONENTS());

            if (nm != null)
            {
              if (nestCompartments) nm = CompartmentManager.getUnifiedName(nm);
              compart = getCompartment(nm, map, root);
            }
          }

          NodeModel nd;

          if (cmp.getCOMPONENTS().isEmpty())
          {
            nd = new Actor(compart, cmp, list);
          }
          else
          {
            Complex c = new Complex(compart, cmp, list);
            createComplexContent(c, cmp, list);
            nd = c;
          }

          for (physicalEntityParticipant par : list)
          {
            map.put(par.getRDFId(), nd);
          }
        }
      }
    }   
   
    // Create events
   
    for (conversion conv : model.getObjects(conversion.class))
    {
      String compName = Conversion.getPossibleCompartmentName(conv);

      if (compName != null && nestCompartments)
        compName = CompartmentManager.getUnifiedName(compName);
     
      CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);
     
      Conversion forwd = null, rever = null;
     
      if (evidenceExists(conv, Conversion.LEFT_TO_RIGHT))
      {
        forwd = new Conversion(compart, conv, Conversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }     
      if (evidenceExists(conv, Conversion.RIGHT_TO_LEFT))
      {
        rever = new Conversion(compart, conv, Conversion.RIGHT_TO_LEFT, map);
        rever.selectBestCompartment();
      }
      if (forwd == null && rever == null)
      {
        forwd = new Conversion(compart, conv, Conversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }
    }

    for (interaction inter : model.getObjects(interaction.class))
    {
      boolean drawPPI = true;
      if (!drawPPI) break;

      if (!(inter instanceof conversion) && !(inter instanceof control))
View Full Code Here

TOP

Related Classes of org.biopax.paxtools.model.Model

Copyright © 2018 www.massapicom. 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.