Skip to content

Complete difFUBAR server integration #331

@stevenweaver

Description

@stevenweaver

Overview

Complete the server-side integration for difFUBAR analysis. The Julia backend is fully functional but needs to be properly integrated with the datamonkey-js-server infrastructure.

Tasks

1. Server Route Registration

Add difFUBAR routes to server.js:

// In server.js
difFubar = require("./app/difFubar/difFubar.js"),

r.route("difFubar", {
  spawn: function(stream, params) {
    new difFubar.difFubar(socket, stream, params.job);
  },
  progress: function(stream, params) {
    helpers.jobProgress(params.job, stream);
  },
  isrunning: function(stream, params) {
    helpers.isJobRunning(params.job, stream);
  }
});

2. Configuration Parameters

Add to config.json:

{
  "difFubar_walltime": "24:00:00",
  "difFubar_procs": 8,
  "difFubar_nodes": 1,
  "difFubar_memory": "32GB",
  "julia_path": "/usr/local/bin/julia",
  "julia_project": "/path/to/difFUBAR/julia_env"
}

3. Result Processing Pipeline

Implement custom result processing in difFubar.js:

difFubar.prototype.onComplete = function() {
  // Parse difFUBAR JSON output
  const results = JSON.parse(fs.readFileSync(this.results_fn));
  
  // Validate results format
  if (\!results.data || \!results.data.sites) {
    throw new Error("Invalid difFUBAR results format");
  }
  
  // Process differential selection sites
  const detectedSites = results.data.sites.filter(site => 
    Math.max(site["P(ω1 > ω2)"], site["P(ω2 > ω1)"], 
             site["P(ω1 > 1)"], site["P(ω2 > 1)"]) > this.pos_threshold
  );
  
  // Store processed results
  this.results = {
    detected_sites: detectedSites,
    summary: results.summary,
    parameters: results.input
  };
};

4. Julia Environment Setup

  • Document Julia installation requirements
  • Add Julia environment variables to server startup
  • Ensure proper permissions for Julia execution

Acceptance Criteria

  • Server can spawn difFUBAR jobs via API/web interface
  • Job status tracking works correctly
  • Results are properly parsed and stored
  • Error handling captures Julia-specific failures
  • Configuration supports Julia paths and resources

Dependencies

Priority

HIGH - Core functionality cannot work without this integration

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions