Преглед изворни кода

Fixed bugs and some themeing, and added support for parsing query matches in the blast analysis.

spficklin пре 14 година
родитељ
комит
5ac6843b37

+ 5 - 3
theme_tripal/css/tripal.css

@@ -7,8 +7,7 @@
 }
 .tripal-table th, 
 .tripal-table td {
-   padding-left: 5px;
-   padding-right: 5px;
+   padding: 5px;
 }
 .tripal-table-horz {
    border-top: 2px solid #999999;
@@ -57,9 +56,12 @@ table.tripal-table-horz .tripal-table-odd-row {
 
 .tripal-info-box-title {
   font-size: 1.5em;
-  padding-bottom: 5px;
+  padding-bottom: 15px;
 
 }
+.tripal-info-box-desc {
+  padding-bottom: 15px;
+}
 /* hide the title when inside of a block on a panel */
 .pane-block .tripal-info-box-title {
    visibility: hidden;

+ 6 - 0
theme_tripal/js/tripal_analysis.js

@@ -0,0 +1,6 @@
+if (Drupal.jsEnabled) {
+
+
+
+}
+

+ 13 - 3
theme_tripal/js/tripal_analysis_go.js

@@ -1,8 +1,18 @@
-//
-// Copyright 2009 Clemson University
-//
+
 
 if (Drupal.jsEnabled) {
+
+
+   $(document).ready(function() {
+       // Select default GO analysis when available
+       var selectbox = $('#edit-tripal-analysis-go-select');
+       if(selectbox){ 
+          selectbox[0].selectedIndex = 1;
+          tripal_analysis_go_org_charts(selectbox.val());
+       }
+   });
+
+
    function tripal_analysis_go_org_charts(item){
       if(!item){
          $("#tripal_analysis_go_org_charts").html('');

+ 9 - 3
theme_tripal/js/tripal_analysis_kegg.js

@@ -1,12 +1,18 @@
-//
-// Copyright 2009 Clemson University
-//
+
 
 if (Drupal.jsEnabled) {
    $(document).ready(function() {
       $(".tripal_kegg_brite_tree").attr("id", function(){
 			init_kegg_tree($(this).attr("id"));    
       });
+
+       // Select default KEGG analysis when available
+       var selectbox = $('#edit-tripal-analysis-kegg-select');
+       if(selectbox){ 
+          selectbox[0].selectedIndex = 1;
+          tripal_analysis_kegg_org_report(selectbox.val());
+       }
+
    });
 
    //------------------------------------------------------------

+ 0 - 3
theme_tripal/js/tripal_cv.js

@@ -1,6 +1,3 @@
-//
-// Copyright 2009 Clemson University
-//
 
 if (Drupal.jsEnabled) {
    var baseurl;

+ 1 - 1
tripal_analysis/tripal_analysis.module

@@ -400,7 +400,7 @@ function chado_analysis_form ($node){
       '#rows' => 15,
       '#title' => t('Description and/or Program Settings'),
       '#required' => FALSE,
-      '#default_value' => check_plain($node->analysis->description),
+      '#default_value' => $node->analysis->description,
       '#description' => t('Please provide all necessary information to allow
          someone to recreate the analysis, including materials and methods
          for collection of the source data and performing the analysis'),

+ 12 - 11
tripal_analysis_blast/parse_blast_XML.inc

@@ -207,9 +207,6 @@ function tripal_analysis_blast_parseXML($analysis_id, $blastdb, $blastfile,
 					$feature_id = 0;
 					foreach($iterations->children() as $iteration_tags) {
 
-
-
-
 						// Match chado feature uniquename with <Iteration_query-def>
 						// and get the feature_id
 						$featurenaem_xml = '';
@@ -219,7 +216,6 @@ function tripal_analysis_blast_parseXML($analysis_id, $blastdb, $blastfile,
                      // user's regular expression 
 							if ($query_re and preg_match("/$query_re/", $iteration_tags, $matches)) {
 								$feature = $matches[1];
-								
 							} 
                      // If not in above format then pull up to the first space
                      else {
@@ -230,7 +226,13 @@ function tripal_analysis_blast_parseXML($analysis_id, $blastdb, $blastfile,
                         else {
                            $feature = $iteration_tags;
                         }
+                     }   
+
+                     if(!$feature and $query_re){
+                        print "ERROR: cannot find feature for $iteration_tags using the regular expression: $query_re\n";
+                        exit;
                      }
+
                      // now find the feature in chado
                      $select = array();
                      if($query_uniquename){
@@ -246,29 +248,28 @@ function tripal_analysis_blast_parseXML($analysis_id, $blastdb, $blastfile,
                           'name' => $query_type,
                         );
                      }
+
                      $feature_arr = tripal_core_chado_select('feature',array('feature_id'),$select);
                      if(count($feature_arr) > 1){
   							   fwrite($log, "Ambiguous: '$feature' matches more than one feature and is being skipped.\n");
 								continue;
                      }
-                     if(count($feature_arr) < 1){
+                     if(count($feature_arr) == 0){
 								fwrite($log, "Failed: '$feature' cannot find a matching feature in the database.\n");
                         continue;
                      }
                      $feature_id = $feature_arr[0]->feature_id;
+
     						fwrite($log, "Matched: '$feature' => feature id:".$feature_id);
 							$featurename_xml = $iteration_tags->asXML();
-
-							
 						} 
                   // Insert Iteration_hits into analysisfeatureprop and analysisfeature tables
                   else if($iteration_tags->getName() == 'Iteration_hits'){
 							if ($feature_id) {
-
 								// Make sure this iteration doesn't exist in analysisfeatureprop. If it does, update but not insert
 								$sql = "SELECT analysisfeatureprop_id FROM {analysisfeatureprop} AFP ".
-                            "INNER JOIN analysisfeature AF ON AF.analysisfeature_id = AFP.analysisfeature_id ".       
-                            "WHERE feature_id=%d ".
+                               "INNER JOIN analysisfeature AF ON AF.analysisfeature_id = AFP.analysisfeature_id ".       
+                               "WHERE feature_id=%d ".
                             "AND analysis_id=%d ".
                             "AND type_id=%d ";
 
@@ -278,7 +279,6 @@ function tripal_analysis_blast_parseXML($analysis_id, $blastdb, $blastfile,
 								// parse all hits
 								if ($no_parsed == 'all') {
 									$xml_content .= $iteration_tags->asXML();
-								
 								// parse only top hits
 								} else {
 									$counter = 0;
@@ -297,6 +297,7 @@ function tripal_analysis_blast_parseXML($analysis_id, $blastdb, $blastfile,
 
 								// If this Iteration_hits already exists, update it
 								if ($analysisfeatureprop) {
+
 									$sql = "UPDATE {analysisfeatureprop} ".
                                "SET value = '%s' ".
                                "WHERE analysisfeatureprop_id = %d ";

+ 4 - 2
tripal_analysis_blast/tripal_analysis_blast.module

@@ -393,6 +393,7 @@ function chado_analysis_blast_form ($node){
    $blast = $node->analysis->tripal_analysis_blast;
    $blastdb = $blast->blastdb;
    $blastfile    = $blast->blastfile;
+   $blastfile_ext    = $blast->blastfile_ext;
    $blastparameters = $blast->blastparameters;
 
    $query_re = $blast->query_re;
@@ -697,7 +698,8 @@ function chado_analysis_blast_submit_jobs($node){
 
    // add a job if the user wants to parse the XML	    	
 	if($node->blastjob) {
-      $job_args = array($analysis_id,
+      $job_args = array(
+          $node->analysis_id,
           $node->blastdb,
           $node->blastfile,
           $node->no_parsed,
@@ -716,7 +718,7 @@ function chado_analysis_blast_submit_jobs($node){
 	}
    // add a job if the user wants to create a best hits report.
 	if($node->blastbesthit) {
-      $j_args[0] = $analysis_id;	
+      $j_args[0] = $node->analysis_id;	
 		tripal_add_job("Parse best hit: $node->blastfile",'tripal_analysis_blast',
                      'tripal_analysis_blast_parse_best_hit', $j_args, $user->uid);			
    }

+ 1 - 1
tripal_analysis_go/tripal_analysis_go.module

@@ -221,7 +221,7 @@ function tripal_analysis_go_select_form(&$form_state = NULL,$node){
    }
   
    # create the select box
-   $form['analysis_select'] = array(
+   $form['tripal_analysis_go_select'] = array(
       '#title' => t('Select a GO report to view'),
       '#description' => t('Any analysis with GO results related to this organism are available for viewing. For further information, see the analysis information page.'),
       '#type'  => 'select',

+ 1 - 1
tripal_analysis_interpro/tripal_analysis_interpro.module

@@ -143,7 +143,7 @@ function chado_analysis_interpro_form ($node){
       '#rows' => 15,
       '#title' => t('Description and/or Program Settings'),
       '#required' => FALSE,
-      '#default_value' => check_plain($node->description),
+      '#default_value' => $node->description,
       '#weight' => 9
 	);
 

+ 2 - 2
tripal_analysis_kegg/tripal_analysis_kegg.module

@@ -260,7 +260,7 @@ function chado_analysis_kegg_form ($node){
       '#rows' => 15,
       '#title' => t('Description and/or Program Settings'),
       '#required' => FALSE,
-      '#default_value' => check_plain($node->description),
+      '#default_value' => $node->description,
       '#weight' => 9
    );
 
@@ -1132,7 +1132,7 @@ function tripal_analysis_kegg_select_form(&$form_state = NULL,$node){
    }
   
    # create the select box
-   $form['analysis_select'] = array(
+   $form['tripal_analysis_kegg_select'] = array(
       '#title' => t('Select a KEGG report to view'),
       '#description' => t('Any analysis with KEGG results related to this organism are available for viewing. For further information, see the analysis information page.'),
       '#type'  => 'select',

+ 1 - 1
tripal_organism/tripal_organism.module

@@ -755,7 +755,7 @@ function chado_organism_form ($node, $param){
       '#rows' => 15,
       '#title' => t('Description'),
       '#required' => TRUE,
-      '#default_value' => check_plain($organism->description),
+      '#default_value' => $organism->description,
       '#weight' => 5
    );
    $form['organism-image']= array(