diff --git a/.gitignore b/.gitignore index a9e5258..dfb90b9 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ dist .sass-cache app/components app/data +db/sh python app/bower_components npm-debug.log diff --git a/app/configurations/atlas.json b/app/configurations/atlas.json index 6c4ab7e..7d53694 100644 --- a/app/configurations/atlas.json +++ b/app/configurations/atlas.json @@ -1,6 +1,7 @@ { "default_genelist": ["BRCA1", "RAD51", "TP53", "KRAS", "CC2D1A"], "all_tags_url": "svc/datastores/FFN/LOOKUPS/all_tags", + "all_clinical_url": "svc/datastores/FFN/LOOKUPS/all_clinical", "maps": [ { "id": "mutations_combo", @@ -23,14 +24,6 @@ "url_suffix": "/mutation_summary" }, "mutsig": "datamodel/mutations/mutsig_rankings", - "features": { - "uri": "datamodel/tcga_datawarehouse", - "url_suffix": "/feature_matrix", - "base_query": { - "source": "GNAB", - "label": "y_n_somatic" - } - }, "mutated_samples": { "uri": "datamodel/tcga_datawarehouse", "url_suffix": "/mutated_samples" @@ -75,6 +68,9 @@ "url_suffix": "/feature_matrix", "query_clinical_variables": true } + }, + "feature_sources_order": { + "GEXP": 1 } } ] @@ -91,7 +87,10 @@ "view": "views/stacksvis/view", "label": "Distributions", "datamodels": { - "copy_number": "datamodel/copy_number/copy_number_gistic2", + "copy_number": { + "uri": "datamodel/tcga_datawarehouse", + "url_suffix": "/copy_number_gistic" + }, "q_value": "datamodel/copy_number/copy_number_qvalue", "mutated_samples": { "uri": "datamodel/tcga_datawarehouse", diff --git a/app/configurations/datamodel.json b/app/configurations/datamodel.json index 97ec131..7999ca7 100644 --- a/app/configurations/datamodel.json +++ b/app/configurations/datamodel.json @@ -141,7 +141,7 @@ "STAD-20140123": { "tumor_type": "STAD", "service": "datastores/dev_ffn_20140520/STAD", - "description": "This dataset was prepared from TCGA feature matrices aggregated at ISB", + "description": "This dataset was prepared from TCGA feature matrices aggregated at ISB.

STAD gene expression levels were available from RNAseq data as RPKM only, whereas levels for other tumor types were available in terms of RSEM (June 2014). To approximate RSEM values, STAD values were linearly transformed using the equation 4.550681+ STAD *1.271340. The coefficient were obtained from regressing median gene expression levels for COAD against those for STAD. COAD was selected over other tumor types due to anatomical proximity and the relative concordance of the distributions of the COAD and STAD medians.", "label": "STAD dataset for January 2014" } } @@ -149,11 +149,6 @@ "copy_number": { "label": "Copy Number Datasets", "catalog": { - "copy_number_gistic2": { - "label": "Copy Number Gistic (13sep)", - "service": "datastores/copy_number/qed_lookups/copyNumber_Gistic2_13sep", - "model": "models/gs/by_tumor_type" - }, "copy_number_qvalue": { "label": "Copy Number Q-Values", "service": "datastores/copy_number/qed_lookups/copy_number_qvalue" diff --git a/app/configurations/lookups.json b/app/configurations/lookups.json index 5d1ff06..096441e 100644 --- a/app/configurations/lookups.json +++ b/app/configurations/lookups.json @@ -8,9 +8,6 @@ "NA": "Other" } }, - "clinical_variables": { - "url": "svc/datastores/FFN/LOOKUPS/clinical_variables" - }, "chromosomes": { "url": "svc/data/lookups/chromosomes", "model": "models/annotations" diff --git a/app/index.html b/app/index.html index 5268de1..af1af51 100644 --- a/app/index.html +++ b/app/index.html @@ -65,7 +65,10 @@
Browser Display Dimensions
var increment = function () { progress += 10; try { - document.getElementById("progressbar").style.width = progress + "%"; + var progressbarEl = document.getElementById("progressbar"); + if (!progressbarEl) return; + + progressbarEl.style.width = progress + "%"; if (progress < 100) setTimeout(increment, 300); } catch (e) { console.error(e); diff --git a/app/scripts/models/gs/by_tumor_type.js b/app/scripts/models/gs/by_tumor_type.js index 5a11eca..82c3fa4 100644 --- a/app/scripts/models/gs/by_tumor_type.js +++ b/app/scripts/models/gs/by_tumor_type.js @@ -1,43 +1,32 @@ define(["jquery", "underscore", "backbone"], function ($, _, Backbone) { return Backbone.Model.extend({ - - initialize: function (options) { - _.extend(this, options); + initialize: function(attributes, options) { + this.set(this.parse(attributes)); }, parse: function (data) { - this.set("items", data.items); + var items = data["items"]; + this.set("items", items); - if (_.isEmpty(data.items)) { - return { "ROWS": [], "COLUMNS": [], "DATA": [] }; - } + if (_.isEmpty(items)) return { "ROWS": [], "COLUMNS": [], "DATA": [] }; - var itemsByTumorType = _.groupBy(data.items, "cancer"); - var dataByTumorType = {}; - _.each(itemsByTumorType, function (items, tumor_type) { - if (_.isEmpty(data.items)) { - dataByTumorType[tumor_type] = { "ROWS": [], "COLUMNS": [], "DATA": [] }; - } else { - var ROWS = _.pluck(items, "gene"); - var COLUMNS = _.pluck(items[0].values, "id"); - var coldict = {}; - _.each(COLUMNS, function (col, idx) { - coldict[col] = idx; - }); + var ROWS = _.pluck(items, "gene"); + var COLUMNS = _.keys(_.first(items)["values"]); + var coldict = {}; + _.each(COLUMNS, function (col, idx) { + coldict[col] = idx; + }); - var DATA = _.map(items, function (data_item) { - var row_array = []; - _.each(data_item.values, function (value_obj) { - row_array[coldict[value_obj.id]] = value_obj.v; - }); - return row_array; - }); - dataByTumorType[tumor_type] = { "ROWS": ROWS, "COLUMNS": COLUMNS, "DATA": DATA }; - } + var DATA = _.map(items, function (data_item) { + var row_array = []; + _.each(data_item["values"], function (value, id) { + row_array[coldict[id]] = value; + }); + return row_array; }); - return { "BY_TUMOR_TYPE": dataByTumorType }; + return { "ROWS": ROWS, "COLUMNS": COLUMNS, "DATA": DATA }; } }); }); diff --git a/app/scripts/models/gs/item_set.js b/app/scripts/models/gs/item_set.js new file mode 100644 index 0000000..e1d0ffc --- /dev/null +++ b/app/scripts/models/gs/item_set.js @@ -0,0 +1,82 @@ +define([ + "jquery", + "underscore", + "backbone" +], +function ($, _, Backbone +) { + var URL = "svc/collections/samplelists"; + + return Backbone.Collection.extend({ + "url": URL, + + "model": Backbone.Model.extend({ + idAttribute: "_id" + }), + + initialize: function() { + this.on("add", this.__add_handler, this); + this.on("remove", this.__remove_handler, this); + this.on("change", this.__change_handler, this); + }, + + __add_handler: function() { + + }, + + __remove_handler: function(model, collection, index) { + Backbone.sync("delete", new Backbone.Model({}), { + "url": URL + "/" + model["id"], "success": this.__refresh + }); + }, + + __change_handler: function() { + + }, + + __createModelForSync: function(model) { + var data = _.omit(model.toJSON(), "uri", "id", "_id"); + return new Backbone.Model(data); + }, + + updateSampleList: function(model_id, sample_list) { + var model = this.get(model_id); + var successFn = _.bind(function() { + model.trigger("change"); + }, this); + + model.set({ + samples: sample_list + }); + + this.sync("update", this.__createModelForSync(model), { + url: URL + "/" + model["id"], + success: successFn, + context: this + }); + }, + + updateSampleListByUnion: function(model_id, sample_list) { + var sample_id_set = this.get(model_id).get("samples"); + Array.prototype.push.apply(sample_id_set, sample_list); + this.updateSampleList(model_id, _.unique(sample_id_set)); + }, + + addSampleList: function(label, sample_id_array) { + var sample_list_model = new this.model({ + "label": label, + "samples": sample_id_array + }); + + var successFn = _.bind(function(response, status) { + this.add(_.extend(sample_list_model, {"id": response["id"]})); + }, this); + + this.sync("create", sample_list_model, { + url: URL, + success: successFn, + context: this + }); + } + }); +}); diff --git a/app/scripts/templates/datamodel_collector/container.hbs b/app/scripts/templates/datamodel_collector/container.hbs index 42283dc..6c029b9 100644 --- a/app/scripts/templates/datamodel_collector/container.hbs +++ b/app/scripts/templates/datamodel_collector/container.hbs @@ -21,7 +21,7 @@ Web Service API
{{label}}
- {{description}} + {{{description}}} {{#if publications}}
Related Publications