Sfoglia il codice sorgente

Fixed Issue #1809994. The FASTA loader now correctly loads relationships and external DB referneces. Also, removed the requirement that residues have only IUPAC characters. The check incorrectly forgot protein characters, but also sometimes there may be additional characters and we shouldn't limit the field

spficklin 12 anni fa
parent
commit
7c95f3d958

+ 6 - 3
tripal_feature/includes/fasta_loader.inc

@@ -812,6 +812,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
           array('%name' => $name, '%uname' => $numane), WATCHDOG_ERROR);
         return 0;
       }
+    } 
+    else {
+      $dbxref = $results[0];
     }
 
     // check to see if the feature dbxref record exists if not, then add it
@@ -851,13 +854,13 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
    // check to see if the relationship already exists if not then add it
     $values = array(
       'subject_id' => $feature->feature_id,
-      'ojbect_id' => $parent_feature->feature_id,
+      'object_id' => $parent_feature->feature_id,
       'type_id' => $relcvterm->cvterm_id,    
     );
     $sel_options = array('statement_name' => 'sel_featurerelationship_suojty');
-    $results = tripal_core_chado_select('feature_relationship', array('feature_relationships_id'), $values, $sel_options);
+    $results = tripal_core_chado_select('feature_relationship', array('feature_relationship_id'), $values, $sel_options);
     if (count($results) == 0) {    
-      $ins_options = array('statement_name' => 'sel_featurerelationship_suojty');
+      $ins_options = array('statement_name' => 'ins_featurerelationship_suojty');
       $success = tripal_core_chado_insert('feature_relationship', $values, $ins_options);
       if (!$success) {
         watchdog('T_fasta_loader', "Failed to add associate database accession '%accession' with feature", 

+ 6 - 10
tripal_feature/includes/syncFeatures.inc

@@ -71,7 +71,7 @@ function tripal_feature_sync_form() {
   $form['organism_id'] = array(
     '#title'       => t('Organism'),
     '#type'        => t('select'),
-    '#description' => t("Choose the organism for which features set above will be synced."),
+    '#description' => t("Choose the organism for which features set above will be synced. Only organisms which also have been synced will appear in this list."),
     '#options'     => $organisms,
   );
 
@@ -284,11 +284,7 @@ function tripal_feature_sync_features($max_sync = 0, $organism_id = NULL,
  * @ingroup tripal_feature
  */
 function tripal_feature_sync_feature($feature_id) {
-  //   print "\tSyncing feature $feature_id\n";
-
-  $mem = memory_get_usage(TRUE);
-  $mb = $mem/1048576;
-  //   print "$mb mb\n";
+  //print "\tSyncing feature $feature_id\n";
 
   global $user;
   $create_node = 1;   // set to 0 if the node exists and we just sync and not create
@@ -397,16 +393,16 @@ function tripal_feature_sync_feature($feature_id) {
     // validate the node and if okay then submit
     node_validate($new_node);
     if ($errors = form_get_errors()) {
-      foreach ($errors as $key => $msg) {
-        drupal_set_message(t("%msg", array('%msg' => $msg)));
+      print "Error encountered validating new node. Cannot sync\n";
+      foreach ($errors as $key => $msg) {        
+        watchdog('trp-fsync', "%msg", array('%msg' => $msg), 'error');
       }
-      return $errors;
+      exit;
     }
     else {
       $node = node_submit($new_node);
       node_save($node);
     }
-
   }
   else {
     $node = $chado_feature;

+ 0 - 10
tripal_feature/tripal_feature.module

@@ -928,16 +928,6 @@ function chado_feature_validate($node) {
     }
   }
 
-  // we want to remove all characters except IUPAC nucleotide characters from the
-  // the residues. however, residues are not required so if blank then we'll skip
-  // this step
-  if ($node->residues) {
-    $residues = preg_replace("/[^\w]/", '', $node->residues);
-    if (!preg_match("/^[ACTGURYMKSWBDHVN]+$/i", $residues)) {
-      form_set_error('residues', t("The residues in feature $node->name contains more than the nucleotide IUPAC characters. Only the following characters are allowed: A,C,T,G,U,R,Y,M,K,S,W,B,D,H,V,N: '" . $residues . "'"));
-    }
-  }
-
   // we don't allow a genbank accession number for a contig
   if ($node->feature_type == 'contig' and $node->gbaccession) {
     form_set_error('gbaccession', t("Contigs cannot have a genbank accession number.  Please change the feature type or remove the accession number"));