From 7cea5c31def2b3da66e539648270ae5907ebcd46 Mon Sep 17 00:00:00 2001 From: "j.belova" Date: Sat, 5 Mar 2022 13:07:41 +0300 Subject: [PATCH 1/4] OG-609 orthologs to purple form --- app/assets/js/gene.js | 74 ++++++++++++++-- app/controllers/GeneController.php | 7 +- app/models/LifespanExperiment.php | 87 +++++++++++++++---- app/models/Ortholog.php | 73 ++++++++++++++++ app/widgets/views/full/lifespanExperiment.php | 23 +++++ 5 files changed, 241 insertions(+), 23 deletions(-) diff --git a/app/assets/js/gene.js b/app/assets/js/gene.js index 011d3b37..9c5298c1 100644 --- a/app/assets/js/gene.js +++ b/app/assets/js/gene.js @@ -177,12 +177,76 @@ $(document).on('click', '#experiments-form .js-experiment-short', function() { $(document).on('click', '#experiments-form .js-lifespan-experiment-short', function() { let modelId = $(this).attr('model-id') - let container = $(this).closest('.js-short-form-container') + let container = $(this).closest('.js-short-form-container') $.get('/gene/load-widget-form?modelName=LifespanExperiment&widgetName=GeneralLifespanExperimentWidget&id=' - +modelId - +'&modelParams[gene_id]='+$(this).attr('gene-id') - +'&modelParams[type]=experiment' - +'&geneId='+$(this).attr('gene-id'), function (data) { + + modelId + + '&modelParams[gene_id]=' + $(this).attr('gene-id') + + '&modelParams[type]=experiment' + + '&geneId=' + $(this).attr('gene-id'), function (data) { container.html(data); + }) +}) + +$(document).on('change', '#experiments-form .js-lifespan-experiment-block [id$="model_organism_id"]', function() { + let t = $(this); + let model_organism_id = t.val(); + let gene_id = $('.js-lifespan-experiment-block [name$="[currentGeneId]"]').val(); + $.get('/gene/get-orthologs?modelOrganismId='+model_organism_id+'&geneId='+gene_id, function (data) { + let orthologs = JSON.parse(data); + let select = t.parents('.js-lifespan-experiment').find('.js-lifespan-experiments-gene .orthologs'); + select.empty(); + let options = Object.entries(orthologs); + for (const [id, symbol] of options) { + select.append($('