Skip to content

Commit

Permalink
Merge pull request #131 from veg/develop
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
stevenweaver committed Sep 26, 2018
2 parents 1dbfc70 + c9171b2 commit c8269b4
Show file tree
Hide file tree
Showing 117 changed files with 7,498 additions and 6,761 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ public/assets/js/datamonkey.css*
public/assets/js/datamonkey.js* public/assets/js/datamonkey.js*
*vendor* *vendor*
*.aa *.aa
dump.rdb

.DS_Store
.yalc/
yalc.lock
21 changes: 11 additions & 10 deletions .travis.yml
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js language: node_js


services: services:
- mongodb - mongodb
- redis-server - redis-server


Expand All @@ -10,18 +10,19 @@ node_js:
sudo: false sudo: false


notifications: notifications:
email: email:
recipients: recipients:
- spond@temple.edu - spond@temple.edu
- steven@stevenweaver.org - steven@stevenweaver.org
- sshank@temple.edu - sshank@temple.edu
on_success: always on_success: always
on_failure: always on_failure: always


branches: branches:
only: only:
- master - master
- develop - develop
- bootstrap4


cache: cache:
yarn: true yarn: true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ install:
@cd ./.tn93/ && cmake . && make && cd ../ @cd ./.tn93/ && cmake . && make && cd ../
@yarn install @yarn install
@webpack @webpack
@mkdir -p ./uploads/msa ./uploads/hivtrace; @mkdir -p ./uploads/msa ./uploads/hivtrace ./results/jobs/;
2 changes: 1 addition & 1 deletion README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ Start datamonkey.js


node server.js node server.js


Datamonkey should now be running at [localhost:4000](http://localhost:4000). Datamonkey should now be running at [localhost:4002](http://localhost:4002).
8 changes: 7 additions & 1 deletion app/models/absrel.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ aBSREL.virtual("filepath").get(function() {
* Original file path for document's file upload * Original file path for document's file upload
*/ */
aBSREL.virtual("original_fn").get(function() { aBSREL.virtual("original_fn").get(function() {
return path.resolve(__dirname + "/../../uploads/msa/" + this._id + "-original." + this.original_extension); return path.resolve(
__dirname +
"/../../uploads/msa/" +
this._id +
"-original." +
this.original_extension
);
}); });


/** /**
Expand Down
47 changes: 29 additions & 18 deletions app/models/analysis.js
Original file line number Original file line Diff line number Diff line change
@@ -1,17 +1,18 @@
var mongoose = require("mongoose"), var mongoose = require("mongoose"),
globals = require("../../config/globals.js"), globals = require("../../config/globals.js"),
setup = require("./../../config/setup"),
moment = require("moment"), moment = require("moment"),
_ = require("underscore"), _ = require("underscore"),
winston = require("winston"), winston = require("winston"),
hpcsocket = require(__dirname + "/../../lib/hpcsocket.js"), hpcsocket = require(__dirname + "/../../lib/hpcsocket.js"),
Msa = require(__dirname + "/msa"), Msa = require(__dirname + "/msa"),
extend = require("mongoose-schema-extend"); extend = require("mongoose-schema-extend");


var redis = require('redis'), var redis = require("redis"),
client = redis.createClient(); client = redis.createClient();


var Schema = mongoose.Schema, ObjectId = Schema.ObjectId; var Schema = mongoose.Schema,

ObjectId = Schema.ObjectId;


var AnalysisSchema = new Schema({ var AnalysisSchema = new Schema({
msa: [Msa.MsaSchema], msa: [Msa.MsaSchema],
Expand Down Expand Up @@ -39,10 +40,15 @@ AnalysisSchema.virtual("since_created").get(function() {
* Original file path for document's file upload * Original file path for document's file upload
*/ */
AnalysisSchema.virtual("original_fn").get(function() { AnalysisSchema.virtual("original_fn").get(function() {
return path.resolve(__dirname + "/../../uploads/msa/" + this._id + "-original." + this.original_extension); return path.resolve(
__dirname +
"/../../uploads/msa/" +
this._id +
"-original." +
this.original_extension
);
}); });



AnalysisSchema.virtual("max_sites").get(function() { AnalysisSchema.virtual("max_sites").get(function() {
return 12000; return 12000;
}); });
Expand Down Expand Up @@ -77,13 +83,11 @@ AnalysisSchema.statics.pendingJobs = function(cb) {
}; };


AnalysisSchema.statics.submitJob = function(job, cb) { AnalysisSchema.statics.submitJob = function(job, cb) {

winston.info( winston.info(
"submitting " + job.analysistype + " : " + job._id + " to cluster" "submitting " + job.analysistype + " : " + job._id + " to cluster"
); );


var jobproxy = new hpcsocket.HPCSocket( var jobproxy = new hpcsocket.HPCSocket(

{ {
filepath: job.filepath, filepath: job.filepath,
msa: job.msa, msa: job.msa,
Expand All @@ -94,7 +98,6 @@ AnalysisSchema.statics.submitJob = function(job, cb) {
"spawn", "spawn",
cb cb
); );

}; };


AnalysisSchema.statics.subscribePendingJobs = function() { AnalysisSchema.statics.subscribePendingJobs = function() {
Expand All @@ -114,10 +117,10 @@ AnalysisSchema.statics.usageStatistics = function(cb) {
.sort({ created: -1 }) .sort({ created: -1 })
.limit(1) .limit(1)
.exec(function(err1, items1) { .exec(function(err1, items1) {
if (err1 || items1.length == 0){ if (err1 || items1.length == 0) {
cb(err1, null); cb(err1, null);
return; return;
}; }
self self
.find( .find(
{ {
Expand All @@ -134,12 +137,15 @@ AnalysisSchema.statics.usageStatistics = function(cb) {
} }
) )
.exec(function(err, items) { .exec(function(err, items) {
client.set(self.collection.name + "_job_stats", JSON.stringify(items), (err, reply) => {}); client.set(
setup.database_name + "_" + self.collection.name + "_job_stats",
JSON.stringify(items),
(err, reply) => {}
);
cb(err, items); cb(err, items);

});
}); });
}); };
};
/** /**
* unix timestamp * unix timestamp
*/ */
Expand All @@ -153,6 +159,12 @@ AnalysisSchema.virtual("generic_error_msg").get(function() {
return error_msg; return error_msg;
}); });


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

AnalysisSchema.methods.resubscribe = function() { AnalysisSchema.methods.resubscribe = function() {
var jobproxy = new hpcsocket.HPCSocket( var jobproxy = new hpcsocket.HPCSocket(
{ {
Expand Down Expand Up @@ -181,8 +193,7 @@ AnalysisSchema.methods.cancel = function(callback) {
}; };


AnalysisSchema.statics.cachePath = function() { AnalysisSchema.statics.cachePath = function() {
return this.collection.name + "_job_stats"; return setup.database_name + "_" + this.collection.name + "_job_stats";
}; };



module.exports = AnalysisSchema; module.exports = AnalysisSchema;
4 changes: 4 additions & 0 deletions app/models/busted.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Busted.virtual("status_stack").get(function() {
return ["queue", "running", "completed"]; return ["queue", "running", "completed"];
}); });


Busted.virtual("upload_redirect_path").get(function() {
return path.join("/busted/", String(this._id), "/select-foreground");
});

/** /**
* Complete file path for document's file upload * Complete file path for document's file upload
*/ */
Expand Down
8 changes: 7 additions & 1 deletion app/models/fel.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ FEL.virtual("filepath").get(function() {
* Original file path for document's file upload * Original file path for document's file upload
*/ */
FEL.virtual("original_fn").get(function() { FEL.virtual("original_fn").get(function() {
return path.resolve(__dirname + "/../../uploads/msa/" + this._id + "-original." + this.original_extension); return path.resolve(
__dirname +
"/../../uploads/msa/" +
this._id +
"-original." +
this.original_extension
);
}); });


/** /**
Expand Down
2 changes: 0 additions & 2 deletions app/models/flea.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ Flea.virtual("pdb_structure").get(function() {
return __dirname + "/../../public/assets/flea/pdbs/env_structure.pdb"; return __dirname + "/../../public/assets/flea/pdbs/env_structure.pdb";
}); });




/** /**
* URL for a envmonkey path * URL for a envmonkey path
*/ */
Expand Down
3 changes: 1 addition & 2 deletions app/models/gard.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ GARD.virtual("filepath").get(function() {
}); });


/** /**
* Result NEXUS file * Result NEXUS file
*/ */
GARD.virtual("result_nexus_fn").get(function() { GARD.virtual("result_nexus_fn").get(function() {
return __dirname + "/../../uploads/msa/" + this._id + ".gard.result.nex"; return __dirname + "/../../uploads/msa/" + this._id + ".gard.result.nex";
}); });



/** /**
* Filename of document's file upload * Filename of document's file upload
*/ */
Expand Down
38 changes: 18 additions & 20 deletions app/models/hivtrace.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ var error_codes = {
FAILED_ASSIGNMENT: 1 FAILED_ASSIGNMENT: 1
}; };


var Schema = mongoose.Schema, ObjectId = Schema.ObjectId; var Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;


function notEmptyValidator(val) { function notEmptyValidator(val) {
return val !== null; return val !== null;
Expand Down Expand Up @@ -107,7 +108,7 @@ var HivTrace = new Schema({
validate: [notEmptyValidator, "Ambiguity Handling field is empty"] validate: [notEmptyValidator, "Ambiguity Handling field is empty"]
}, },
sequence_length: Number, sequence_length: Number,
job_started : { type: Boolean, default:false }, job_started: { type: Boolean, default: false },
status_stack: Array, status_stack: Array,
status: { status: {
type: String type: String
Expand Down Expand Up @@ -208,29 +209,29 @@ HivTrace.virtual("analysistype").get(function() {
}); });


/** /**
* file path for aligned document * file path for aligned document
*/ */
HivTrace.virtual("aligned_fasta_fn").get(function() { HivTrace.virtual("aligned_fasta_fn").get(function() {
return __dirname + "/../../uploads/hivtrace/" + this._id + ".aligned.fa"; return __dirname + "/../../uploads/hivtrace/" + this._id + ".aligned.fa";
}); });


/** /**
* file path for trace results * file path for trace results
*/ */
HivTrace.virtual("trace_results").get(function() { HivTrace.virtual("trace_results").get(function() {
return __dirname + "/../../uploads/hivtrace/" + this._id + ".trace.json"; return __dirname + "/../../uploads/hivtrace/" + this._id + ".trace.json";
}); });


/** /**
* file path for trace results * file path for trace results
*/ */
HivTrace.virtual("rel_trace_results").get(function() { HivTrace.virtual("rel_trace_results").get(function() {
return this._id + ".trace.json"; return this._id + ".trace.json";
}); });


/** /**
* relative file path for aligned document * relative file path for aligned document
*/ */
HivTrace.virtual("rel_aligned_fasta_fn").get(function() { HivTrace.virtual("rel_aligned_fasta_fn").get(function() {
return this._id + ".aligned.fa"; return this._id + ".aligned.fa";
}); });
Expand All @@ -257,7 +258,7 @@ HivTrace.virtual("status_index").get(function() {
* Percentage of job complete * Percentage of job complete
*/ */
HivTrace.virtual("percentage_complete").get(function() { HivTrace.virtual("percentage_complete").get(function() {
return (this.status_index + 1) / this.status_stack.length * 100 + "%"; return ((this.status_index + 1) / this.status_stack.length) * 100 + "%";
}); });


/** /**
Expand All @@ -275,7 +276,6 @@ HivTrace.virtual("url").get(function() {
}); });


HivTrace.methods.saveAttributes = function(cb) { HivTrace.methods.saveAttributes = function(cb) {

var self = this; var self = this;


// Once annotations are configured, save the mapped attributes so that we // Once annotations are configured, save the mapped attributes so that we
Expand All @@ -290,19 +290,16 @@ HivTrace.methods.saveAttributes = function(cb) {
}); });


var patient_attributes = _.map(headers, function(d) { var patient_attributes = _.map(headers, function(d) {

var attrs = d.split(delimiter); var attrs = d.split(delimiter);
var key_val = _.object(annotations, attrs); var key_val = _.object(annotations, attrs);
key_val["header"] = d; key_val["header"] = d;
return key_val; return key_val;

}); });


// save attributes for each patient // save attributes for each patient
self.patient_attributes = patient_attributes; self.patient_attributes = patient_attributes;


cb(null, self); cb(null, self);

}; };


HivTrace.methods.addAttributesToResults = function(cb) { HivTrace.methods.addAttributesToResults = function(cb) {
Expand All @@ -312,9 +309,9 @@ HivTrace.methods.addAttributesToResults = function(cb) {
var attr_keys = _.keys(attributes[0]); var attr_keys = _.keys(attributes[0]);


var category_map = { var category_map = {
"categorical" : "String", categorical: "String",
"individual" : "String", individual: "String",
"temporal" : "Date" temporal: "Date"
}; };


// transform attributes to be a dictionary // transform attributes to be a dictionary
Expand All @@ -337,6 +334,7 @@ HivTrace.methods.addAttributesToResults = function(cb) {


// read from trace results // read from trace results
fs.readFile(self.trace_results, function(err, 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) { if (err) {
cb(err, null); cb(err, null);
return; return;
Expand Down Expand Up @@ -456,10 +454,10 @@ HivTrace.statics.usageStatistics = function(cb) {
.sort({ created: -1 }) .sort({ created: -1 })
.limit(1) .limit(1)
.exec(function(err1, items1) { .exec(function(err1, items1) {
if (err1 || items1.length == 0){ if (err1 || items1.length == 0) {
cb(err1, null); cb(err1, null);
return; return;
}; }
self self
.find( .find(
{ {
Expand Down
Loading

0 comments on commit c8269b4

Please sign in to comment.