Exemplo n.º 1
0
  /**
   * Query all nodes of worm regulatory network.
   *
   * @param model the Model
   * @param executor to run the query
   * @return interactionNodeSet
   */
  private static void queryWormRegulatoryNodes(Model model, PathQueryExecutor executor) {

    interactionNodeSetWorm = new LinkedHashSet<CytoscapeNetworkNodeData>();

    PathQuery query = new PathQuery(model);
    query.addViews(
        "NetworkProperty.node.primaryIdentifier",
        "NetworkProperty.node.symbol",
        "NetworkProperty.node.id",
        "NetworkProperty.type",
        "NetworkProperty.value");

    query.addConstraint(Constraints.eq("NetworkProperty.node.organism.shortName", "C. elegans"));

    ExportResultsIterator result;
    try {
      result = executor.execute(query);
    } catch (ObjectStoreException e) {
      throw new RuntimeException("Error retrieving results.", e);
    }

    while (result.hasNext()) {
      List<ResultElement> row = result.next();

      String featurePId = (String) row.get(0).getField();
      String featureSymbol = (String) row.get(1).getField();
      Integer id = (Integer) row.get(2).getField();
      String key = (String) row.get(3).getField();
      String value = (String) row.get(4).getField();

      CytoscapeNetworkNodeData aNode = new CytoscapeNetworkNodeData();
      aNode.setInterMineId(id);
      aNode.setSourceId(String.valueOf(id)); // Use IM Id instead of PId

      if (featureSymbol == null || featureSymbol.length() < 1) {
        aNode.setSourceLabel(featurePId);
      } else {
        aNode.setSourceLabel(featureSymbol);
      }

      if (interactionNodeSetWorm.contains(aNode)) {
        for (CytoscapeNetworkNodeData n : interactionNodeSetWorm) {
          if (n.getInterMineId() == id) {
            n.getExtraInfo().put(key, value);
          }
        }
      } else {
        Map<String, String> extraInfo = new HashMap<String, String>();
        extraInfo.put(key, value);
        aNode.setExtraInfo(extraInfo);
      }

      interactionNodeSetWorm.add(aNode);
    }
  }
Exemplo n.º 2
0
  /**
   * Query all nodes of fly regulatory network.
   *
   * @param model the Model
   * @param executor to run the query
   * @return interactionNodeSet
   */
  private static void queryFlyRegulatoryNodes(Model model, PathQueryExecutor executor) {

    interactionNodeSetFly = new LinkedHashSet<CytoscapeNetworkNodeData>();

    PathQuery query = new PathQuery(model);
    query.addViews(
        "NetworkProperty.node.primaryIdentifier",
        "NetworkProperty.node.symbol",
        "NetworkProperty.node.id",
        "NetworkProperty.value");

    query.addConstraint(Constraints.eq("NetworkProperty.node.primaryIdentifier", "FBgn*"));

    ExportResultsIterator result;
    try {
      result = executor.execute(query);
    } catch (ObjectStoreException e) {
      throw new RuntimeException("Error retrieving results.", e);
    }

    while (result.hasNext()) {
      List<ResultElement> row = result.next();

      String featurePId = (String) row.get(0).getField();
      String featureSymbol = (String) row.get(1).getField();
      Integer featureIMId = (Integer) row.get(2).getField();
      String position = (String) row.get(3).getField();

      CytoscapeNetworkNodeData aNode = new CytoscapeNetworkNodeData();
      aNode.setInterMineId(featureIMId);
      aNode.setSourceId(featurePId);

      if (featureSymbol == null || featureSymbol.length() < 1) {
        aNode.setSourceLabel(featurePId);
      } else {
        aNode.setSourceLabel(featureSymbol);
      }

      aNode.setPosition(position);

      interactionNodeSetFly.add(aNode);
    }
  }