Ejemplo n.º 1
0
  /**
   * GML File constructor. STILL IN DEVELOPMENT: If the file has .xml extension, it considers that
   * it is a Syntren file, and converts it before building
   *
   * @param inputPath File path with TRN information
   */
  public NetworkData(String inputPath) {
    String ext = SyntrenFilter.getExtension(inputPath);
    if (ext.equals("xml")) {
      TRNParser.syntren2GML(inputPath, "es/usal/bicoverlapper/data/TRN.xml");
      f = new File("es/usal/bicoverlapper/data/TRN.xml");
    } else if (ext.equals("txt")) {
      TRNParser.tab2GML(inputPath, "es/usal/bicoverlapper/data/TRN.xml");
      f = new File("es/usal/bicoverlapper/data/TRN.xml");
    } else f = new File(inputPath);

    gr = new GraphMLReader();
    try {
      g = gr.readGraph(f); // takes some time for 2600 nodes, not too much
    } catch (DataIOException dioe) {
      System.out.println("Error reading " + f + ": " + dioe.getMessage());
      System.exit(1);
    }
    nNodes = g.getNodeCount();
    nEdges = g.getEdgeCount();

    g.addColumn("id", int.class);

    // Motifs (pruebas)
    // countFFLs(); //TODO: Improve the search with long number of nodes, for 2600 is terribly slow
  }
Ejemplo n.º 2
0
  /** @see java.lang.Runnable#run() */
  public void run() {
    while (true) {
      Entry e = null;
      synchronized (s_queue) {
        if (s_queue.size() > 0) e = (Entry) s_queue.remove(0);
      }

      if (e != null) {
        try {
          if (e.listener != null) e.listener.preQuery(e);
          e.ds.getData(e.table, e.query, e.keyField, e.lock);
          if (e.listener != null) e.listener.postQuery(e);
        } catch (DataIOException dre) {
          s_logger.warning(dre.getMessage() + "\n" + StringLib.getStackTrace(dre));
        }
      } else {
        // nothing to do, chill out until notified
        try {
          synchronized (this) {
            wait();
          }
        } catch (InterruptedException ex) {
        }
      }
    }
  }
Ejemplo n.º 3
0
  /**
   * Syntren File constructor. Builds a GML file from a Syntren file, saving it to disk and building
   * the TRNData
   *
   * @param inputPath Syntren input file path
   * @param outputPath GML output file path
   */
  public NetworkData(String inputPath, String outputPath) {
    TRNParser.syntren2GML(inputPath, outputPath);
    // System.out.println("Termina el conversor");

    f = new File(outputPath);
    gr = new GraphMLReader();
    try {
      g = gr.readGraph(f);
    } catch (DataIOException dioe) {
      System.out.println("Error reading " + f + ": " + dioe.getMessage());
      System.exit(1);
    }
    //	System.out.println("Hemos terminado de crear el grafo sin problemas");
    System.out.println("Network with " + g.getNodeCount() + " nodes");
    System.out.println("Network with " + g.getEdgeCount() + " edges");
    nNodes = g.getNodeCount();
    nEdges = g.getEdgeCount();

    // countFFLs();
    System.out.println("Number of FFLs found: " + ffls.size());
  }