Skip to content

Commit

Permalink
Merge branch 'bootstrap4' of github.com:veg/datamonkey-js into bootst…
Browse files Browse the repository at this point in the history
…rap4
  • Loading branch information
stevenweaver committed Sep 18, 2018
2 parents 4e6395b + fd6717d commit 5bc1430
Show file tree
Hide file tree
Showing 62 changed files with 1,971 additions and 1,831 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -39,3 +39,7 @@ public/assets/js/datamonkey.js*
*vendor*
*.aa
dump.rdb

.DS_Store
.yalc/
yalc.lock
Binary file added 2.2.6.tar.gz.1
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -10,4 +10,4 @@ install:
@cd ./.tn93/ && cmake . && make && cd ../
@yarn install
@webpack
@mkdir -p ./uploads/msa ./uploads/hivtrace;
@mkdir -p ./uploads/msa ./uploads/hivtrace ./results/jobs/;
6 changes: 6 additions & 0 deletions app/models/analysis.js
Expand Up @@ -159,6 +159,12 @@ AnalysisSchema.virtual("generic_error_msg").get(function() {
return error_msg;
});

AnalysisSchema.virtual("results_path").get(function() {
return path.resolve(
__dirname + "../../../results/jobs/" + this._id + "-results" + ".json"
);
});

AnalysisSchema.methods.resubscribe = function() {
var jobproxy = new hpcsocket.HPCSocket(
{
Expand Down
1 change: 1 addition & 0 deletions app/models/hivtrace.js
Expand Up @@ -334,6 +334,7 @@ HivTrace.methods.addAttributesToResults = function(cb) {

// read from trace results
fs.readFile(self.trace_results, function(err, results) {
//fs.readFile(path.resolve(__dirname + "../../../results/jobs/" + this._id + "-results" + ".json"), function(err, results) {
if (err) {
cb(err, null);
return;
Expand Down
20 changes: 0 additions & 20 deletions app/routes/absrel.js
Expand Up @@ -187,26 +187,6 @@ exports.getPage = function(req, res) {
});
};

exports.getResults = function(req, res) {
var absrelid = req.params.id;

aBSREL.findOne({ _id: absrelid }, function(err, absrel) {
if (err || !absrel) {
res.json(500, error.errorResponse("invalid id : " + absrelid));
} else {
// Should return results page
// Append PMID to results
var absrel_results = JSON.parse(absrel.results);
absrel_results["PMID"] = absrel.pmid;

// append file information
absrel_results["input_data"] = absrel.input_data;

res.json(200, absrel_results);
}
});
};

// app.get('/absrel/:id/info', absrel.getInfo);
exports.getInfo = function(req, res) {
var id = req.params.id;
Expand Down
38 changes: 38 additions & 0 deletions app/routes/analysis.js
@@ -0,0 +1,38 @@
var globals = require("../../config/globals.js"),
error = require(__dirname + "./../../lib/error.js"),
moment = require("moment"),
_ = require("underscore"),
winston = require("winston"),
fs = require("fs"),
extend = require("mongoose-schema-extend");

var mongoose = require("mongoose"),
Msa = mongoose.model("Msa"),
Sequences = mongoose.model("Sequences"),
PartitionInfo = mongoose.model("PartitionInfo"),
FEL = mongoose.model("FEL"),
aBSREL = mongoose.model("aBSREL"),
Busted = mongoose.model("Busted"),
FUBAR = mongoose.model("FUBAR"),
GARD = mongoose.model("GARD"),
MEME = mongoose.model("MEME"),
Relax = mongoose.model("Relax"),
HivTrace = mongoose.model("HivTrace"),
Fade = mongoose.model("Fade"),
SLAC = mongoose.model("SLAC");

exports.getResults = function(model_up, req, res) {
model_up.findOne({ _id: req.params.id }, function(err, model_var) {
if (err || !model_var) {
res.json(500, error.errorResponse("invalid id : " + req.params.id));
} else {
// Append PMID to results
fs.readFile(model_var.results_path, "utf8", (err, results) => {
if (err) winston.warn(err);
var model_var_results = JSON.parse(results);
model_var_results["PMID"] = model_up.pmid;
res.json(200, model_var_results);
});
}
});
};
21 changes: 0 additions & 21 deletions app/routes/busted.js
Expand Up @@ -217,27 +217,6 @@ exports.getInfo = function(req, res) {
);
};

/**
* Displays id page for analysis
* app.get('/busted/:bustedid/results', busted.getBustedResults);
*/
exports.getResults = function(req, res) {
var bustedid = req.params.bustedid;

//Return all results
Busted.findOne({ _id: bustedid }, function(err, busted) {
if (err || !busted) {
res.json(500, error.errorResponse("invalid id : " + bustedid));
} else {
// Should return results page
// append file information
var busted_results = JSON.parse(busted.results);
busted_results["input_data"] = busted.input_data;
res.json(200, busted_results);
}
});
};

exports.resubscribePendingJobs = function(req, res) {
Busted.subscribePendingJobs();
};
Expand Down
21 changes: 0 additions & 21 deletions app/routes/fade.js
Expand Up @@ -205,27 +205,6 @@ exports.getInfo = function(req, res) {
);
};

/**
* Displays id page for analysis
* app.get('/msa/:msaid/fade/:fadeid/results', fade.getFadeResults);
*/
exports.getResults = function(req, res) {
var fadeid = req.params.fadeid;

//Return all results
Fade.findOne({ _id: fadeid }, function(err, fade) {
if (err || !fade) {
res.json(500, error.errorResponse("invalid id : " + fadeid));
} else {
// Should return results page
res.json(200, {
results: JSON.parse(fade.results),
msa: fade.msa[0]
});
}
});
};

exports.resubscribePendingJobs = function(req, res) {
Fade.subscribePendingJobs();
};
Expand Down
17 changes: 0 additions & 17 deletions app/routes/fel.js
Expand Up @@ -200,22 +200,6 @@ exports.getPage = function(req, res) {
});
};

exports.getResults = function(req, res) {
var felid = req.params.id;

FEL.findOne({ _id: felid }, function(err, fel) {
if (err || !fel) {
res.json(500, error.errorResponse("invalid id : " + felid));
} else {
// Should return results page
// Append PMID to results
var fel_results = JSON.parse(fel.results);
fel_results["PMID"] = fel.pmid;
res.json(200, fel_results);
}
});
};

// app.get('/fel/:id/info', fel.getInfo);
exports.getInfo = function(req, res) {
var id = req.params.id;
Expand All @@ -228,7 +212,6 @@ exports.getInfo = function(req, res) {
if (err || !fel_info) {
res.json(500, error.errorResponse("Invalid ID : " + id));
} else {
// Should return results page
res.json(200, fel_info);
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/routes/flea.js
Expand Up @@ -73,6 +73,7 @@ exports.invoke = function(req, res) {
res.json(500, { error: err });
} else {
// Send the MSA and analysis type
//
var connect_callback = function(err, result) {
logger.log(result);
};
Expand All @@ -96,7 +97,7 @@ exports.invoke = function(req, res) {
if (err) {
was_error = true;
} else {
if (count == flea_files.length) {
if (count == flea_files.length || flea_files.length == 1) {
if (err) {
respond_with_json("failure", "");
} else {
Expand Down
16 changes: 0 additions & 16 deletions app/routes/fubar.js
Expand Up @@ -119,22 +119,6 @@ exports.getPage = function(req, res) {
});
};

exports.getResults = function(req, res) {
var fubarid = req.params.id;
FUBAR.findOne({ _id: fubarid }, function(err, fubar) {
if (err || !fubar) {
logger.error("invalid id : " + fubarid);
res.json(500, error.errorResponse("invalid id : " + fubarid));
} else {
// Should return results page
// Append PMID to results
var fubar_results = JSON.parse(fubar.results);
fubar_results["PMID"] = fubar.pmid;
res.json(200, fubar_results);
}
});
};

// app.get('/fubar/:id/info', fubar.getInfo);
exports.getInfo = function(req, res) {
var id = req.params.id;
Expand Down
15 changes: 0 additions & 15 deletions app/routes/gard.js
Expand Up @@ -116,21 +116,6 @@ exports.getPage = function(req, res) {
});
};

exports.getResults = function(req, res) {
var gardid = req.params.id;
GARD.findOne({ _id: gardid }, function(err, gard) {
if (err || !gard) {
res.json(500, error.errorResponse("invalid id : " + gardid));
} else {
// Should return results page
// Append PMID to results
var gard_results = JSON.parse(gard.results);
gard_results["PMID"] = gard.pmid;
res.json(200, gard_results);
}
});
};

// app.get('/gard/:id/info', gard.getInfo);
exports.getInfo = function(req, res) {
var id = req.params.id;
Expand Down
15 changes: 0 additions & 15 deletions app/routes/meme.js
Expand Up @@ -110,21 +110,6 @@ exports.getPage = function(req, res) {
});
};

exports.getResults = function(req, res) {
var memeid = req.params.id;
MEME.findOne({ _id: memeid }, function(err, meme) {
if (err || !meme) {
res.json(500, error.errorResponse("invalid id : " + memeid));
} else {
// Should return results page
// Append PMID to results
var meme_results = JSON.parse(meme.results);
meme_results["PMID"] = meme.pmid;
res.json(200, meme_results);
}
});
};

// app.get('/meme/:id/info', meme.getInfo);
exports.getInfo = function(req, res) {
var id = req.params.id;
Expand Down
22 changes: 0 additions & 22 deletions app/routes/relax.js
Expand Up @@ -192,28 +192,6 @@ exports.getPage = function(req, res) {
});
};

/**
* Displays id page for analysis
* app.get('/msa/:msaid/relax/:relaxid/results', relax.getRelaxResults);
*/
exports.getResults = function(req, res) {
var relaxid = req.params.id;

//Return all results
Relax.findOne({ _id: relaxid }, function(err, relax) {
if (err || !relax) {
res.json(500, error.errorResponse("invalid id : " + relaxid));
} else {
// Should return results page
// Append PMID to results
var relax_results = JSON.parse(relax.results);
relax_results["PMID"] = relax.pmid;
relax_results["input_data"] = relax.input_data;
res.json(200, relax_results);
}
});
};

/**
* Handles a job request by the user
* app.post('/msa/:msaid/relax', Relax.invokeRelax);
Expand Down
15 changes: 0 additions & 15 deletions app/routes/slac.js
Expand Up @@ -110,21 +110,6 @@ exports.getPage = function(req, res) {
});
};

exports.getResults = function(req, res) {
var slacid = req.params.id;
SLAC.findOne({ _id: slacid }, function(err, slac) {
if (err || !slac) {
res.json(500, error.errorResponse("invalid id : " + slacid));
} else {
// Should return results page
// Append PMID to results
var slac_results = JSON.parse(slac.results);
slac_results["PMID"] = slac.pmid;
res.json(200, slac_results);
}
});
};

// app.get('/slac/:id/info', slac.getInfo);
exports.getInfo = function(req, res) {
var id = req.params.id;
Expand Down
8 changes: 4 additions & 4 deletions app/templates/busted/upload_msa.ejs
Expand Up @@ -72,17 +72,17 @@
</div>

<div class="form-group <%if (typeof errors != "undefined" && typeof errors.mail != "undefined") { %>has-error<% } %>">
<label id="datatype-content" class="col-lg-3 control-label">Notify When Completed?</label>
<label id="datatype-content" class="control-label">Notify When Completed?</label>
<div class="col-lg-9 input-group mail-group">
<span class="input-group-addon">
<input name="receive_mail" type="checkbox" value="on" checked>
</span>
<input name="mail" type="text" class="form-control" placeholder="Email Address">
</div>
</div><!-- /form-group -->
<button type="submit" class="btn pull-right">
<span class="glyphicon dm-continue-btn fas fa-play"></span>
</button>
<button type="submit" class="continue-btn btn">
Run Analysis
<span class="dm-continue-btn fas fa-play"></span></button>
</form>
</div>

Expand Down
8 changes: 4 additions & 4 deletions app/templates/fel/msa_form.ejs
Expand Up @@ -86,7 +86,7 @@
</div>

<div class="form-group <%if (typeof errors != "undefined" && typeof errors.mail != "undefined") { %>has-error<% } %>">
<label id="datatype-content" class="col-lg-3 control-label">Notify When Completed?</label>
<label id="datatype-content" class="control-label">Notify When Completed?</label>
<div class="col-lg-9 input-group mail-group">
<span class="input-group-addon">
<input name="receive_mail" type="checkbox" value="on" checked>
Expand All @@ -95,9 +95,9 @@
</div>
</div><!-- /form-group -->

<button type="submit" class="btn pull-right">
<span class="dm-continue-btn fas fa-play"></span>
</button>
<button type="submit" class="continue-btn btn">
Run Analysis
<span class="dm-continue-btn fas fa-play"></span></button>

</form>
</div>
Expand Down
4 changes: 3 additions & 1 deletion app/templates/flea/form.ejs
Expand Up @@ -74,7 +74,9 @@
</div>
<div id="modal-error-msg" class="modal-body text-danger">This is my error message</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-primary" type="button">Close</button>
<button type="submit" class="continue-btn btn">
Run Analysis
<span class="dm-continue-btn fas fa-play"></span></button>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/gard/results.ejs
Expand Up @@ -19,7 +19,7 @@
if (fasta_ready == false) {
$(document).ready( function () {
hyphyVision.gard($("#job-report").data('jobid') + '/results', "content", nul, true, true)
hyphyVision.gard($("#job-report").data('jobid') + '/results', "content", null, true, true)
});
}
Expand Down

0 comments on commit 5bc1430

Please sign in to comment.