From a52a86cca05401b3d16119500c52aa1e72b771c9 Mon Sep 17 00:00:00 2001 From: bioi Date: Mon, 25 Apr 2016 15:54:35 -0400 Subject: [PATCH 1/3] Fixes to the expression loader biomaterial validator. --- includes/tripal_analysis_expression.chado_node.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/tripal_analysis_expression.chado_node.inc b/includes/tripal_analysis_expression.chado_node.inc index 55cc79b7..dd251146 100644 --- a/includes/tripal_analysis_expression.chado_node.inc +++ b/includes/tripal_analysis_expression.chado_node.inc @@ -711,12 +711,18 @@ function chado_analysis_expression_biomaterial_validator_submit($form, &$form_st $re_ext = '/^.+\.(' . $fileext . ')/'; // A matrix file. - if ($filetype == 'mat' and is_file($filepath) and preg_match($re_ext,$filepath)) { + if ($filetype == 'mat' and is_file($filepath)) { $data_ln = 0; $mat_fp = fopen($filepath, 'r'); //Check a single matrix file. while($line = fgets($mat_fp)) { if ($data_ln == 1 or !$re_start) { + // Make sure this is actually a tab separated file. + if (!preg_match('/\t/', $line, $matches)) { + drupal_set_message(t('Warning: the expression loader expects a tab separated file. Please ensure the expression file is a tab separated file. Warning thrown on line:') . "\n", 'warning'); + drupal_set_message($line, 'warning'); + return; + } $linepart = preg_split('/\t/',$line,-1,PREG_SPLIT_NO_EMPTY); // Trim whitespace from biomaterial names. foreach ($linepart as $biomaterial) { From 793683a4f3fb406efd0a3964122777412925bc74 Mon Sep 17 00:00:00 2001 From: bioi Date: Tue, 31 May 2016 19:03:57 -0400 Subject: [PATCH 2/3] Change chart color to green and other tweaks. --- includes/tripal_biomaterial_loader.inc | 3 +- theme/js/expression.js | 38 +++++++++++++------------- tripal_analysis_expression.install | 4 +-- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/includes/tripal_biomaterial_loader.inc b/includes/tripal_biomaterial_loader.inc index 7c42eba5..fb9a3750 100644 --- a/includes/tripal_biomaterial_loader.inc +++ b/includes/tripal_biomaterial_loader.inc @@ -383,7 +383,8 @@ function flat_biomaterial_parser($flat_path, $organism_id, $flat_file_type) { $db_id - create_ncbi_db('bioproject', 'NCBI BioProject', ''); } // First check to see if there is a dbxref record in the database corresponding to the accession number from the file. - if (empty(chado_select_record('dbxref', array('dbxref_id'), array('accession' => $line[$index], 'db_id' => $db_id)))) { + $record = chado_select_record('dbxref', array('dbxref_id'), array('accession' => $line[$index], 'db_id' => $db_id)); + if (empty($record)) { // Insert value into dbxref table. $values = array( 'accession' => $line[$index], diff --git a/theme/js/expression.js b/theme/js/expression.js index 64ab20d2..c8001ab7 100644 --- a/theme/js/expression.js +++ b/theme/js/expression.js @@ -147,8 +147,8 @@ function expKey(maxHeat, minHeat) { var rSH = recSize/2; /* Set the colors of the key. The colors are green, black, and red. */ - var heatMapKey = [{"r": 255, "g": 0, "b": 0, "text": "min expression (" + minHeat + ") -"}, - {"r": 0, "g": 0, "b": 0, "text": ""}, + var heatMapKey = [{"r": 0, "g": 0, "b": 0, "text": "min expression (" + minHeat + ") -"}, + {"r": 0, "g": 127, "b": 0, "text": ""}, {"r": 0, "g": 255, "b": 0, "text": " - (" + maxHeat + ") max expression"}]; /* Configure the key text. */ @@ -210,7 +210,7 @@ function expSub(heatMap,maxHeat,minHeat) { graphHeight = 100; } - hF = 511/maxHeat; + hF = 255/maxHeat; numTiles = heatMap.length; /* Get the size of the figure. */ @@ -289,11 +289,11 @@ function expSub(heatMap,maxHeat,minHeat) { if(d.intensity == 0) { return d3.rgb(204,204,204); } - if ((d.intensity*hF) <= 255) { - return d3.rgb(255-(d.intensity*hF),0,0); - } + // if ((d.intensity*hF) <= 255) { + // return d3.rgb(255-(d.intensity*hF),0,0); + // } else { - return d3.rgb(0,(d.intensity*hF)-255,0); + return d3.rgb(0,(d.intensity*hF),0); } }) .style("top", (d3.event.pageY - 28) + "px"); @@ -353,12 +353,12 @@ function expSub(heatMap,maxHeat,minHeat) { .style("max-width", 200 + "px") .style("left", (d3.event.pageX) + "px") .style("border-color", function() { - if ((d.intensity*hF) <= 255) { - return d3.rgb(255-(d.intensity*hF),0,0); - } - else { - return d3.rgb(0,(d.intensity*hF)-255,0); - } + //if ((d.intensity*hF) <= 255) { + // return d3.rgb(255-(d.intensity*hF),0,0); + //} + //else { + return d3.rgb(0,(d.intensity*hF),0); + //} }) .style("top", (d3.event.pageY - 28) + "px"); }) @@ -367,12 +367,12 @@ function expSub(heatMap,maxHeat,minHeat) { .duration(500) .style("opacity",0); }) - .style("fill", function (d) { if ((d.intensity*hF) <= 255) { - return d3.rgb(255-(d.intensity*hF),0,0); - } - else { - return d3.rgb(0,(d.intensity*hF)-255,0); - } + .style("fill", function (d) { //if ((d.intensity*hF) <= 255) { + // return d3.rgb(255-(d.intensity*hF),0,0); + //} + //else { + return d3.rgb(0,(d.intensity*hF),0); + //} }); var graphGroup = graphContainer.append("g") diff --git a/tripal_analysis_expression.install b/tripal_analysis_expression.install index 65995664..aa450ccb 100644 --- a/tripal_analysis_expression.install +++ b/tripal_analysis_expression.install @@ -464,11 +464,11 @@ function tripal_analysis_expression_add_cvterms() { * @ingroup tripal_analysis_expression */ function tripal_analysis_expression_uninstall() { - +/* // Get localization function for installation. $t = get_t(); // Unregister the analysis. tripal_unregister_analysis_child('tripal_analysis_expression'); - +*/ } From ec3857cb647b1ce15939db6bf5af65f361486bca Mon Sep 17 00:00:00 2001 From: bioi Date: Tue, 31 May 2016 22:48:57 -0400 Subject: [PATCH 3/3] Changes to readme and admin page. --- README.md | 12 +++++++++--- includes/tripal_analysis_expression_config.admin.inc | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 251ffeff..4729af26 100644 --- a/README.md +++ b/README.md @@ -174,10 +174,8 @@ The following panes are added to the following content types: ### Biomaterial * **Overview (base)** - The generic tripal overview pane. -* **Feature Browser** - A list of features associated with the biomaterial. * **Properties** - Properties associated with the biomaterial. * **Cross References** - Accession terms associated with the biomaterial. -* **Relationships** - Relationships associated with the biomaterial. ### Array Design * **Overview (base)** - The generic tripal overview pane. @@ -200,7 +198,15 @@ Each Analysis: Expression content type has administrative pages. As an administr ![Administrator Pages for Content Types](https://cloud.githubusercontent.com/assets/14822959/13010514/2d2dc7be-d170-11e5-8670-92bdded6659d.png) ### Expression Display Administrative Page -The display of expression data on feature pages can be configured. +The display of expression data on feature pages can be configured. To configure the expression figure, navigate to **Tripal->Extensions->Expression Analysis->Tripal Expression Analysis Settings**. Available options are: + +* **Hide Expression Figure** - Hide expression figures on all feature pages. With this option you can load expression data without displaying the expression figure. +* **Hide Biomaterial Labels** - Hide the name of the biomaterial under the expression figure tile or column. Biomaterial names will still appear in tooltips. +* **Maximum Label Length** - Set the maximum acceptable biomaterial name length. Biomaterial names that are longer than this length will be truncated. +* **Expession Column Width** - Change the size of the width of the tile or column in the figure. Value must be 15 or greater. +* **Default Heatmap Display** - The default display can be either a one dimensional heatmap or a bar chart. + + diff --git a/includes/tripal_analysis_expression_config.admin.inc b/includes/tripal_analysis_expression_config.admin.inc index 4034da0c..3b9441e7 100644 --- a/includes/tripal_analysis_expression_config.admin.inc +++ b/includes/tripal_analysis_expression_config.admin.inc @@ -67,10 +67,10 @@ function tripal_analysis_expression_config_admin() { $form['feature_expression']['expression_display'] = array( '#type' => 'radios', - '#title' => t('Heatmap Display'), + '#title' => t('Default Heatmap Display'), '#options' => array( 'tile' => t('One Dimensional Heatmap'), - 'column' => t('Column Display'), + 'column' => t('Chart Display'), ), '#default_value' => variable_get('chado_feature_expression_expression_display','column'), );