Skip to content

Commit

Permalink
Merge pull request #260 from veg/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
stevenweaver authored Apr 29, 2020
2 parents 298a3d7 + e8ea20a commit 6c9f3fc
Show file tree
Hide file tree
Showing 84 changed files with 1,987 additions and 340 deletions.
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"plugins": [
"@babel/plugin-proposal-class-properties"
],
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"env": {
"start": {
"presets": [
"@babel/preset-env"
]
}
}
}
3 changes: 0 additions & 3 deletions AUTHORS

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ datamonkey-js
INSTALL
===========================
## System Dependencies
* node >= 12
* node >= 14
* mongodb-server
* redis

Expand Down
64 changes: 64 additions & 0 deletions app/models/contrast-fel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var mongoose = require("mongoose"),
extend = require("mongoose-schema-extend"),
path = require("path"),
Msa = require(__dirname + "/msa");

var AnalysisSchema = require(__dirname + "/analysis");

var ContrastFEL = AnalysisSchema.extend({
tagged_nwk_tree: String,
analysis_type: Number,
original_extension: String,
last_status_msg: String,
branch_sets: [String],
results: Object,
ds_variation: Number
});

ContrastFEL.virtual("pmid").get(function() {
return "22807683";
});

ContrastFEL.virtual("analysistype").get(function() {
return "cfel";
});

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

/**
* Complete file path for document's file upload
*/
ContrastFEL.virtual("filepath").get(function() {
return path.join(__dirname, "/../../uploads/msa/", this._id + ".fasta");
});

/**
* Original file path for document's file upload
*/
ContrastFEL.virtual("original_fn").get(function() {
return path.resolve(
__dirname +
"/../../uploads/msa/" +
this._id +
"-original." +
this.original_extension
);
});

/**
* Filename of document's file upload
*/
ContrastFEL.virtual("status_stack").get(function() {
return ["queue", "running", "completed"];
});

/**
* URL for a busted path
*/
ContrastFEL.virtual("url").get(function() {
return "http://" + setup.host + "/contrast_fel/" + this._id;
});

module.exports = mongoose.model("ContrastFEL", ContrastFEL);
2 changes: 1 addition & 1 deletion app/models/gard.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ GARD.virtual("status_stack").get(function() {
});

/**
* URL for a busted path
* URL for GARD path
*/
GARD.virtual("url").get(function() {
return "http://" + setup.host + "/gard/" + this._id;
Expand Down
2 changes: 0 additions & 2 deletions app/models/hivtrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ path = require("path");
var mongoose = require("mongoose"),
moment = require("moment"),
d3 = require("d3"),
check = require("validator").check,
globals = require("../../config/globals.js"),
sanitize = require("validator").sanitize,
fs = require("fs"),
readline = require("readline"),
spawn = require("child_process").spawn,
Expand Down
15 changes: 1 addition & 14 deletions app/models/msa.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
var mongoose = require("mongoose"),
moment = require("moment"),
check = require("validator").check,
globals = require("../../config/globals.js"),
spawn = require("child_process").spawn,
sanitize = require("validator").sanitize,
fs = require("fs"),
winston = require("winston"),
_ = require("lodash"),
Expand Down Expand Up @@ -66,7 +64,6 @@ var Msa = new Schema({
visit_code: String,
visit_date: Date,
original_filename: String,
mailaddr: String,
created: {
type: Date,
default: Date.now
Expand Down Expand Up @@ -193,16 +190,6 @@ Msa.statics.deliverFasta = function(filepath) {

var MsaModel = mongoose.model("MsaModel", Msa);

MsaModel.schema.path("mailaddr").validate(function(value) {
if (value) {
check(value)
.len(6, 64)
.isEmail();
} else {
return true;
}
}, "Invalid email");

Msa.methods.AnalysisCount = function(cb) {
var type_counts = {};
var c = 0;
Expand Down Expand Up @@ -397,7 +384,7 @@ Msa.statics.parseFile = function(fn, datatype, gencodeid, cb) {
msa.gencodeid = file_info.gencodeid;
msa.sites = file_info.sites;
msa.sequences = file_info.sequences;
msa.timestamp = file_info.timestamp;
msa.timestamp = _.trim(file_info.timestamp);
msa.goodtree = file_info.goodtree;
msa.nj = file_info.nj;
msa.usertree = fpi[0].usertree;
Expand Down
49 changes: 49 additions & 0 deletions app/models/multihit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
var mongoose = require("mongoose"),
extend = require("mongoose-schema-extend"),
winston = require("winston"),
path = require("path"),
Msa = require(__dirname + "/msa");

var AnalysisSchema = require(__dirname + "/analysis");

var MULTIHIT = AnalysisSchema.extend({
last_status_msg: String,
results: Object,
triple_islands: String,
rate_classes: Number
});

MULTIHIT.virtual("analysistype").get(function() {
return "multihit";
});

MULTIHIT.virtual("pmid").get(function() {
return "TBD";
});

/**
* Filename of document's file upload
*/
MULTIHIT.virtual("status_stack").get(function() {
return ["queue", "running", "completed"];
});

MULTIHIT.virtual("upload_redirect_path").get(function() {
return path.join("/multihit/", String(this._id));
});

/**
* Complete file path for document's file upload
*/
MULTIHIT.virtual("filepath").get(function() {
return path.resolve(__dirname + "/../../uploads/msa/" + this._id + ".fasta");
});

/**
* URL for a multihit path
*/
MULTIHIT.virtual("url").get(function() {
return "http://" + setup.host + "/multihit/" + this._id;
});

module.exports = mongoose.model("MULTIHIT", MULTIHIT);
3 changes: 3 additions & 0 deletions app/routes/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ var mongoose = require("mongoose"),
Sequences = mongoose.model("Sequences"),
PartitionInfo = mongoose.model("PartitionInfo"),
FEL = mongoose.model("FEL"),
ContrastFEL = mongoose.model("ContrastFEL"),
aBSREL = mongoose.model("aBSREL"),
Busted = mongoose.model("Busted"),
FUBAR = mongoose.model("FUBAR"),
GARD = mongoose.model("GARD"),
MEME = mongoose.model("MEME"),
MULTIHIT = mongoose.model("MULTIHIT"),
Relax = mongoose.model("Relax"),
HivTrace = mongoose.model("HivTrace"),
Fade = mongoose.model("Fade"),
Expand All @@ -40,6 +42,7 @@ exports.getInfo = function(model_up, req, res) {
};

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));
Expand Down
Loading

0 comments on commit 6c9f3fc

Please sign in to comment.