Skip to content

Commit

Permalink
#752 -- adding new fel options
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenweaver committed Nov 26, 2024
1 parent 122fa7d commit 574a0d3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
16 changes: 13 additions & 3 deletions app/models/fel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ var FEL = mongoose.Schema({
resample: Number,
ci: Boolean,
bootstrap: Boolean,
multiple_hits: {
type: String,
enum: ["None", "Double", "Double+Triple"],
default: "None",
},
site_multihit: {
type: String,
enum: ["Estimate", "Global"],
default: "Estimate",
},
});

FEL.add(AnalysisSchema);
Expand Down Expand Up @@ -47,7 +57,7 @@ FEL.virtual("original_fn").get(function () {
"/../../uploads/msa/" +
this._id +
"-original." +
this.original_extension
this.original_extension,
);
});

Expand Down Expand Up @@ -123,7 +133,7 @@ FEL.statics.spawn = function (fn, options, callback) {
} else {
var move = Msa.removeTreeFromFile(
fel_result.filepath,
fel_result.filepath
fel_result.filepath,
);
move.then(
(val) => {
Expand All @@ -137,7 +147,7 @@ FEL.statics.spawn = function (fn, options, callback) {
},
(reason) => {
callback(err, "issue removing tree from file");
}
},
);
}
}
Expand Down
10 changes: 7 additions & 3 deletions app/routes/fel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ exports.uploadFile = function (req, res) {
fel.original_extension = path.basename(fn).split(".")[1];
fel.mail = postdata.mail;
fel.ci = postdata.confidence_interval == "true";
fel.multiple_hits = postdata.multiple_hits;
fel.site_multihit = postdata.site_multihit;

// Check advanced options
if (!_.isNaN(resample)) {
Expand Down Expand Up @@ -87,7 +89,7 @@ exports.uploadFile = function (req, res) {
} else {
var move = Msa.removeTreeFromFile(
fel_result.filepath,
fel_result.filepath
fel_result.filepath,
);
move.then(
(val) => {
Expand All @@ -98,7 +100,7 @@ exports.uploadFile = function (req, res) {
},
(reason) => {
res.json(500, { error: "issue removing tree from file" });
}
},
);
}
}
Expand All @@ -116,7 +118,7 @@ exports.uploadFile = function (req, res) {
helpers.moveSafely(
req.files.files.file,
fel_result.filepath,
move_cb
move_cb,
);
});
});
Expand Down Expand Up @@ -148,6 +150,8 @@ exports.invoke = function (req, res) {
// User Parameters
fel.tagged_nwk_tree = postdata.nwk_tree;
fel.analysis_type = postdata.analysis_type;
fel.multiple_hits = postdata.multiple_hits; // new
fel.site_multihit = postdata.site_multihit; // new
fel.status = fel.status_stack[0];

fel.save(function (err, result) {
Expand Down
16 changes: 16 additions & 0 deletions app/templates/fel/msa_form.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@
</select>
</div>

<div class="form-group">
<label for="multiple-hits">Multiple Hits</label>
<select name="multiple_hits" id="multiple-hits">
<option value="None">None (Single mutations only)</option>
<option value="Double">Double (Branch-specific rates for double substitutions)</option>
<option value="Double+Triple">Double+Triple (Branch-specific rates for double and triple substitutions)</option>
</select>
</div>

<div class="form-group">
<label for="estimated-rates">Site Multihit</label>
<select name="site_multihit" id="site-multihit">
<option value="Estimate">Estimate (Branch-specific rates for substitutions based on model fit)</option>
<option value="Global">Global (Rates derived from global model fit)</option>
</select>
</div>

<div class="form-group <%if (typeof errors != "undefined" && typeof errors.mail != "undefined") { %>has-error<% } %>">
<label id="datatype-content" class="control-label">Notify When Completed?</label>
Expand Down
8 changes: 5 additions & 3 deletions public/assets/js/fel/msa_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ $(function () {
formData.append("gencodeid", $("select[name='gencodeid']").val());
formData.append("ds_variation", $("#ds-variation").val());
formData.append("resample", $("#resample").val());
formData.append("multiple_hits", $("select[name='multiple_hits']").val());
formData.append("site_multihit", $("select[name='site_multihit']").val());

formData.append(
"receive_mail",
$("input[name='receive_mail']").prop("checked")
$("input[name='receive_mail']").prop("checked"),
);

formData.append("mail", $("input[name='mail']").val());

formData.append(
"confidence_interval",
$("input[name='confidence-interval']").prop("checked")
$("input[name='confidence-interval']").prop("checked"),
);

var action_url = $("#msa-form").attr("action");
Expand Down Expand Up @@ -64,7 +66,7 @@ $(function () {
window.location.href = result.upload_redirect_path;
} else {
$("#modal-error-msg").text(
"We received data in an unexpected format from the server."
"We received data in an unexpected format from the server.",
);
$("#errorModal").modal();
$("#file-progress").css("display", "none");
Expand Down

0 comments on commit 574a0d3

Please sign in to comment.